Skip to content

Is there a way to use other extras for defining the "all" extra in pyproject.toml? #3627

Answered by maxnoe
maxnoe asked this question in Q&A
Discussion options

You must be logged in to vote

@abravalheri I think I found a good solution, it seems it is possible (though I am not sure this is specified somewhere or just an accident) to depend on the package itself in pyproject.toml like this:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"


[project]
name = "test_self_dep"
version = "0.1.0"
dependencies = [
    "requests",
]

[tool.setuptools.packages.find]
where = ["src"]


[project.optional-dependencies]
docs = [
    "sphinx",
]
tests = [
    "pytest",
]
all = [
    "test_self_dep[docs,tests]"
]

If that is indeed intentional, might we add this example to the docs?

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Joshuaalbert
Comment options

Comment options

You must be logged in to vote
1 reply
@abravalheri
Comment options

Answer selected by abravalheri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants