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

Optional-dependency docs: add a self-dependency example #724

Merged
merged 6 commits into from
Feb 8, 2023

Conversation

AlexWaygood
Copy link
Contributor

Hi, thanks for hatch/hatchling!

This PR adds a short example to the docs for how to add a self-dependency when dealing with optional feature groups. It took me a while to figure out how to do this, and this example would have helped me.

From the sound of it, it seems like this is an officially supported feature of Python packaging and won't be going away anytime soon: https://discuss.python.org/t/pyproject-toml-optional-dependencies-redundancy-aka-dry-extras/8428/6

@AlexWaygood
Copy link
Contributor Author

I don't think any of the ruff complaints are caused by this PR -- they all seem to be linting errors in .py files, and this PR only touches the docs.

Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com>
@Bobronium
Copy link
Contributor

This doesn't work for me when my project name overlaps with other project available on PyPI (though I'm installing it in editable mode):

[project]
name = "chatbot"

[project.optional-dependencies]
profiling = ["pyinstrument"]
debugging = ["ipython"]
style = ["ruff", "black"]
testing = ["pytest", "pytest-cov"]
typechecking = ["mypy"]
all = ["chatbot[style,profiling,debugging,testing,typechecking]"]

Upon hatch run mypy, I get:

WARNING: chatbot 1.5.2b0 does not provide the extra 'debugging'
WARNING: chatbot 1.5.2b0 does not provide the extra 'profiling'
WARNING: chatbot 1.5.2b0 does not provide the extra 'style'
WARNING: chatbot 1.5.2b0 does not provide the extra 'testing'
WARNING: chatbot 1.5.2b0 does not provide the extra 'typechecking'
/bin/sh: mypy: command not found

docs/config/dependency.md Outdated Show resolved Hide resolved
docs/config/dependency.md Outdated Show resolved Hide resolved
Co-authored-by: Ofek Lev <ofekmeister@gmail.com>
@ofek
Copy link
Collaborator

ofek commented Feb 8, 2023

This doesn't work for me when my project name overlaps with other project available on PyPI

Mention that here pypa/pip#11296

@AlexWaygood AlexWaygood requested a review from ofek February 8, 2023 14:51
Copy link
Collaborator

@ofek ofek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ofek ofek merged commit effb365 into pypa:master Feb 8, 2023
@AlexWaygood AlexWaygood deleted the patch-1 branch February 8, 2023 14:58
github-actions bot pushed a commit that referenced this pull request Feb 8, 2023
* Optional-dependency docs: add a self-dependency example

* nit

* Update docs/config/dependency.md

Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ofek Lev <ofekmeister@gmail.com>

---------

Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com>
Co-authored-by: Ofek Lev <ofekmeister@gmail.com> effb365
github-actions bot pushed a commit to cnpryer/hatch that referenced this pull request Feb 8, 2023
* Optional-dependency docs: add a self-dependency example

* nit

* Update docs/config/dependency.md

Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Ofek Lev <ofekmeister@gmail.com>

---------

Co-authored-by: Arseny Boykov <36469655+Bobronium@users.noreply.github.com>
Co-authored-by: Ofek Lev <ofekmeister@gmail.com> effb365
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 this pull request may close these issues.

3 participants