extras_require
Display a warning at the top of module documentation that it has additional requirements.
Docs |
|
|---|---|
Tests |
|
PyPI |
|
Anaconda |
|
Activity |
|
QA |
|
Other |
Overview
This extension assumes you have a repository laid out like this:
. ├── chemistry_tools │ ├── __init__.py │ ├── formulae │ │ ├── __init__.py │ │ ├── compound.py │ │ ├── formula.py │ │ ├── parser.py │ │ └── requirements.txt │ ├── constants.py │ └── utils.py ├── doc-source │ ├── api │ │ ├── chemistry_tools.rst │ │ ├── elements.rst │ │ ├── formulae.rst │ │ └── pubchem.rst │ ├── conf.py │ ├── index.rst │ └── requirements.txt ├── LICENSE ├── README.rst ├── requirements.txt ├── setup.py └── tox.ini
The file ./chemistry_tools/formulae/requirements.txt contains the additional requirements to run the formulae subpackage. These would be defined in setup.py like this:
setup(
extras_require={
"formulae": [
"mathematical>=0.1.7",
"pandas>=1.0.1",
"pyparsing>=2.2.0",
"tabulate>=0.8.3",
"cawdrey>=0.1.2",
"quantities>=0.12.4",
],
}
)
A message can be displayed in the documentation to indicate that the subpackage has these additional requirements that must be installed.
For instance, this:
.. extras-require:: formulae
:file: formulae/requirements.txt
will produce this:
The path given in :file: is relative to the package_root variable given in conf.py, which in turn is relative to the parent directory of the sphinx documentation.
I.e, this line:
package_root = "chemistry_tools"
points to ./chemistry_tools, and therefore :file: formulae/requirements.txt points to ./chemistry_tools/formulae/requirements.txt.
Requirements can also be specified in pyproject.toml (using the option :pyproject:), setup.cfg (using the option :setup.cfg::), or by typing in the requirements manually, one per line.
The :scope: option can be used to specify a different scope for additional requirements, such as package, module, class or function. Any string value can be supplied here.
Installation
extras_require can be installed from PyPI or Anaconda.
To install with pip:
$ python -m pip install extras_require
To install with conda:
First add the required channels
$ conda config --add channels https://conda.anaconda.org/conda-forge $ conda config --add channels https://conda.anaconda.org/domdfcoding
Then install
$ conda install extras_require
Enable extras_require by adding “sphinxcontrib.extras_require” to the extensions variable in conf.py:
extensions = [
...
"sphinxcontrib.extras_require",
]
For more information see https://www.sphinx-doc.org/en/master/usage/extensions/index.html#third-party-extensions .
Links
Metadata
Release files for extras-require 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| extras_require-0.5.0.tar.gz | 9.9 kB | Without provenance | Details for extras_require-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| extras_require-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for extras_require-0.5.0-py3-none-any.whl |
Total release size: 45.3 kB
Release files / extras_require-0.5.0.tar.gz
| Download URL | extras_require-0.5.0.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8def077204816b234a352660ec71c753d574304fb3ccee0cb00078094750fff5
|
|
BLAKE2b-256 checksum How to use checksums |
6ed2dd3dfc25b0d4948de7a0aeb1d21b5cdee6f2289e39013fd0273220fed5ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / extras_require-0.5.0-py3-none-any.whl
| Download URL | extras_require-0.5.0-py3-none-any.whl |
|---|---|
| Size | 35.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
989141d7f34dd9ef7506bb6931f1909686cea9fa1fb464826174e4137d3e92db
|
|
BLAKE2b-256 checksum How to use checksums |
b1c2b9a6dfe1de9a1b40bd9246f04462383cc4b8b0d9dcaf44b1a314dedc07d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for extras-require 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.