Repository navigation
Testing project.optional-dependencies without duplicating dependencies #1751
Replies: 1 comment
|
You can avoid duplicating the package's optional-dependency lists. Hatch environments have a With the metadata in the question, the environments can be: [project.optional-dependencies]
release = [
"requests>=2.25,<3.0",
"numpy>=1.20,<2.0",
]
debug = [
"requests>=2.25,<3.0",
"numpy>=1.20,<2.0",
"pytest>=6.0,<7.0",
]
[tool.hatch.envs.release]
features = ["release"]
[tool.hatch.envs.debug]
features = ["debug"]Current Hatch documents If [tool.hatch.envs.debug]
features = ["debug"]
extra-dependencies = ["pytest>=6,<7"]That distinction is useful: So for the stated goal — test the same extras users install — |
Uh oh!
There was an error while loading. Please reload this page.
I'm sure I'm misunderstanding something here, but I just want to have two hatch envs, call them
releaseanddebugas an example. I want users to be able to install a different list of dependencies for each (e.g.pip install example-package[debug]vspip install example-package[release], and I want to use hatch to test that my package passes some basic tests using these exact same dependencies. For example:Do I really need to specify the dependencies and versions in two separate places like this? Am I fundamentally misunderstanding something here? I found a similar discussion here but no resolution.
All reactions