Skip to content
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

Re-export DataFrames, CSV and JSON? #407

Open
efaulhaber opened this issue Feb 28, 2024 · 5 comments
Open

Re-export DataFrames, CSV and JSON? #407

efaulhaber opened this issue Feb 28, 2024 · 5 comments

Comments

@efaulhaber
Copy link
Member

In the postprocessing example, and also in all the validation example files that will follow, we do

using DataFrames, CSV, JSON

all of which are also dependencies of TrixiParticles.

Would it make sense to re-export these names, so that users don't have to add a lot of extra packages to the run environment to run these files?
@sloede ?

@sloede
Copy link
Member

sloede commented Feb 28, 2024

Since each additional exported package may cause naming conflict with a user's REPL session, I would advise against it. Especially since for a regular user, it is then no longer clear that some of the functionality they use are actually from other packages and not TrixiParticles.jl itself.

@efaulhaber
Copy link
Member Author

Do you have any other suggestions then? It's extremely annoying when a new user wants to run one of these examples and gets 5 consecutive errors that a package is missing.

@sloede
Copy link
Member

sloede commented Feb 28, 2024

I'd say proper documentation is key. In each example you give, all the necessary usings should be included. Other than that, I don't know.

If it turns out that there are certain postprocessing steps that could benefit from wrapping them in a high-level function in TrixiP, you might do that and only export the high-level function.

Another alternative is that you don't just export whole packages, but if there's, e.g.,. just 2-3 types/functions from DataFrames that a user might want to have available, you could just export those (like we do with SVector in Trixi.jl).

@efaulhaber
Copy link
Member Author

The usings are included. A user with a new environment will just get a warning "package CSV not installed", runs ]add CSV, then gets a warning "package DataFrames not installed", etc.

We need CSV.read("file.csv", DataFrame) and JSON.parsefile("file.json").

@sloede
Copy link
Member

sloede commented Feb 28, 2024

In Trixi.jl we have a similar issue and we solved it by modifying the installation instructions, saying that for postprocessing you may want to install the following, additional pacakges using something like Pkg.add(["DataFrames", "JSON", "CSV"]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants