Specify dependencies in pyproject.toml with install URL or with index-url

I like to have my package installable with pip install ... and to use the pyproject.toml standard.

I can specify dependencies to install from git, with:

dependencies = [
    'psychopy @ git+',

But how can I specify a dependency to install from a different indexer, equivalent to:

python -m pip install --pre --only-binary :all: -i numpy scipy

With or without the pre-release flag?

And how can I specify a dependency to install from a URL, e.g. I tried with no luck:

dependencies = [
    'wxPython @; python_version == "3.10"; sys_platform == "linux"'


  • I recommend reading the article "install_requires vs. requirements files" in the "Python packaging user guide".

    This article is partly outdated but the principle of abstract dependencies vs. concrete dependencies is unchanged. Concrete dependencies do not belong in packaging metadata, i.e. concrete dependencies can not be added to the dependencies list in the [project] table of the pyproject.toml file.

    As you have noted, it is possible to add "direct references" (for example psychopy @ git+, but not all packaging tools support this and notably PyPI rejects the upload of packages containing such dependencies.

    What I often recommend, is that if there are dependencies that are not on PyPI then the documentation should reflect that very clearly and prominently. Where to get the dependencies and some examples of how to install them should be in the documentation, for example the URLs of the alternative package repositories.

    And another thing that I recommend on top of the documentation is to provide one or more requirements.txt files that contain a list of concrete dependencies that have been tested and are known to work well. For example:

    psychopy @ git+
    wxPython @; python_version == "3.10"; sys_platform == "linux"

    And if I am not mistaken pip can install directly from the URL of such a requirements file: python -m pip install --requirement https://host.example/my-package/requirements.txt so such a command could be added to the documentation as well.