Metadata-Version: 2.4
Name: drain-swamp
Version: 2.1.2
Summary: Python build backend with build plugins and dependency lock switch
Author-email: Dave Faulkmore <faulkmore@protonmail.com>
License-Expression: MPL-2.0
Project-URL: Documentation, https://msftcangoblowm.github.io/drain-swamp
Project-URL: Docs (rtd), https://drain-swamp.readthedocs.io/en/stable
Project-URL: Changes, https://raw.githubusercontent.com/msftcangoblowm/drain-swamp/master/CHANGES.rst
Project-URL: PyPI Releases, https://pypi.org/project/drain-swamp
Project-URL: Source code, https://github.com/msftcangoblowm/drain-swamp
Project-URL: Issue tracker, https://github.com/msftcangoblowm/drain-swamp/issues
Project-URL: Mastodon, https://mastodon.social/@msftcangoblowme
Keywords: pipenv,pip,pip-tools,dependency lock
Classifier: Environment :: Console
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Build Tools
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/x-rst
License-File: LICENSE
License-File: NOTICE.txt
Requires-Dist: drain-swamp-snippet
Requires-Dist: pluggy
Requires-Dist: setuptools-scm
Requires-Dist: wreck
Provides-Extra: pip
Requires-Dist: packaging==26.3; extra == "pip"
Requires-Dist: setuptools-scm==10.3.4; extra == "pip"
Requires-Dist: pip==24.3.1; extra == "pip"
Provides-Extra: pip-tools
Requires-Dist: build==1.2.2.post1; extra == "pip-tools"
Requires-Dist: click==8.1.8; extra == "pip-tools"
Requires-Dist: importlib-metadata==8.7.0; extra == "pip-tools"
Requires-Dist: packaging==26.3; extra == "pip-tools"
Requires-Dist: pip-tools==7.6.2; extra == "pip-tools"
Requires-Dist: pyproject-hooks==1.2.0; extra == "pip-tools"
Requires-Dist: wheel==0.45.1; extra == "pip-tools"
Requires-Dist: zipp==3.21.0; extra == "pip-tools"
Requires-Dist: pip==24.3.1; extra == "pip-tools"
Provides-Extra: dev
Requires-Dist: appdirs==1.4.4; extra == "dev"
Requires-Dist: attrs==24.3.0; extra == "dev"
Requires-Dist: black==26.10.1; extra == "dev"
Requires-Dist: blackdoc==0.4.6; extra == "dev"
Requires-Dist: build==1.2.2.post1; extra == "dev"
Requires-Dist: cffi==1.17.1; extra == "dev"
Requires-Dist: click==8.1.8; extra == "dev"
Requires-Dist: coverage==7.5.0; extra == "dev"
Requires-Dist: drain-swamp-snippet==1.0.2; extra == "dev"
Requires-Dist: exceptiongroup==1.2.1; extra == "dev"
Requires-Dist: fastjsonschema==2.19.1; extra == "dev"
Requires-Dist: flake8==7.0.0; extra == "dev"
Requires-Dist: flake8-pyi==24.4.1; extra == "dev"
Requires-Dist: flake8-pyproject==1.2.3; extra == "dev"
Requires-Dist: importlib-metadata==8.7.0; extra == "dev"
Requires-Dist: iniconfig==2.0.0; extra == "dev"
Requires-Dist: isort==5.13.2; extra == "dev"
Requires-Dist: logging-strict==1.7.2.post1; extra == "dev"
Requires-Dist: markdown-it-py==3.0.0; extra == "dev"
Requires-Dist: mccabe==0.7.0; extra == "dev"
Requires-Dist: mdurl==0.1.2; extra == "dev"
Requires-Dist: more-itertools==10.2.0; extra == "dev"
Requires-Dist: mypy==1.15.0; extra == "dev"
Requires-Dist: mypy-extensions==1.0.0; extra == "dev"
Requires-Dist: packaging==26.3; extra == "dev"
Requires-Dist: pathspec==1.1.1; extra == "dev"
Requires-Dist: pip-requirements-parser==32.0.1; extra == "dev"
Requires-Dist: pip-tools==7.6.2; extra == "dev"
Requires-Dist: platformdirs==4.9.6; extra == "dev"
Requires-Dist: pluggy==1.6.0; extra == "dev"
Requires-Dist: pycodestyle==2.11.1; extra == "dev"
Requires-Dist: pycparser==2.22; extra == "dev"
Requires-Dist: pyflakes==3.2.0; extra == "dev"
Requires-Dist: pygments==2.19.1; extra == "dev"
Requires-Dist: pyparsing==3.2.1; extra == "dev"
Requires-Dist: pyproject-hooks==1.2.0; extra == "dev"
Requires-Dist: pytest==8.3.4; extra == "dev"
Requires-Dist: pytest-datadir==1.5.0; extra == "dev"
Requires-Dist: pytest-logging-strict==0.2.4; extra == "dev"
Requires-Dist: pytest-regressions==2.5.0; extra == "dev"
Requires-Dist: python-dateutil==2.9.0.post0; extra == "dev"
Requires-Dist: pyyaml==6.0.2; extra == "dev"
Requires-Dist: rich==13.7.1; extra == "dev"
Requires-Dist: setuptools-scm==10.3.4; extra == "dev"
Requires-Dist: six==1.17.0; extra == "dev"
Requires-Dist: strictyaml==1.7.3; extra == "dev"
Requires-Dist: types-setuptools==78.1.0.20250329; extra == "dev"
Requires-Dist: validate-pyproject==0.24.1; extra == "dev"
Requires-Dist: wheel==0.45.1; extra == "dev"
Requires-Dist: wreck==0.3.7; extra == "dev"
Requires-Dist: zipp==3.21.0; extra == "dev"
Provides-Extra: manage
Requires-Dist: build==1.2.2.post1; extra == "manage"
Requires-Dist: cachetools==5.5.0; extra == "manage"
Requires-Dist: cffi==1.17.1; extra == "manage"
Requires-Dist: cfgv==3.4.0; extra == "manage"
Requires-Dist: chardet==5.2.0; extra == "manage"
Requires-Dist: click==8.1.8; extra == "manage"
Requires-Dist: colorama==0.4.6; extra == "manage"
Requires-Dist: distlib==0.4.4; extra == "manage"
Requires-Dist: drain-swamp-snippet==1.0.2; extra == "manage"
Requires-Dist: filelock==4.2.9; extra == "manage"
Requires-Dist: identify==2.5.36; extra == "manage"
Requires-Dist: importlib-metadata==8.7.0; extra == "manage"
Requires-Dist: nodeenv==1.8.0; extra == "manage"
Requires-Dist: packaging==26.3; extra == "manage"
Requires-Dist: pip-requirements-parser==32.0.1; extra == "manage"
Requires-Dist: pip-tools==7.6.2; extra == "manage"
Requires-Dist: pkginfo==1.10.0; extra == "manage"
Requires-Dist: platformdirs==4.9.6; extra == "manage"
Requires-Dist: pluggy==1.6.0; extra == "manage"
Requires-Dist: pre-commit==3.7.0; extra == "manage"
Requires-Dist: pycparser==2.22; extra == "manage"
Requires-Dist: pyparsing==3.2.1; extra == "manage"
Requires-Dist: pyproject-api==1.8.0; extra == "manage"
Requires-Dist: pyproject-hooks==1.2.0; extra == "manage"
Requires-Dist: pyyaml==6.0.2; extra == "manage"
Requires-Dist: secretstorage==3.3.3; extra == "manage"
Requires-Dist: setuptools-scm==10.3.4; extra == "manage"
Requires-Dist: tox==4.15.1; extra == "manage"
Requires-Dist: tox-gh-actions==3.2.0; extra == "manage"
Requires-Dist: urllib3==2.2.3; extra == "manage"
Requires-Dist: virtualenv==21.14.13; extra == "manage"
Requires-Dist: webencodings==0.5.1; extra == "manage"
Requires-Dist: wheel==0.45.1; extra == "manage"
Requires-Dist: wreck==0.3.7; extra == "manage"
Requires-Dist: zipp==3.21.0; extra == "manage"
Requires-Dist: pip==24.3.1; extra == "manage"
Provides-Extra: docs
Requires-Dist: alabaster==1.0.0; extra == "docs"
Requires-Dist: anyio==4.7.0; extra == "docs"
Requires-Dist: attrs==24.2.0; extra == "docs"
Requires-Dist: babel==2.16.0; extra == "docs"
Requires-Dist: build==1.2.2.post1; extra == "docs"
Requires-Dist: certifi==2026.10.23; extra == "docs"
Requires-Dist: charset-normalizer==3.4.0; extra == "docs"
Requires-Dist: click==8.1.8; extra == "docs"
Requires-Dist: click-log==0.4.0; extra == "docs"
Requires-Dist: colorama==0.4.6; extra == "docs"
Requires-Dist: docutils==0.21.2; extra == "docs"
Requires-Dist: dom-toml==2.0.0; extra == "docs"
Requires-Dist: domdf-python-tools==3.9.0; extra == "docs"
Requires-Dist: drain-swamp-snippet==1.0.3; extra == "docs"
Requires-Dist: exceptiongroup==1.2.2; extra == "docs"
Requires-Dist: h11==0.14.0; extra == "docs"
Requires-Dist: idna==3.10; extra == "docs"
Requires-Dist: imagesize==1.4.1; extra == "docs"
Requires-Dist: importlib-metadata==8.7.0; extra == "docs"
Requires-Dist: interrogate==1.7.0; extra == "docs"
Requires-Dist: jinja2==3.1.4; extra == "docs"
Requires-Dist: jsonschema==4.23.0; extra == "docs"
Requires-Dist: jsonschema-specifications==2024.10.1; extra == "docs"
Requires-Dist: markdown-it-py==3.0.0; extra == "docs"
Requires-Dist: markupsafe==3.0.2; extra == "docs"
Requires-Dist: mdit-py-plugins==0.4.2; extra == "docs"
Requires-Dist: mdurl==0.1.2; extra == "docs"
Requires-Dist: myst-parser==4.0.0; extra == "docs"
Requires-Dist: natsort==8.4.0; extra == "docs"
Requires-Dist: packaging==26.3; extra == "docs"
Requires-Dist: pip-requirements-parser==32.0.1; extra == "docs"
Requires-Dist: pip-tools==7.6.2; extra == "docs"
Requires-Dist: pluggy==1.5.0; extra == "docs"
Requires-Dist: py==1.11.0; extra == "docs"
Requires-Dist: pygments==2.18.0; extra == "docs"
Requires-Dist: pyparsing==3.2.0; extra == "docs"
Requires-Dist: pyproject-hooks==1.2.0; extra == "docs"
Requires-Dist: python-dateutil==2.9.0.post0; extra == "docs"
Requires-Dist: pyyaml==6.0.2; extra == "docs"
Requires-Dist: referencing==0.35.1; extra == "docs"
Requires-Dist: requests==2.32.3; extra == "docs"
Requires-Dist: rpds-py==0.22.3; extra == "docs"
Requires-Dist: scriv==1.5.1; extra == "docs"
Requires-Dist: setuptools-scm==8.1.0; extra == "docs"
Requires-Dist: six==1.17.0; extra == "docs"
Requires-Dist: sniffio==1.3.1; extra == "docs"
Requires-Dist: snowballstemmer==2.2.0; extra == "docs"
Requires-Dist: sphinx==8.1.3; extra == "docs"
Requires-Dist: sphinx-autobuild==2024.10.3; extra == "docs"
Requires-Dist: sphinx-copybutton==0.5.2; extra == "docs"
Requires-Dist: sphinx-design==0.6.1; extra == "docs"
Requires-Dist: sphinx-external-toc-strict==2.0.4.post0; extra == "docs"
Requires-Dist: sphinx-favicon==1.0.1; extra == "docs"
Requires-Dist: sphinx-paramlinks==0.6.0; extra == "docs"
Requires-Dist: sphinx-pyproject==0.3.0; extra == "docs"
Requires-Dist: sphinx-tabs==3.4.7; extra == "docs"
Requires-Dist: sphinxcontrib-applehelp==2.0.0; extra == "docs"
Requires-Dist: sphinxcontrib-devhelp==2.0.0; extra == "docs"
Requires-Dist: sphinxcontrib-htmlhelp==2.1.0; extra == "docs"
Requires-Dist: sphinxcontrib-jsmath==1.0.1; extra == "docs"
Requires-Dist: sphinxcontrib-qthelp==2.0.0; extra == "docs"
Requires-Dist: sphinxcontrib-serializinghtml==2.0.0; extra == "docs"
Requires-Dist: sphobjinv==2.3.1.1; extra == "docs"
Requires-Dist: starlette==0.41.3; extra == "docs"
Requires-Dist: strictyaml==1.7.3; extra == "docs"
Requires-Dist: tabulate==0.9.0; extra == "docs"
Requires-Dist: urllib3==2.2.3; extra == "docs"
Requires-Dist: uvicorn==0.32.1; extra == "docs"
Requires-Dist: watchfiles==1.0.3; extra == "docs"
Requires-Dist: websockets==14.1; extra == "docs"
Requires-Dist: wheel==0.45.1; extra == "docs"
Requires-Dist: wreck==0.3.7; extra == "docs"
Requires-Dist: zipp==3.21.0; extra == "docs"
Requires-Dist: pip==24.1.2; extra == "docs"
Requires-Dist: setuptools==75.6.0; extra == "docs"
Dynamic: license-file

drain-swamp
==============

Python build backend with build plugins and dependency lock switch

|  |kit| |codecov| |license|
|  |last-commit| |quality-status| |docs|
|  |platforms| |test-status| |versions|
|  |implementations| |black|
|  |downloads| |stars|
|  |mastodon-msftcangoblowm|

|feature banner|

.. PYVERSIONS

\* Python 3.11 through 3.15, pypy-3.11

**new in 2.1.x**

fork dependency fixing into separate package; add wreck support;
add pytest-logging-strict support; vcs_versioning support;

**new in 2.0.x**

approach for requirements organize by venvs rather than folders;
new implementation for pipenv-unlock commands;

What swamp?
------------

Code in Makefile or python scripts should be reduced or removed
entirely, in favor of packaged, unittested, and well documented code.

These files are the favorite target for those placing obfuscated code
triggering malware.

Lets call this hiding place, *the swamp*

Boilerplate
""""""""""""

Authors and maintainers deal with many packages. Boilerplate code is
copy+paste into multiple packages.

- an eye sore
- completely untested code
- small variations leak in
- code quality and feature improvements are less likely to happen

``drain-swamp`` started out to reduce this

Generated files
---------------

For Python packages, which contain generated files, UX is improved
by generating those files during the build process.

These batteries are included:

- setuptools-scm version file

- dependency lock switch

  ``.lock``, ``.unlock``, and ``.lnk`` files

Micro services use message queues for inter-process communications.
The messages use ``protobuf`` message protocol which produces a
generated file. That **must** be part of the build process.

Would be a good fit for a build plugin

version file
""""""""""""

The build plugin for interacting with version file, it's
about having flexibility on which version str to use.

Different circumstances calls for different version str

- CI tagged release workflow needs ``tag`` version from the version file

- CI on push workflows need the ``current`` version

- :code:`python -m build` provide the new version str

This flexibility allows to test building a package
before :code:`git push` or a tagged release.

Get scm (source control management) version

.. code-block:: shell

   scm-version get

0.5.2.dev0+g2988c13.d20240724

Get from version file

.. code-block:: shell

   drain-swamp tag

0.5.2

Write a semantic version str to version file. :code:`drain-swamp pretag`
to check/fix semantic version str

.. code-block:: shell

   scm-version write "0.5.2post0.dev1"

Features
--------

Updating docs
""""""""""""""

Before a commit, update the date and version str in several locations

updates

- Sphinx ``docs/conf.py``
- CHANGES.rst
- NOTICE.txt

This Sphinx conf.py contains a snippet. The entire contents of the snippet
is replaced. This technique is now a separate package,
drain-swamp-snippet_

