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

Make a project to be a module by default #397

Open
omerchiers opened this issue Sep 12, 2023 · 2 comments
Open

Make a project to be a module by default #397

omerchiers opened this issue Sep 12, 2023 · 2 comments
Labels
documentation Explaining how things work! enhancement New feature or request project-setup Related to the functionality "Project setup"

Comments

@omerchiers
Copy link

Is your feature request related to a problem? Please describe.
I think the root problem is the fact that Revise.jl does not track files that are included in a file that is itself called using includet.
This causes some annoyances when I have a file script.jl file in my script folder and I want to call source code from files in src/.
When I work on a script, I like to include it with includet which allows me to modify the file without reloading it. But then my included files in src/ are not visible. After every modification of the files in src/, you have to restart the REPL which is very annoying. This problem was also described by a user on discourse in this post .

Describe the solution you'd like
The solution I use is the make the project a module as is described in the manual here.
This solves all the mentioned issues. It is now possible to add 'using MyProject' in my script files and calling the functions. Revise.jl works perfectly since MyProject is a legal julia project and can hence be loaded.
The feature I would love to have is that when a project is created, the module would be automatically created. Granted, this is a very small step to perform by hand, but currently the module solution lacks discoverability since:

  1. it is not obvious that this solves a big pain point with the use of includet
  2. it is just one of the many possible workflows.

My feature request is hence to make the module by default and advertise this workflow more prominently.
It is not clear for me whether this is breaking or not. I guess for people who don't use the module approach, everything should just work the same. But I do understand that this could be slightly disruptive.

Describe alternatives you've considered
As an alternative, maybe a modification of the documentation would be sufficient to reflect better the advantages of the module approach.

Thanks,
Olivier

@Datseris
Copy link
Member

My feature request is hence to make the module by default and advertise this workflow more prominently.

This has it's own disadvantages though. Firstly, it is a breaking change (and hence we can't do it as a default). However, for me there is another reason to (sometimes) prefer the non-module approach: re-compilation. At least in my cases, where I constantly change parts of the src folder, each time I open up my project it gets recompiled if I use the module-as-project approach. This can take several minutes depending on the packages used.

What I would advocate, if you want to put in the time, is to make a Pull request that does two things:

  1. Advocate better the advantaes of the projec-as-module in the docs, as you mention.
  2. Add a keyword argument module to initialize_project thatn when true, it sets up the project so that there is the module structure alreay in place. However, the default value fo this keyword argument should be false.

@Datseris Datseris added enhancement New feature or request project-setup Related to the functionality "Project setup" documentation Explaining how things work! labels Sep 13, 2023
@omerchiers
Copy link
Author

Thanks a lot for your quick feedback.

Firstly, it is a breaking change (and hence we can't do it as a default)

That's indeed a strong argument against :-)

reason to (sometimes) prefer the non-module approach: re-compilation. At least in my cases, where I constantly change parts of the src folder, each time I open up my project it gets recompiled if I use the module-as-project approach.

Aha, I hadn't thought of that. That would be very annoying indeed.

What I would advocate, if you want to put in the time, is to make a Pull request

Great suggestions. I will give it a try since it would be my first pull request ever.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Explaining how things work! enhancement New feature or request project-setup Related to the functionality "Project setup"
Projects
None yet
Development

No branches or pull requests

2 participants