{"id":27620922,"url":"https://github.com/msftcangoblowm/drain-swamp","last_synced_at":"2026-02-07T07:31:26.202Z","repository":{"id":251352533,"uuid":"837099616","full_name":"msftcangoblowm/drain-swamp","owner":"msftcangoblowm","description":"Python build-backend with build plugin support","archived":false,"fork":false,"pushed_at":"2025-01-07T11:34:43.000Z","size":1646,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T07:44:04.574Z","etag":null,"topics":["build-backend","build-plugins","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/drain-swamp/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msftcangoblowm.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":"docs/contributing.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-02T08:00:33.000Z","updated_at":"2025-01-07T11:26:30.000Z","dependencies_parsed_at":"2024-08-02T12:26:02.101Z","dependency_job_id":"dc2f46a2-92a3-48d9-8a44-d324dfc2a466","html_url":"https://github.com/msftcangoblowm/drain-swamp","commit_stats":null,"previous_names":["msftcangoblowm/drain-swamp"],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/msftcangoblowm/drain-swamp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msftcangoblowm%2Fdrain-swamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msftcangoblowm%2Fdrain-swamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msftcangoblowm%2Fdrain-swamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msftcangoblowm%2Fdrain-swamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msftcangoblowm","download_url":"https://codeload.github.com/msftcangoblowm/drain-swamp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msftcangoblowm%2Fdrain-swamp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29189276,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T05:07:31.176Z","status":"ssl_error","status_checked_at":"2026-02-07T05:06:15.227Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-backend","build-plugins","python3"],"created_at":"2025-04-23T07:33:19.071Z","updated_at":"2026-02-07T07:31:26.188Z","avatar_url":"https://github.com/msftcangoblowm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"drain-swamp\n==============\n\nPython build backend with build plugins and dependency lock switch\n\n|  |kit| |codecov| |license|\n|  |last-commit| |test-status| |quality-status| |docs|\n|  |versions| |implementations|\n|  |platforms| |black|\n|  |downloads| |stars|\n|  |mastodon-msftcangoblowm|\n\n|feature banner|\n\n.. PYVERSIONS\n\n\\* Python 3.9 through 3.13, PyPy\n\n**new in 2.1.x**\n\nfork dependency fixing into separate package; add wreck support;\nadd pytest-logging-strict support;\n\n**new in 2.0.x**\n\napproach for requirements organize by venvs rather than folders;\nnew implementation for pipenv-unlock commands;\n\nWhat swamp?\n------------\n\nCode in Makefile or python scripts should be reduced or removed\nentirely, in favor of packaged, unittested, and well documented code.\n\nThese files are the favorite target for those placing obfuscated code\ntriggering malware.\n\nLets call this hiding place, *the swamp*\n\nBoilerplate\n\"\"\"\"\"\"\"\"\"\"\"\"\n\nAuthors and maintainers deal with many packages. Boilerplate code is\ncopy+paste into multiple packages.\n\n- an eye sore\n- completely untested code\n- small variations leak in\n- code quality and feature improvements are less likely to happen\n\n``drain-swamp`` started out to reduce this\n\nGenerated files\n---------------\n\nFor Python packages, which contain generated files, UX is improved\nby generating those files during the build process.\n\nThese batteries are included:\n\n- setuptools-scm version file\n\n- dependency lock switch\n\n  ``.lock``, ``.unlock``, and ``.lnk`` files\n\nMicro services use message queues for inter-process communications.\nThe messages use ``protobuf`` message protocol which produces a\ngenerated file. That **must** be part of the build process.\n\nWould be a good fit for a build plugin\n\nversion file\n\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe build plugin for interacting with version file, it's\nabout having flexibility on which version str to use.\n\nDifferent circumstances calls for different version str\n\n- CI tagged release workflow needs ``tag`` version from the version file\n\n- CI on push workflows need the ``current`` version\n\n- :code:`python -m build` provide the new version str\n\nThis flexibility allows to test building a package\nbefore :code:`git push` or a tagged release.\n\nGet scm (source control management) version\n\n.. code-block:: shell\n\n   scm-version get\n\n0.5.2.dev0+g2988c13.d20240724\n\nGet from version file\n\n.. code-block:: shell\n\n   drain-swamp tag\n\n0.5.2\n\nWrite a semantic version str to version file. :code:`drain-swamp pretag`\nto check/fix semantic version str\n\n.. code-block:: shell\n\n   scm-version write \"0.5.2post0.dev1\"\n\nFeatures\n--------\n\nUpdating docs\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nBefore a commit, update the date and version str in several locations\n\nupdates\n\n- Sphinx ``docs/conf.py``\n- CHANGES.rst\n- NOTICE.txt\n\nThis Sphinx conf.py contains a snippet. The entire contents of the snippet\nis replaced. This technique is now a separate package,\ndrain-swamp-snippet_\n\n.. _drain-swamp-snippet: https://pypi.org/project/drain-swamp-snippet\n\nDependency lock switch\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nAuthors disappear or die. Unfunded projects quickly become\nabandonware. Packages with locked dependencies do not age well.\n\nLets check the license. Hmmm Apache2.0 abandonware, that's a great\nreason to turn the dependency lock off.\n\n**pipenv-unlock** is a light switch to turn on/off dependency locking.\n\nOn your repo, set a CI variable and that is the switch.\n\nWhen the repo is inactive, turn off the switch and make a release\nwithout dependency locking.\n\n**How it works**\n\nA snippet in ``pyproject.toml`` containing both\ndependencies and optional-dependencies. There is additional\nmeta data as well.\n\nRefresh both ``.unlock`` and ``.lock`` files. During build time,\n``.lnk`` shortcut is created.\n\nCreate dependency files with the ``.in`` extension.\nThese include the dependencies and lines with ``-r`` and\n``-c`` to include other dependency files.\n\nThen\n\nCreate both lock and unlock dependency files. Fix both.\n\n.. code-block:: shell\n\n   req fix\n\nDeprecated. Create .unlock files\n\n.. code-block:: shell\n\n   req unlock\n\nbuild config settings\n\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\n\nThe Python packages build process occurs within a subprocess.\nThe hottest trending topic is how to pass config settings to\nthis subprocess?\n\nRight before :code:`python -m build`, depending on context,\nuse whichever method is most appropriate.\n\n**custom build backend**\n\nThis would only work for a custom build backend. Will see\nit's use only in drain-swamp howto.txt\n\n.. code:: shell\n\n   python -m build -C--kind=\"0.5.1a4.dev6\"\n\nUnless authoring a custom build backend, can safely\nignore.\n\n**cli**\n\nUse bash-workaround_\n\n**tox**\n\nSimiliar to *cli*. During ``pre_command``, the TOML file and\nenvironment variable DS_CONFIG_SETTINGS are created.\n\ntox test -- drain-swamp-tox-test_\n\ntox -- drain-swamp-tox_\n\n**github workflows**\n\ndrain-swamp-action_ creates the TOML file and environment\nvariable, DS_CONFIG_SETTINGS.\n\nImmediately after this gh action, there is fair bit of:\n\nupload and download artifacts, between step communication,\nand maybe between jobs communication.\n\n- matrix size == 1 drain-swamp-release-yml_\n\nThere is one job. Communication is only between steps. e.g. ubuntu-latest-3.10\n\n- matrix size \u003e 1 drain-swamp-quality-yml_\n\nThere are several jobs. A parent job occurs once. Constraining artifact upload\nto only occur once.\n\nSee also ``gh workflows`` folder -- drain-swamp-gh-workflows_\n\n.. _bash-workaround: https://github.com/msftcangoblowm/drain-swamp-action/tree/v1#technique----bash-implementation\n.. _drain-swamp-action: https://github.com/msftcangoblowm/drain-swamp-action/tree/v1#github-workflow\n.. _drain-swamp-release-yml: https://github.com/msftcangoblowm/drain-swamp/blob/master/.github/workflows/release.yml\n.. _drain-swamp-quality-yml: https://github.com/msftcangoblowm/drain-swamp/blob/master/.github/workflows/quality.yml\n.. _drain-swamp-gh-workflows: https://github.com/msftcangoblowm/drain-swamp/tree/master/.github/workflows\n.. _drain-swamp-tox-test: https://github.com/msftcangoblowm/drain-swamp/blob/master/tox-test.ini\n.. _drain-swamp-tox: https://github.com/msftcangoblowm/drain-swamp/blob/master/tox.ini\n\n.. |last-commit| image:: https://img.shields.io/github/last-commit/msftcangoblowm/drain-swamp/master\n    :target: https://github.com/msftcangoblowm/drain-swamp/pulse\n    :alt: last commit to gauge activity\n.. |test-status| image:: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/testsuite.yml/badge.svg?branch=master\u0026event=push\n    :target: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/testsuite.yml\n    :alt: Test suite status\n.. |quality-status| image:: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/quality.yml/badge.svg?branch=master\u0026event=push\n    :target: https://github.com/msftcangoblowm/drain-swamp/actions/workflows/quality.yml\n    :alt: Quality check status\n.. |docs| image:: https://readthedocs.org/projects/drain-swamp/badge/?version=latest\u0026style=flat\n    :target: https://drain-swamp.readthedocs.io/\n    :alt: Documentation\n.. |kit| image:: https://img.shields.io/pypi/v/drain-swamp\n    :target: https://pypi.org/project/drain-swamp/\n    :alt: PyPI status\n.. |versions| image:: https://img.shields.io/pypi/pyversions/drain-swamp.svg?logo=python\u0026logoColor=FBE072\n    :target: https://pypi.org/project/drain-swamp/\n    :alt: Python versions supported\n.. |license| image:: https://img.shields.io/github/license/msftcangoblowm/drain-swamp\n    :target: https://pypi.org/project/drain-swamp/blob/master/LICENSE\n    :alt: License\n.. |stars| image:: https://img.shields.io/github/stars/msftcangoblowm/drain-swamp.svg?logo=github\n    :target: https://github.com/msftcangoblowm/drain-swamp/stargazers\n    :alt: GitHub stars\n.. |mastodon-msftcangoblowm| image:: https://img.shields.io/mastodon/follow/112019041247183249\n    :target: https://mastodon.social/@msftcangoblowme\n    :alt: msftcangoblowme on Mastodon\n.. |codecov| image:: https://codecov.io/gh/msftcangoblowm/drain-swamp/branch/master/graph/badge.svg?token=13dL2Owydg\n    :target: https://codecov.io/gh/msftcangoblowm/drain-swamp\n    :alt: drain-swamp coverage percentage\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/ambv/black\n.. |downloads| image:: https://img.shields.io/pypi/dm/drain-swamp\n.. |implementations| image:: https://img.shields.io/pypi/implementation/drain-swamp\n.. |platforms| image:: https://img.shields.io/badge/platform-linux-lightgrey\n\n.. https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey\n\n.. |feature banner| image:: /docs/_static/drain-swamp-banner-640-320.svg\n   :alt: drain-swamp features build plugins and dependency lock switch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsftcangoblowm%2Fdrain-swamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsftcangoblowm%2Fdrain-swamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsftcangoblowm%2Fdrain-swamp/lists"}