-
Notifications
You must be signed in to change notification settings - Fork 350
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
Add options to Python language module #993
Conversation
I'm planning on adding support for pdm soon, and for that, these changes would facilitate its use as well. Also, I don't think we don't want to use |
If nothing speaks against it, I would go ahead and try adding a similar option for the JavaScript module, since one might also want to have the |
1bbdd53
to
6b215f3
Compare
See also #899, I'd really like to have a test for this before it's merged. |
f1b2130
to
f1f49e7
Compare
@domenkozar I have modified the example for I also added an example and tests for the introduced directory option, as you requested. In this example I have also tested the |
src/modules/languages/python.nix
Outdated
@@ -135,6 +135,14 @@ in | |||
description = "Whether `pip install` should avoid outputting messages during devenv initialisation."; | |||
}; | |||
|
|||
directory = lib.mkOption { |
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.
does it work if you do ./.
with types.path
and then do config.devenv.root + cfg.directory
?
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 I understand what you mean.
In #993 (comment) I mentioned that using types.str
means not copying the specified directory to the Nix store, so poetry is still able to write the lock file.
It also gives users more flexibility when setting the option as they can set it to either an absolute path or a path relative to the devenv root with something like ./directory
. I've added an example to the option.
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 think you should be still able to use types.path
to validate it's a path and then do mystringpath + cfg.directory
Great work, only two comments and it's ready to go :) |
0ddeaae
to
5b5e8e0
Compare
@totoroot ping :) |
Can you rebase on main and I'll take over this one :) |
5b5e8e0
to
8c97d19
Compare
@domenkozar Sorry, I did not have time to finish this up. Had a lot to do at work since last week, so I'm happy to hand it over to you :) |
Recently I continued using devenv for various different projects at work, so the need to have it also manage multi-language development environments got bigger.
For a lot of projects, the structure looks similar to the following.
In this example
backend
would for example be the subdirectory of some Python/Django component and then there would be thefrontend
subdirectory e.g. some JavaScript/Node.js component.For that reason I would like to specify a subdirectory for the individual components.
In this PR I made the necessary changes to be able to specify a working directory via
languages.python.directory
.While it is already possible to pass paths of requirements files to install dependencies from, it is currently not possible to specify the location of the virtual environment or to change the working directory of the poetry command.
This makes it impossible to have the
pyproject.toml
file anywhere other than at the devenv root.I also added some more missing options to
languages.python.poetry.install
.