Skip to content

Commit 31a037c

Browse files
committed
Add a note in writing-pyproject-toml on how to handle missing extras
Closes gh-1605
1 parent 5b31c28 commit 31a037c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎source/guides/writing-pyproject-toml.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ Each of the keys defines a "packaging extra". In the example above, one
179179
could use, e.g., ``pip install your-project-name[gui]`` to install your
180180
project with GUI support, adding the PyQt5 dependency.
181181

182+
To keep your package usable without optional dependencies, import them only where
183+
needed, and handle their absence explicitly. If a user requests a feature whose
184+
dependencies are missing, provide an error message explaining which extra to
185+
install, for example, ``your-project-name[gui]``.
186+
182187
.. _self-referential-extras:
183188

184189
You can also define an extra that refers back to the current project with

0 commit comments

Comments
 (0)