Skip to content

Commit

Permalink
Add pyprojects.toml example for using setuptools (#1851)
Browse files Browse the repository at this point in the history
* Add more pyprojects.toml examples

* add optional deps and remove unnecessary fields
  • Loading branch information
shatakshiiii authored May 3, 2023
1 parent 24ac629 commit 0d2d1f2
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,28 @@ supports both installing your ``project.dependencies`` as well as your
``project.optional-dependencies``. Thanks to the fact that this is an
official standard, you can use ``pip-compile`` to pin the dependencies
in projects that use modern standards-adhering packaging tools like
`Hatch <https://hatch.pypa.io/>`_ or `flit <https://flit.pypa.io/>`_.
`Setuptools <https://setuptools.pypa.io>`_ , `Hatch <https://hatch.pypa.io/>`_
or `flit <https://flit.pypa.io/>`_.

Suppose you have a Django application that is packaged using ``Hatch``, and you
Suppose you have a 'foobar' Python application that is packaged using ``Setuptools``,
and you want to pin it for production. You can declare the project metadata as:

.. code-block:: toml
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
requires-python = ">=3.9"
name = "foobar"
dynamic = ["dependencies", "optional-dependencies"]
[tool.setuptools.dynamic]
dependencies = { file = ["requirements.in"] }
optional-dependencies.test = { file = ["requirements-test.txt"] }
If you have a Django application that is packaged using ``Hatch``, and you
want to pin it for production. You also want to pin your development tools
in a separate pin file. You declare ``django`` as a dependency and create an
optional dependency ``dev`` that includes ``pytest``:
Expand Down

0 comments on commit 0d2d1f2

Please sign in to comment.