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

Using DataToolkit inside a package #49

Open
BatyLeo opened this issue Jul 5, 2024 · 1 comment
Open

Using DataToolkit inside a package #49

BatyLeo opened this issue Jul 5, 2024 · 1 comment

Comments

@BatyLeo
Copy link

BatyLeo commented Jul 5, 2024

Hello, I would be interested in using DataToolkit directly inside a package in order to make loading datasets easier.

Following the tutorial, it works when creating an environment from scratch that is not a package, however it doesn't work when adding DataToolkit to a package environment.
When restarting the REPL after the init command, it doesn't load automatically the data collection when using DataToolkit.
I'm not sure if this is a bug or if I understood something wrong about this package usage?


To reproduce the issue:

(@v1.10) pkg> generate MyPackage
  Generating  project MyPackage:
    MyPackage/Project.toml
    MyPackage/src/MyPackage.jl

(@v1.10) pkg> activate MyPackage
  Activating project at `~/Documents/tuto/MyPackage`

(MyPackage) pkg> add DataToolkit

julia> using DataToolkit

() data> init
 Create Data.toml for current project? [Y/n]: y
 Name: tutorial
 Use checksums by default? [Y/n]: n
 ✓ Created new data collection 'tutorial' at /home/leo/Documents/tuto/MyPackage/Data.toml

(tutorial) data> 

After restarting the REPL:

(@v1.10) pkg> activate MyPackage
  Activating project at `~/Documents/tuto/MyPackage`

julia> using DataToolkit

() data> 
@tecosaur
Copy link
Owner

Hi Leo! Sorry for the late reply.

You'll want to call DataToolkit.init(@__MODULE__) inside the __init__ function of the package.

That should make the datasets availible, and you can check with data> stack list.

To make package usage easier in the future, the init function is likely going to be split off into the DataToolkitBase package in the next version BTW 🙂

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

No branches or pull requests

2 participants