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

Passing pip Install Parameters #397

Closed
KyleKing opened this issue Jun 14, 2021 · 5 comments
Closed

Passing pip Install Parameters #397

KyleKing opened this issue Jun 14, 2021 · 5 comments

Comments

@KyleKing
Copy link

I need pip to use an index-url for an internal repository (hosted with devpi), but it doesn't look like there is a way to pass arguments to pip for the initial install other than any global configuration (pip config edit)

The best way would be for poetry export to also export pip parameters (docs) in the requiremts.txt file, but getting that merged would be hard given the ~200 PR backlog 😢

The index URL is listed in tool.poetry.source of pyproject.toml, so nox-poetry could potentially extract it from there, but it might be more flexible to add a pip_params argument to nox_session instead (like the nox venv_params kwarg that exists now)

def session(*args: Any, **kwargs: Any) -> Any:

Which I think could then be passed to this install step:

Session_install(self.session, f"--constraint={requirements}", *args, **kwargs)

@cjolowicz
Copy link
Owner

Why not provide it in the environment (PIP_INDEX_URL)?

@cjolowicz
Copy link
Owner

cjolowicz commented Jun 14, 2021

Also, to my knowledge, Poetry does export --index-url. There are a few open issues related to that, so maybe you hit one of these. Either way, I'm not very keen on extending the nox-poetry API to tape around an upstream bug.

Update: Oh, but we'd filter that out when converting to constraints format for pip...

@cjolowicz
Copy link
Owner

Can you please check the output of poetry export in your project? Are you able to pip install -r requirements.txt from it?

I suppose that nox-poetry may want to collect pip options from the exported requirements.txt, and pass them via the command-line. They are not valid in a constraints file, so we need to filter them out.

@KyleKing
Copy link
Author

KyleKing commented Jun 14, 2021

Thanks for the quick reply!

You're right, poetry export does include the index-url! However, the trusted host argument is missing, so pip install wouldn't work out of the box (the internal domain is HTTP)

Having nox-poetry handle the pip arguments would be nice, but I'm generally happy with the global pip config appraoch. That is how our developer computers should be configured. We don't have multiple index-urls, but if needed, the PIP_INDEX_URL would be a good workaround

I think this issue can probably be closed as not within nox_poetry scope? Or reopened if you wanted to pursue parsing the pip arguments

@cjolowicz
Copy link
Owner

I've opened #398 for the question of collecting pip options from the exported requirements.

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