OldGrumpyViking / hatch-conda

Hatch plugin for conda environments
MIT License
38 stars 8 forks source link

Import dependencies_in_sync from hatchling #28

Closed jayqi closed 4 months ago

jayqi commented 7 months ago

Imports dependencies_in_sync from hatchling to check whether dependencies are synced, instead of using the hatching CLI via a shell command. This means that hatching just needs to be installed in the same environment as hatch/hatch-conda, but doesn't need it's CLI entrypoint to be available on the user's PATH.

This implementation is based on how hatch implements VirtualEnvironment.dependencies_in_sync.

https://github.com/pypa/hatch/blob/cfa05386f9dc4a029462a23a38d0885176efbaac/src/hatch/env/virtual.py#L128-L137

Closes #27.

Tested with pipx in a project using hatch-conda in the default environment:

pipx install hatch
pipx inject hatch git+https://github.com/jayqi/hatch-conda.git@27-fix-filenotfounderror-hatchling
hatch env create