.. _drain-swamp-snippet: https://pypi.org/project/drain-swamp-snippet

Dependency lock switch
""""""""""""""""""""""

Authors disappear or die. Unfunded projects quickly become
abandonware. Packages with locked dependencies do not age well.

Lets check the license. Hmmm Apache2.0 abandonware, that's a great
reason to turn the dependency lock off.

**pipenv-unlock** is a light switch to turn on/off dependency locking.

On your repo, set a CI variable and that is the switch.

When the repo is inactive, turn off the switch and make a release
without dependency locking.

**How it works**

A snippet in ``pyproject.toml`` containing both
dependencies and optional-dependencies. There is additional
meta data as well.

Refresh both ``.unlock`` and ``.lock`` files. During build time,
``.lnk`` shortcut is created.

Create dependency files with the ``.in`` extension.
These include the dependencies and lines with ``-r`` and
``-c`` to include other dependency files.

Then

Create both lock and unlock dependency files. Fix both.

.. code-block:: shell

   req fix

Deprecated. Create .unlock files

.. code-block:: shell

   req unlock

build config settings
""""""""""""""""""""""

The Python packages build process occurs within a subprocess.
The hottest trending topic is how to pass config settings to
this subprocess?

Right before :code:`python -m build`, depending on context,
use whichever method is most appropriate.

**custom build backend**

This would only work for a custom build backend. Will see
it's use only in drain-swamp howto.txt

