Skip to main content

File support for setuptools declarative setup.cfg

Project description

Declarative setuptools Config Requirements Files Support

This projects adds the ability for projects using setuptools declarative configuration to specify requirements using requirements files.

There's a reason why this isn't, at least yet, supported by default. Please read why.

Anyway, if you know what you're doing, then this library solves the missing feature of defining requirements using requirements files.

setup.cfg

Your setup.cfg should include a section named requirements-files, like:

[requirements-files]
setup_requires = requirements/setup.txt
install_requires = requirements/base.txt
tests_require = requirements/tests.txt
extras_require =
  docs = requirements/docs.txt
  cli = requirements/cli.txt

⚠ ATTENTION

The requirements files MUST be included in the wheel file aswell as the source tarball

For the example shown above, in setup.cfg, add something like:

[options.data_files]
. = requirements/*.txt

Or something like the folowing on your MANIFEST.in:

include requirements/*.txt

Or, if you use setuptools-scm, the requirements files need to be committed to the SCM repo.

pyproject.toml

Your pyproject.toml should also include setuptools-declarative-requirements:

[build-system]
requires = ["setuptools>=50.3.2", "wheel", "setuptools-declarative-requirements"]
build-backend = "setuptools.build_meta"

setup.py

Some projects still use a setup.py shim, similar to:

#!/usr/bin/env python
import setuptools

if __name__ == "__main__":
    setuptools.setup()

If this is your case, your setup.cfg needs an extra bit of tweak. Make sure you have setuptools-declarative-requirements in your setup_requires:

[options]
setup_requires =
  setuptools>=50.3.2
  setuptools-declarative-requirements

Do Note That

⚠ This project makes no attempt to validate your requirements files.

The only thing it does is include every non empty line from your requirements files which does not start with #, -r or --.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file setuptools-declarative-requirements-1.3.0.tar.gz.

File metadata

File hashes

Hashes for setuptools-declarative-requirements-1.3.0.tar.gz
Algorithm Hash digest
SHA256 57a5b9bb9ad350c278e8aa6be4cdebbcd925b9ba71d6a712a178a618cfb898f7
MD5 c3e620b62fdda54c80baae2609c4061f
BLAKE2b-256 f00685fb4a4ccb82f5040cd5ddc4ab55db5f9d16e0a1b43887e82a8e671e17cb

See more details on using hashes here.

File details

Details for the file setuptools_declarative_requirements-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for setuptools_declarative_requirements-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 90f1e0e2bb41d2779a79cd25ca4e8c059b52b9dc53df54647b6d1dd9ae00978b
MD5 c82f3d22c39a36dbd1e8bab8d4432d29
BLAKE2b-256 146439aa062aabf855178080c75a5e6b2825ce5664623024b3e7def2883d5184

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page