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

Full feature/extra support #1347

Closed
flying-sheep opened this issue Mar 25, 2024 · 2 comments · Fixed by #1387
Closed

Full feature/extra support #1347

flying-sheep opened this issue Mar 25, 2024 · 2 comments · Fixed by #1387

Comments

@flying-sheep
Copy link
Contributor

Python’s standard way to specify extras is mypkg[extra]. Therefore transitive extras can exist.

Hatch however only supports its own features key, not the standard syntax, when determining if the dependencies changed.

E.g. after adding a dependency to the test-min extra,hatch run test:<command> should sync dependencies fo the test environment.

[optional-dependencies]
test-min = ['pytest']
test = ['mypkg[test-min]']

[tool.hatch.envs.test]
dependencies = ['my-package-name']
features = ['test']

See also #842

@juftin
Copy link
Contributor

juftin commented Mar 30, 2024

I encountered a similar issue to this in juftin/hatch-pip-compile#78

Consider the following pyproject.toml:

[project]
name = "mypkg1234"
version = "1.0.0"

[project.optional-dependencies]
api = [
    "fastapi"
]
uvicorn = [
     "mypkg1234[api]",
     "uvicorn",
]

[tool.hatch.envs.uvicorn]
features = [ "uvicorn" ]

Inside of the EnvironmentPlugin my expected value of the dependencies property would be : ["fastapi", "uvicorn"] - but instead it's actually ["mypkg1234[api]", "uvicorn"].

I believe that unraveling the transitive dependencies on dependencies_complex would resolve this issue and mine. I'll take a look at this and see if I might be of some help.

@flying-sheep
Copy link
Contributor Author

Awesome, thank you @ofek!

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

Successfully merging a pull request may close this issue.

2 participants