Skip to content

Commit 0d2d1f2

Browse files
authored
Add pyprojects.toml example for using setuptools (#1851)
* Add more pyprojects.toml examples * add optional deps and remove unnecessary fields
1 parent 24ac629 commit 0d2d1f2

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,28 @@ supports both installing your ``project.dependencies`` as well as your
7878
``project.optional-dependencies``. Thanks to the fact that this is an
7979
official standard, you can use ``pip-compile`` to pin the dependencies
8080
in projects that use modern standards-adhering packaging tools like
81-
`Hatch <https://hatch.pypa.io/>`_ or `flit <https://flit.pypa.io/>`_.
81+
`Setuptools <https://setuptools.pypa.io>`_ , `Hatch <https://hatch.pypa.io/>`_
82+
or `flit <https://flit.pypa.io/>`_.
8283

83-
Suppose you have a Django application that is packaged using ``Hatch``, and you
84+
Suppose you have a 'foobar' Python application that is packaged using ``Setuptools``,
85+
and you want to pin it for production. You can declare the project metadata as:
86+
87+
.. code-block:: toml
88+
89+
[build-system]
90+
requires = ["setuptools", "setuptools-scm"]
91+
build-backend = "setuptools.build_meta"
92+
93+
[project]
94+
requires-python = ">=3.9"
95+
name = "foobar"
96+
dynamic = ["dependencies", "optional-dependencies"]
97+
98+
[tool.setuptools.dynamic]
99+
dependencies = { file = ["requirements.in"] }
100+
optional-dependencies.test = { file = ["requirements-test.txt"] }
101+
102+
If you have a Django application that is packaged using ``Hatch``, and you
84103
want to pin it for production. You also want to pin your development tools
85104
in a separate pin file. You declare ``django`` as a dependency and create an
86105
optional dependency ``dev`` that includes ``pytest``:

0 commit comments

Comments
 (0)