================
extras_require
================
.. start short_desc
**Display a warning at the top of module documentation that it has additional requirements.**
.. end short_desc
.. start shields
.. list-table::
:stub-columns: 1
:widths: 10 90
* - Docs
- |docs| |docs_check|
* - Tests
- |actions_linux| |actions_windows| |actions_macos| |coveralls|
* - PyPI
- |pypi-version| |supported-versions| |supported-implementations| |wheel|
* - Anaconda
- |conda-version| |conda-platform|
* - Activity
- |commits-latest| |commits-since| |maintained| |pypi-downloads|
* - QA
- |codefactor| |actions_flake8| |actions_mypy|
* - Other
- |license| |language| |requires|
.. |docs| image:: https://img.shields.io/readthedocs/extras-require/latest?logo=read-the-docs
:target: https://extras-require.readthedocs.io/en/latest
:alt: Documentation Build Status
.. |docs_check| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Docs%20Check/badge.svg
:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Docs+Check%22
:alt: Docs Check Status
.. |actions_linux| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Linux/badge.svg
:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Linux%22
:alt: Linux Test Status
.. |actions_windows| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Windows/badge.svg
:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Windows%22
:alt: Windows Test Status
.. |actions_macos| image:: https://github.com/sphinx-toolbox/extras_require/workflows/macOS/badge.svg
:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22macOS%22
:alt: macOS Test Status
.. |actions_flake8| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Flake8/badge.svg
:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Flake8%22
:alt: Flake8 Status
.. |actions_mypy| image:: https://github.com/sphinx-toolbox/extras_require/workflows/mypy/badge.svg
:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22mypy%22
:alt: mypy status
.. |requires| image:: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/extras_require/badge.svg
:target: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/extras_require/
:alt: Requirements Status
.. |coveralls| image:: https://img.shields.io/coveralls/github/sphinx-toolbox/extras_require/master?logo=coveralls
:target: https://coveralls.io/github/sphinx-toolbox/extras_require?branch=master
:alt: Coverage
.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/sphinx-toolbox/extras_require?logo=codefactor
:target: https://www.codefactor.io/repository/github/sphinx-toolbox/extras_require
:alt: CodeFactor Grade
.. |pypi-version| image:: https://img.shields.io/pypi/v/extras_require
:target: https://pypi.org/project/extras_require/
:alt: PyPI - Package Version
.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/extras_require?logo=python&logoColor=white
:target: https://pypi.org/project/extras_require/
:alt: PyPI - Supported Python Versions
.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/extras_require
:target: https://pypi.org/project/extras_require/
:alt: PyPI - Supported Implementations
.. |wheel| image:: https://img.shields.io/pypi/wheel/extras_require
:target: https://pypi.org/project/extras_require/
:alt: PyPI - Wheel
.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/extras_require?logo=anaconda
:target: https://anaconda.org/domdfcoding/extras_require
:alt: Conda - Package Version
.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/extras_require?label=conda%7Cplatform
:target: https://anaconda.org/domdfcoding/extras_require
:alt: Conda - Platform
.. |license| image:: https://img.shields.io/github/license/sphinx-toolbox/extras_require
:target: https://github.com/sphinx-toolbox/extras_require/blob/master/LICENSE
:alt: License
.. |language| image:: https://img.shields.io/github/languages/top/sphinx-toolbox/extras_require
:alt: GitHub top language
.. |commits-since| image:: https://img.shields.io/github/commits-since/sphinx-toolbox/extras_require/v0.5.0
:target: https://github.com/sphinx-toolbox/extras_require/pulse
:alt: GitHub commits since tagged version
.. |commits-latest| image:: https://img.shields.io/github/last-commit/sphinx-toolbox/extras_require
:target: https://github.com/sphinx-toolbox/extras_require/commit/master
:alt: GitHub last commit
.. |maintained| image:: https://img.shields.io/maintenance/yes/2023
:alt: Maintenance
.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/extras_require
:target: https://pypi.org/project/extras_require/
:alt: PyPI - Downloads
.. end shields
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:
.. code-block:: python
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:
.. code-block:: rest
.. extras-require:: formulae
:file: formulae/requirements.txt
will produce this:
.. image:: doc-source/example.png
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:
.. code-block:: python
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
--------------
.. start installation
``extras_require`` can be installed from PyPI or Anaconda.
To install with ``pip``:
.. code-block:: bash
$ python -m pip install extras_require
To install with ``conda``:
* First add the required channels
.. code-block:: bash
$ conda config --add channels https://conda.anaconda.org/conda-forge
$ conda config --add channels https://conda.anaconda.org/domdfcoding
* Then install
.. code-block:: bash
$ conda install extras_require
.. end installation
Enable ``extras_require`` by adding "sphinxcontrib.extras_require" to the ``extensions`` variable in ``conf.py``:
.. code-block:: python
extensions = [
...
"sphinxcontrib.extras_require",
]
For more information see https://www.sphinx-doc.org/en/master/usage/extensions/index.html#third-party-extensions .
Links
-----
- Source: https://github.com/sphinx-toolbox/extras-require
- Bugs: https://github.com/sphinx-toolbox/extras-require/issues
Raw data
{
"_id": null,
"home_page": "https://github.com/sphinx-toolbox/extras_require",
"name": "extras-require",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "documentation,requirements,sphinx,sphinx-extension",
"author": "",
"author_email": "Dominic Davis-Foster <dominic@davis-foster.co.uk>",
"download_url": "https://files.pythonhosted.org/packages/6e/d2/dd3dfc25b0d4948de7a0aeb1d21b5cdee6f2289e39013fd0273220fed5ba/extras_require-0.5.0.tar.gz",
"platform": "Windows",
"description": "\n================\nextras_require\n================\n\n.. start short_desc\n\n**Display a warning at the top of module documentation that it has additional requirements.**\n\n.. end short_desc\n\n.. start shields\n\n.. list-table::\n\t:stub-columns: 1\n\t:widths: 10 90\n\n\t* - Docs\n\t - |docs| |docs_check|\n\t* - Tests\n\t - |actions_linux| |actions_windows| |actions_macos| |coveralls|\n\t* - PyPI\n\t - |pypi-version| |supported-versions| |supported-implementations| |wheel|\n\t* - Anaconda\n\t - |conda-version| |conda-platform|\n\t* - Activity\n\t - |commits-latest| |commits-since| |maintained| |pypi-downloads|\n\t* - QA\n\t - |codefactor| |actions_flake8| |actions_mypy|\n\t* - Other\n\t - |license| |language| |requires|\n\n.. |docs| image:: https://img.shields.io/readthedocs/extras-require/latest?logo=read-the-docs\n\t:target: https://extras-require.readthedocs.io/en/latest\n\t:alt: Documentation Build Status\n\n.. |docs_check| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Docs%20Check/badge.svg\n\t:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Docs+Check%22\n\t:alt: Docs Check Status\n\n.. |actions_linux| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Linux/badge.svg\n\t:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Linux%22\n\t:alt: Linux Test Status\n\n.. |actions_windows| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Windows/badge.svg\n\t:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Windows%22\n\t:alt: Windows Test Status\n\n.. |actions_macos| image:: https://github.com/sphinx-toolbox/extras_require/workflows/macOS/badge.svg\n\t:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22macOS%22\n\t:alt: macOS Test Status\n\n.. |actions_flake8| image:: https://github.com/sphinx-toolbox/extras_require/workflows/Flake8/badge.svg\n\t:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22Flake8%22\n\t:alt: Flake8 Status\n\n.. |actions_mypy| image:: https://github.com/sphinx-toolbox/extras_require/workflows/mypy/badge.svg\n\t:target: https://github.com/sphinx-toolbox/extras_require/actions?query=workflow%3A%22mypy%22\n\t:alt: mypy status\n\n.. |requires| image:: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/extras_require/badge.svg\n\t:target: https://dependency-dash.repo-helper.uk/github/sphinx-toolbox/extras_require/\n\t:alt: Requirements Status\n\n.. |coveralls| image:: https://img.shields.io/coveralls/github/sphinx-toolbox/extras_require/master?logo=coveralls\n\t:target: https://coveralls.io/github/sphinx-toolbox/extras_require?branch=master\n\t:alt: Coverage\n\n.. |codefactor| image:: https://img.shields.io/codefactor/grade/github/sphinx-toolbox/extras_require?logo=codefactor\n\t:target: https://www.codefactor.io/repository/github/sphinx-toolbox/extras_require\n\t:alt: CodeFactor Grade\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/extras_require\n\t:target: https://pypi.org/project/extras_require/\n\t:alt: PyPI - Package Version\n\n.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/extras_require?logo=python&logoColor=white\n\t:target: https://pypi.org/project/extras_require/\n\t:alt: PyPI - Supported Python Versions\n\n.. |supported-implementations| image:: https://img.shields.io/pypi/implementation/extras_require\n\t:target: https://pypi.org/project/extras_require/\n\t:alt: PyPI - Supported Implementations\n\n.. |wheel| image:: https://img.shields.io/pypi/wheel/extras_require\n\t:target: https://pypi.org/project/extras_require/\n\t:alt: PyPI - Wheel\n\n.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/extras_require?logo=anaconda\n\t:target: https://anaconda.org/domdfcoding/extras_require\n\t:alt: Conda - Package Version\n\n.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/extras_require?label=conda%7Cplatform\n\t:target: https://anaconda.org/domdfcoding/extras_require\n\t:alt: Conda - Platform\n\n.. |license| image:: https://img.shields.io/github/license/sphinx-toolbox/extras_require\n\t:target: https://github.com/sphinx-toolbox/extras_require/blob/master/LICENSE\n\t:alt: License\n\n.. |language| image:: https://img.shields.io/github/languages/top/sphinx-toolbox/extras_require\n\t:alt: GitHub top language\n\n.. |commits-since| image:: https://img.shields.io/github/commits-since/sphinx-toolbox/extras_require/v0.5.0\n\t:target: https://github.com/sphinx-toolbox/extras_require/pulse\n\t:alt: GitHub commits since tagged version\n\n.. |commits-latest| image:: https://img.shields.io/github/last-commit/sphinx-toolbox/extras_require\n\t:target: https://github.com/sphinx-toolbox/extras_require/commit/master\n\t:alt: GitHub last commit\n\n.. |maintained| image:: https://img.shields.io/maintenance/yes/2023\n\t:alt: Maintenance\n\n.. |pypi-downloads| image:: https://img.shields.io/pypi/dm/extras_require\n\t:target: https://pypi.org/project/extras_require/\n\t:alt: PyPI - Downloads\n\n.. end shields\n\n\nOverview\n--------\n\nThis extension assumes you have a repository laid out like this:\n\n::\n\n\t.\n\t\u251c\u2500\u2500 chemistry_tools\n\t\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\t\u2502\u00a0\u00a0 \u251c\u2500\u2500 formulae\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 compound.py\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 formula.py\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 parser.py\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 requirements.txt\n\t\u2502\u00a0\u00a0 \u251c\u2500\u2500 constants.py\n\t\u2502\u00a0\u00a0 \u2514\u2500\u2500 utils.py\n\t\u251c\u2500\u2500 doc-source\n\t\u2502\u00a0\u00a0 \u251c\u2500\u2500 api\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 chemistry_tools.rst\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 elements.rst\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 formulae.rst\n\t\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 pubchem.rst\n\t\u2502\u00a0\u00a0 \u251c\u2500\u2500 conf.py\n\t\u2502\u00a0\u00a0 \u251c\u2500\u2500 index.rst\n\t\u2502\u00a0\u00a0 \u2514\u2500\u2500 requirements.txt\n\t\u251c\u2500\u2500 LICENSE\n\t\u251c\u2500\u2500 README.rst\n\t\u251c\u2500\u2500 requirements.txt\n\t\u251c\u2500\u2500 setup.py\n\t\u2514\u2500\u2500 tox.ini\n\nThe file ``./chemistry_tools/formulae/requirements.txt`` contains the additional requirements to run the ``formulae`` subpackage. These would be defined in ``setup.py`` like this:\n\n.. code-block:: python\n\n\tsetup(\n\t\t\textras_require={\n\t\t\t\t\t\"formulae\": [\n\t\t\t\t\t\t\t\"mathematical>=0.1.7\",\n\t\t\t\t\t\t\t\"pandas>=1.0.1\",\n\t\t\t\t\t\t\t\"pyparsing>=2.2.0\",\n\t\t\t\t\t\t\t\"tabulate>=0.8.3\",\n\t\t\t\t\t\t\t\"cawdrey>=0.1.2\",\n\t\t\t\t\t\t\t\"quantities>=0.12.4\",\n\t\t\t\t\t\t\t],\n\t\t\t\t\t}\n\t\t\t)\n\nA message can be displayed in the documentation to indicate that the subpackage has these additional requirements that must be installed.\n\nFor instance, this:\n\n.. code-block:: rest\n\n\t.. extras-require:: formulae\n\t\t:file: formulae/requirements.txt\n\nwill produce this:\n\n.. image:: doc-source/example.png\n\nThe 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.\n\nI.e, this line:\n\n.. code-block:: python\n\n\tpackage_root = \"chemistry_tools\"\n\npoints to ``./chemistry_tools``, and therefore ``:file: formulae/requirements.txt`` points to ``./chemistry_tools/formulae/requirements.txt``.\n\nRequirements 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.\n\nThe ``: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.\n\nInstallation\n--------------\n\n.. start installation\n\n``extras_require`` can be installed from PyPI or Anaconda.\n\nTo install with ``pip``:\n\n.. code-block:: bash\n\n\t$ python -m pip install extras_require\n\nTo install with ``conda``:\n\n\t* First add the required channels\n\n\t.. code-block:: bash\n\n\t\t$ conda config --add channels https://conda.anaconda.org/conda-forge\n\t\t$ conda config --add channels https://conda.anaconda.org/domdfcoding\n\n\t* Then install\n\n\t.. code-block:: bash\n\n\t\t$ conda install extras_require\n\n.. end installation\n\nEnable ``extras_require`` by adding \"sphinxcontrib.extras_require\" to the ``extensions`` variable in ``conf.py``:\n\n.. code-block:: python\n\n\textensions = [\n\t\t...\n\t\t\"sphinxcontrib.extras_require\",\n\t\t]\n\nFor more information see https://www.sphinx-doc.org/en/master/usage/extensions/index.html#third-party-extensions .\n\n\nLinks\n-----\n\n- Source: https://github.com/sphinx-toolbox/extras-require\n- Bugs: https://github.com/sphinx-toolbox/extras-require/issues\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Display a warning at the top of module documentation that it has additional requirements.",
"version": "0.5.0",
"project_urls": {
"Documentation": "https://extras-require.readthedocs.io/en/latest",
"Homepage": "https://github.com/sphinx-toolbox/extras_require",
"Issue Tracker": "https://github.com/sphinx-toolbox/extras_require/issues",
"Source Code": "https://github.com/sphinx-toolbox/extras_require"
},
"split_keywords": [
"documentation",
"requirements",
"sphinx",
"sphinx-extension"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b1c2b9a6dfe1de9a1b40bd9246f04462383cc4b8b0d9dcaf44b1a314dedc07d9",
"md5": "bf15ca7a5d3bcd26fd0f6cbae494ed01",
"sha256": "989141d7f34dd9ef7506bb6931f1909686cea9fa1fb464826174e4137d3e92db"
},
"downloads": -1,
"filename": "extras_require-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bf15ca7a5d3bcd26fd0f6cbae494ed01",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 35396,
"upload_time": "2023-04-14T11:59:12",
"upload_time_iso_8601": "2023-04-14T11:59:12.829563Z",
"url": "https://files.pythonhosted.org/packages/b1/c2/b9a6dfe1de9a1b40bd9246f04462383cc4b8b0d9dcaf44b1a314dedc07d9/extras_require-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6ed2dd3dfc25b0d4948de7a0aeb1d21b5cdee6f2289e39013fd0273220fed5ba",
"md5": "3479c657cb329d6a50acb66e8839b573",
"sha256": "8def077204816b234a352660ec71c753d574304fb3ccee0cb00078094750fff5"
},
"downloads": -1,
"filename": "extras_require-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "3479c657cb329d6a50acb66e8839b573",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9911,
"upload_time": "2023-04-14T11:59:14",
"upload_time_iso_8601": "2023-04-14T11:59:14.102540Z",
"url": "https://files.pythonhosted.org/packages/6e/d2/dd3dfc25b0d4948de7a0aeb1d21b5cdee6f2289e39013fd0273220fed5ba/extras_require-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-14 11:59:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sphinx-toolbox",
"github_project": "extras_require",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "docutils",
"specs": [
[
">=",
"0.16"
]
]
},
{
"name": "domdf-python-tools",
"specs": [
[
">=",
"0.7.1"
]
]
},
{
"name": "packaging",
"specs": [
[
">=",
"20.4"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"49.2.0"
]
]
},
{
"name": "shippinglabel",
"specs": [
[
">=",
"0.10.0"
]
]
},
{
"name": "sphinx",
"specs": [
[
">=",
"3.4.0"
]
]
},
{
"name": "sphinx-prompt",
"specs": [
[
">=",
"1.1.0"
]
]
},
{
"name": "sphinx-toolbox",
"specs": [
[
">=",
"2.13.0"
]
]
}
],
"tox": true,
"lcname": "extras-require"
}