GithubHelp home page GithubHelp logo

Comments (11)

jessebett avatar jessebett commented on May 21, 2024 1

Okay, but following the default setup from the DrWatson docs my Project.toml has no UUID. So I cannot ]dev .. Any idea there?

from drwatson.jl.

Datseris avatar Datseris commented on May 21, 2024 1

Hi @jessebett , thanks for opening this. I will now address your questions, and I hope I can resolve your confusions. Before that though, I need to stress the following point:

  • DrWatson is not a package to help you develop a Julia package. It is a package to help you manage your scientific project, which is represented by a Julia project. Notice that a Julia project does not have to be a Julia package. (But by definition, a Julia package is always a Julia project).

As you have already mentioned:

And that doesn't address that Project.toml has no UUID by default, so this is likely not the intended method to develop the project.

That is correct and is on purpose. The Project.toml file represents your scientific project, not a Julia package. What I assume you want to do is include a Julia package you are developing inside your own project.

This is how I do it, and how I suggest you do it:

image

Above, kwant_graphene, is my scientific project, which is also a Julia project, and is initialized by DrWatson. I use DrWatson throughout this project. In my src folder you will first see that I have some casual script files that define core functions, e.g. HusimiPlotting.jl. These files I normally include in all my script.

What you will see is that inside my project's src folder I also have two Julia packages, Chebyshev, HusimiFunctions. These are proper Julia packages in every sense of the way. I develop them normally and include them in my project normally using using HusimiFunctions and update them in real time with e.g. Revise. To create this setup you need the following steps:

  1. Active your project that uses DrWatson.
  2. Change directory to the project's src folder.
  3. Go into package mode and initialize a package with the name that you want (in my case HusimiFunctions)
  4. dev the local path to HusimiFunctions using the package manager , e.g. dev /path/to/project/src/HusimiFunctions. It is strongly recommended to dev this using local paths instead, see this PR that will be merged soon: JuliaLang/Pkg.jl#1215

That is it.

If this solves your concerns please let me know and I will put it into DrWatson's documentation as is.

from drwatson.jl.

jessebett avatar jessebett commented on May 21, 2024 1

Hi @Datseris. Yes, you are correct that my issue was conflating packages and projects. I've compartmentalized the package into its own sub-directory as you've suggested and it works for me. I agree that this could be worth highlighting in the docs.

from drwatson.jl.

asinghvi17 avatar asinghvi17 commented on May 21, 2024

You can dev any project with a Project.toml that has a name, UUID, and src/ProjectName.jl. That will play well with Revise AFAIK - it just informs Julia that the package will change.

from drwatson.jl.

jessebett avatar jessebett commented on May 21, 2024

Further, if I get a uuid from Pkg.generate and put it in there, I cannot ]dev . because, understandably, ERROR: Cannot develop package with same name or uuid as the project.

from drwatson.jl.

asinghvi17 avatar asinghvi17 commented on May 21, 2024

Switch to the global env and then dev it? Should work then.

from drwatson.jl.

jessebett avatar jessebett commented on May 21, 2024

Switch to the global env, dev it, then switch back? Or are you proposing I work inside the global env which would defeat the whole purpose of working in a project, no?

from drwatson.jl.

jessebett avatar jessebett commented on May 21, 2024

And that doesn't address that Project.toml has no UUID by default, so this is likely not the intended method to develop the project.

I already have a patch (which is to push the srcdir to the LOAD_PATH but I'm trying to learn the correct/intended way to do this, instead of workarounds. It seems to me that if I have to manually generate a UUID, add it to the Project.toml and ]dev from outside my project env, then something isn't right.

The main consideration is that this should be easily reproducible. That I should be able to just hand this repo to someone else and have it work. That definitely won't be easy if there needs to be messing with LOAD_PATH or environments to get the scripts to work with using MyModule...

from drwatson.jl.

Datseris avatar Datseris commented on May 21, 2024

@jessebett can you please tell me if this was okay for you?

from drwatson.jl.

Datseris avatar Datseris commented on May 21, 2024

Thanks, will do so soon! :)

from drwatson.jl.

asinghvi17 avatar asinghvi17 commented on May 21, 2024

Might also be worth using git submodules? Could be too much hassle though...

from drwatson.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.