-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define JSON.lower(CatValue) if JSON is available #96
Conversation
I'm very much against adding a dependency on Requires in general, but especially in a package so far down the stack. |
Yes, I'd rather wait until we have optional dependencies (IIUC they should be supported in Julia 0.7). |
??? As of when? |
Is there a proper way to optionally define
|
The use of Requires isn't discouraged in general; some packages and ecosystems prefer to use it, but the JuliaStats and JuliaData packages avoid it. It's a matter of preference and consistency.
No |
I mean, when it will be released. :-) I guess we could add a dependency on JSON until then, but that's not great and that would create a precedent for other dependencies. Last time we added a dependency on a lightweight Juno package for DataFrames, we ended up reverting it, so... Do you have an actual need for this? |
Sometimes I'm just saving dataframes to json, but today I have stumbled over it while trying to draw a plot using PlotlyJS ( |
As an alternative, maybe something along these lines: |
That's clever, but that could slow down some essential operations, so that doesn't sound great. |
Given that this makes PlotlyJS unusable with DataFrames with categorical columns, I guess we should add the dependency on JSON for now (without Requires). BTW, special support for CategoricalArrays will be needed so that the ordering of levels is respected when plotting. See similar issues: plotly/plotly.js#189, vega/altair#245 and vega/vega-lite#2915. |
0ed73a1
to
91e9676
Compare
Codecov Report
@@ Coverage Diff @@
## master #96 +/- ##
==========================================
- Coverage 97.78% 97.58% -0.21%
==========================================
Files 9 10 +1
Lines 678 662 -16
==========================================
- Hits 663 646 -17
- Misses 15 16 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should use Requires here.
91e9676
to
d8a8b13
Compare
JSON is a hard dependency now. CI failures seem unrelated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Let's go with that since there's no other solution at this point...
Now that Requires.jl is no longer a hack, I've used it to get rid of the dependency on JSON: #163. |
Actually, it turns out that Requires imposes a significant penalty on load time, which people complain about (JuliaData/DataFrames.jl#1764). On my machine, with Julia master, |
Yeah, Requires may no longer be a hack, but it still isn't a great solution. I'm fine with a dependency on JSON, as it's a common package to have installed anyway. |
OK, see #189. |
Uses Requires.jl to define
JSON.json(::CatValue)
if JSON is present.Fixes #95