.. code:: shell

   python -m build -C--kind="0.5.1a4.dev6"

Unless authoring a custom build backend, can safely
ignore.

**cli**

Use bash-workaround_

**tox**

Similar to *cli*. During ``pre_command``, the TOML file and
environment variable DS_CONFIG_SETTINGS are created.

tox test -- drain-swamp-tox-test_

tox -- drain-swamp-tox_

**github workflows**

drain-swamp-action_ creates the TOML file and environment
variable, DS_CONFIG_SETTINGS.

Immediately after this gh action, there is fair bit of:

upload and download artifacts, between step communication,
and maybe between jobs communication.

- matrix size == 1 drain-swamp-release-yml_

There is one job. Communication is only between steps. e.g. ubuntu-latest-3.10

- matrix size > 1 drain-swamp-quality-yml_

There are several jobs. A parent job occurs once. Constraining artifact upload
to only occur once.

See also ``gh workflows`` folder -- drain-swamp-gh-workflows_

.. _bash-workaround: https://github.com/msftcangoblowm/drain-swamp-action/tree/v1#technique----bash-implementation
.. _drain-swamp-action: https://github.com/msftcangoblowm/drain-swamp-action/tree/v1#github-workflow
.. _drain-swamp-release-yml: https://github.com/msftcangoblowm/drain-swamp/blob/master/.github/workflows/release.yml
.. _drain-swamp-quality-yml: https://github.com/msftcangoblowm/drain-swamp/blob/master/.github/workflows/quality.yml
.. _drain-swamp-gh-workflows: https://github.com/msftcangoblowm/drain-swamp/tree/master/.github/workflows
.. _drain-swamp-tox-test: https://github.com/msftcangoblowm/drain-swamp/blob/master/tox-test.ini
.. _drain-swamp-tox: https://github.com/msftcangoblowm/drain-swamp/blob/master/tox.ini

.. |last-commit| image:: https://img.shields.io/github/last-commit/msftcangoblowm/drain-swamp/master
    :target: https://github.com/msftcangoblowm/drain-swamp/pulse
    :alt: last commit to gauge activity
.. |test-status| image:: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/testsuite.yml/badge.svg?branch=master&event=push
    :target: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/testsuite.yml
    :alt: Test suite status
.. |quality-status| image:: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/quality.yml/badge.svg?branch=master&event=push
    :target: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/quality.yml
    :alt: Quality check status
.. |docs| image:: https://readthedocs.org/projects/drain-swamp/badge/?version=latest&style=flat
    :target: https://drain-swamp.readthedocs.io/
    :alt: Documentation
.. |kit| image:: https://img.shields.io/pypi/v/drain-swamp
    :target: https://pypi.org/project/drain-swamp/
    :alt: PyPI status
.. |versions| image:: https://img.shields.io/badge/CI%20tested-3.11%20%7C%203.12%20%7C%203.13%20%7C%203.14%20%7C%203.15%20%7C%20pypy3.11-blue?logo=python&logoColor=FBE072
    :target: https://pypi.org/project/drain-swamp/
    :alt: Python versions supported

.. https://img.shields.io/pypi/pyversions/drain-swamp.svg?logo=python&logoColor=FBE072

.. |license| image:: https://img.shields.io/github/license/msftcangoblowm/drain-swamp
    :target: https://pypi.org/project/drain-swamp/blob/master/LICENSE
    :alt: License
.. |stars| image:: https://img.shields.io/github/stars/msftcangoblowm/drain-swamp.svg?logo=github
    :target: https://github.com/msftcangoblowm/drain-swamp/stargazers
    :alt: GitHub stars
.. |mastodon-msftcangoblowm| image:: https://img.shields.io/mastodon/follow/112019041247183249
    :target: https://mastodon.social/@msftcangoblowme
    :alt: msftcangoblowme on Mastodon
.. |codecov| image:: https://codecov.io/gh/msftcangoblowm/drain-swamp/branch/master/graph/badge.svg?token=13dL2Owydg
    :target: https://codecov.io/gh/msftcangoblowm/drain-swamp
    :alt: drain-swamp coverage percentage
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/ambv/black
.. |downloads| image:: https://img.shields.io/pypi/dm/drain-swamp
.. |implementations| image:: https://img.shields.io/pypi/implementation/drain-swamp
.. |platforms| image:: https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey

.. https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey

.. |feature banner| image:: /docs/_static/drain-swamp-banner-640-320.svg
   :alt: drain-swamp features build plugins and dependency lock switch
