I am currently working on a suite of Python projects where conflicting dependencies are to be expected. For example, we have a wheel that is depending on numpy==1.24.0 and a wheel that is depending on numpy==1.26.4. The way we've been approaching this is to generate an expanded_requirements.txt by installing each of the explicit dependencies in requirements.txt into a clean virtual environment using --dry-run and recording the returned dependencies into the expanded_requirements.txt file. In our hatch.toml we are defining:
The high-level idea is that the developer can then go through the expanded_requirements.txt and resolve conflicts. For example, delete the line referring to numpy==1.26.4 and confirm that the tests pass using numpy==1.24.0. Then, when the wheel is created, or environments are created, the --no-deps flag can be used with either pip or uv pip to install the dependencies explicitly listed in requirements.txt and expanded_requirements.txt.
However, when hatch goes to install the project, there is no way to specify --no-deps. Therefore, when I go to try and create the types or hatch-test environments, I see errors around the conflicting dependencies that would normally arise from trying to install the explicitly required packages.
I have attempted adding a uv.toml with:
[pip]
no-deps = true
This does correctly disable dependency expansion, but this ends up breaking the installation of hatch's infrastructure packages in the backends.
I think what I would like is either:
A way to specify arguments to the install command.
An explicit option for installing the hatch project using --no-deps.
For example, if I add skip-install = true to the [envs.hatch-test], then I am able to correctly load the shell. Once I'm in the shell, I can run uv pip install --no-deps -r requirements.txt -r expanded_requirements.txt to install all of the dependencies correctly. I thought of using this command in the post-install-commands, but it looks like none of install, pre-install-commands or post-install-commands are executed when skip-install is specified.
I am happy to help with a PR, but would love some feedback from the community (@ofek) on the best way to proceed. Thank you for your time!
I am currently working on a suite of Python projects where conflicting dependencies are to be expected. For example, we have a wheel that is depending on
numpy==1.24.0
and a wheel that is depending onnumpy==1.26.4
. The way we've been approaching this is to generate anexpanded_requirements.txt
by installing each of the explicit dependencies inrequirements.txt
into a clean virtual environment using--dry-run
and recording the returned dependencies into theexpanded_requirements.txt
file. In ourhatch.toml
we are defining:The high-level idea is that the developer can then go through the
expanded_requirements.txt
and resolve conflicts. For example, delete the line referring tonumpy==1.26.4
and confirm that the tests pass usingnumpy==1.24.0
. Then, when the wheel is created, or environments are created, the--no-deps
flag can be used with eitherpip
oruv pip
to install the dependencies explicitly listed inrequirements.txt
andexpanded_requirements.txt
.However, when hatch goes to install the project, there is no way to specify
--no-deps
. Therefore, when I go to try and create thetypes
orhatch-test
environments, I see errors around the conflicting dependencies that would normally arise from trying to install the explicitly required packages.I have attempted adding a
uv.toml
with:This does correctly disable dependency expansion, but this ends up breaking the installation of hatch's infrastructure packages in the backends.
I think what I would like is either:
--no-deps
.For example, if I add
skip-install = true
to the[envs.hatch-test]
, then I am able to correctly load the shell. Once I'm in the shell, I can runuv pip install --no-deps -r requirements.txt -r expanded_requirements.txt
to install all of the dependencies correctly. I thought of using this command in thepost-install-commands
, but it looks like none of install, pre-install-commands or post-install-commands are executed whenskip-install
is specified.I am happy to help with a PR, but would love some feedback from the community (@ofek) on the best way to proceed. Thank you for your time!