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

Feature: --pre installs for pre-release and development versions #603

Closed
tlambert03 opened this issue Nov 16, 2022 · 8 comments
Closed

Feature: --pre installs for pre-release and development versions #603

tlambert03 opened this issue Nov 16, 2022 · 8 comments

Comments

@tlambert03
Copy link

Just starting with hatch. Love it, thank you so much!

Apologies if I've missed this feature somewhere: I'm looking for a flag that would allow me to install pre-release and development versions in a hatch environment (i.e. with pip install --pre; akin to pip_pre in tox). I looked through the docs, source code, and issues and didn't find anything yet.

(The motivation is that, as a part of CI, I'd like to run my tests with pre-releases)

thanks!!

@blink1073
Copy link
Contributor

I second this request; ideally we could pass arbitrary arguments to pip, since we also have a job that uses a constraints file to install the minimum versions of dependencies.

@ofek
Copy link
Sponsor Collaborator

ofek commented Nov 16, 2022

Hey thanks!

You can use env vars https://hatch.pypa.io/1.6/how-to/environment/package-indices/

@tlambert03
Copy link
Author

Thanks @ofek! I'm afraid I might need slightly more detail than that.
I looked through the pip docs on pre-release versions and environment variables, and did some googling, but still can't find an env var (or a package index url) that pip would use to toggle installing pre-releases. do you happen to know it off the top of your head?

@blink1073
Copy link
Contributor

export PIP_PRE=1 worked for me locally.

@blink1073
Copy link
Contributor

So in my other use case it would be export PIP_CONSTRAINT=<file_path>.

@ofek
Copy link
Sponsor Collaborator

ofek commented Nov 16, 2022

https://pip.pypa.io/en/stable/topics/configuration/#environment-variables

[tool.hatch.envs.default.env-vars]
PIP_PRE = "1"

@tlambert03
Copy link
Author

Thanks both. Much appreciated

@flying-sheep
Copy link
Contributor

flying-sheep commented May 16, 2024

Figured out how do do it from the advanced env docs and uv’s env var docs:

[[envs.hatch-test.matrix]]
python = ["3.12"]
deps = ["stable", "pre"]
[envs.hatch-test.overrides]
matrix.deps.env-vars = [
  { key = "UV_PRERELEASE", value = "allow", if = ["pre"] },
]

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

4 participants