-
Notifications
You must be signed in to change notification settings - Fork 18
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
Ignore extras #276
Comments
Hi @thedrow nox-poetry should only install extras that you specify explicitly, using |
nox-poetry installs all extras: I've managed to customize the code. See celery/jumpstarter@04fa573 for a solution. Unfortunately (and that's another problem), poetry still exports the extra dependency to the requirements file even with my workaround. |
nox-poetry activates all extras when exporting the requirements, but it does not install them. The requirements file is used as a constraints file; in other words, it specifies the versions at which packages should be installed, but does not cause any package to be installed per se. Thanks for the link to your code though. Looking at the pyproject.toml on your branch, I can see that your extra maps to a git dependency. Unfortunately, git dependencies are not supported in constraints files with recent pip. See #141 for a similar issue. Can you post the error message that you're seeing? |
Same as before as the git dependency is exported. I think poetry shouldn't export optional dependencies unless we explictly asked for them. https://github.com/celery/jumpstarter/pull/23/checks?check_run_id=1878884946#step:6:17 |
FTR nox > Command python -m pip install --constraint=.nox/test-3-8/tmp/requirements.txt file:///home/runner/work/jumpstarter/jumpstarter/dist/jumpstarter-0.1.0-py3-none-any.whl failed with exit code 1: |
Right now I'm bypassing it like this: There should be an option to ignore the constraints file. |
You can use a public API instead: def install_transitions_from_git(session):
session.run(
"python", "-m", "pip", "install", "git+https://git@github.com/pytransitions/transitions.git"
)
Hm 🤔 The use case of invoking the original BTW I noticed in your noxfile that you're still invoking |
No. You need to provide a flag that will bypass nox-poetry so that the API would remain the same.
It's temporary until we fix python-poetry/poetry#1644 and then we can just introduce it to nox-poetry. python-poetry/poetry#2917 will also help in the next release since I'd be able to only install dev dependencies (and I think nox-poetry should support that as well). |
Follow https://github.com/python-poetry/poetry/issues/3451#issuecomment-778090264 for updates. |
Thank you for your input!
Let me first make sure I understand what you are proposing. Option 1: Provide a flag to @session
def tests(session):
session.install(
"git+https://git@github.com/pytransitions/transitions.git",
constraints=False,
) Option 2 (could be combined): Provide a flag to the @session(constraints=False)
def tests(session):
session.install(...) # without constraints
session.poetry.install(...) # with constraints The decorator flag would need to be forwarded through the To be frank, I'm not a big fan of boolean flags. They have their uses, but I The other issue I have with this approach is that the interface now diverges |
The issues I mentioned prevent me from both using nox and poetry effectively and I hope they'll be resolved soon. |
@thedrow Can you please provide clear information on what issue you're having with nox-poetry, as opposed to nox and poetry, as well as a minimal reproducible example? As I said before, nox-poetry does not install extras unless you ask it to, so without further input from your side, I'm going to have to close this. As for the git dependency, your branch does not seem to use it any longer. I'll also repeat that you're getting minimal benefit from using nox-poetry, seen that you're invoking |
Closing this as nox-poetry works as designed with respect to extras. I'm happy to reopen this if you provide additional input. As for the git dependency, let's move this discussion to #141. Feel free to open a separate feature request if you have an idea for a better API to install packages without constraints. |
How do I make nox-poetry ignore the extras I have when I
session.install(".")
?The text was updated successfully, but these errors were encountered: