Skip to content

Add pyprojects.toml example for using setuptools #1851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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