{"id":15633623,"url":"https://github.com/asottile/setup-cfg-fmt","last_synced_at":"2025-05-16T04:03:38.076Z","repository":{"id":38706342,"uuid":"171373144","full_name":"asottile/setup-cfg-fmt","owner":"asottile","description":"apply a consistent format to `setup.cfg` files","archived":false,"fork":false,"pushed_at":"2025-03-31T21:01:03.000Z","size":327,"stargazers_count":153,"open_issues_count":4,"forks_count":17,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-10T11:18:40.096Z","etag":null,"topics":["packaging","setuptools"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asottile.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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},"funding":{"github":"asottile"}},"created_at":"2019-02-18T23:46:36.000Z","updated_at":"2025-03-31T21:01:05.000Z","dependencies_parsed_at":"2023-09-26T16:01:18.417Z","dependency_job_id":"a0494c79-f77e-4e37-8866-b4ffd847be9f","html_url":"https://github.com/asottile/setup-cfg-fmt","commit_stats":{"total_commits":183,"total_committers":13,"mean_commits":"14.076923076923077","dds":0.5136612021857924,"last_synced_commit":"ccfe420a1f8a857343bed59c3b82897001926c5b"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fsetup-cfg-fmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fsetup-cfg-fmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fsetup-cfg-fmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fsetup-cfg-fmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asottile","download_url":"https://codeload.github.com/asottile/setup-cfg-fmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464891,"owners_count":22075570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["packaging","setuptools"],"created_at":"2024-10-03T10:49:42.743Z","updated_at":"2025-05-16T04:03:38.048Z","avatar_url":"https://github.com/asottile.png","language":"Python","funding_links":["https://github.com/sponsors/asottile"],"categories":[],"sub_categories":[],"readme":"[![build status](https://github.com/asottile/setup-cfg-fmt/actions/workflows/main.yml/badge.svg)](https://github.com/asottile/setup-cfg-fmt/actions/workflows/main.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/asottile/setup-cfg-fmt/main.svg)](https://results.pre-commit.ci/latest/github/asottile/setup-cfg-fmt/main)\n\nsetup-cfg-fmt\n=============\n\napply a consistent format to `setup.cfg` files\n\n## installation\n\n```bash\npip install setup-cfg-fmt\n```\n\n## as a pre-commit hook\n\nSee [pre-commit](https://github.com/pre-commit/pre-commit) for instructions\n\nSample `.pre-commit-config.yaml`:\n\n```yaml\n-   repo: https://github.com/asottile/setup-cfg-fmt\n    rev: v2.8.0\n    hooks:\n    -   id: setup-cfg-fmt\n```\n\n## cli\n\nConsult the help for the latest usage:\n\n```console\n$ setup-cfg-fmt --help\n```\n\n## what does it do?\n\n### sets a consistent ordering for attributes\n\nFor example, `name` and `version` (the most important metadata) will always\nappear at the top.\n\n```diff\n [metadata]\n-version = 1.14.4\n-name = pre_commit\n+name = pre_commit\n+version = 1.14.4\n```\n\n### normalizes dashes to underscores in project name\n\n- `pip` will normalize names to dashes `foo_bar` =\u003e `foo-bar`\n- `python setup.py sdist` produces a filename with the name verbatim\n- `pip wheel .` produces a filename with an underscore-normalized name\n\n```console\n$ # with dashed name\n$ python setup.py sdist \u0026\u0026 pip wheel -w dist .\n...\n$ ls dist/ | cat\nsetup_cfg_fmt-0.0.0-py2.py3-none-any.whl\nsetup-cfg-fmt-0.0.0.tar.gz\n$ # with underscore name\n$ python setup.py sdist \u0026\u0026 pip wheel -w dist .\n...\n$ ls dist/ | cat\nsetup_cfg_fmt-0.0.0-py2.py3-none-any.whl\nsetup_cfg_fmt-0.0.0.tar.gz\n```\n\nThis makes it easier to upload packages to pypi since they end up with the\nsame filename prefix.\n\n```diff\n [metadata]\n-name = pre-commit\n+name = pre_commit\n```\n\n### normalizes dashes to underscores in keys\n\nsetuptools allows dashed names but does not document them.\n\n```diff\n [metadata]\n name = pre-commit\n-long-description = file: README.md\n+long_description = file: README.md\n```\n\n### adds `long_description` if `README` is present\n\nThis will show up on the pypi project page\n\n```diff\n [metadata]\n name = pre_commit\n version = 1.14.5\n+long_description = file: README.md\n+long_description_content_type = text/markdown\n```\n\n### adds `license_file` / `license` if `LICENSE` exists\n\n```diff\n [metadata]\n name = pre_commit\n version = 1.14.5\n+license = MIT\n+license_file = LICENSE\n```\n\n### set `python_requires`\n\nA few sources are searched for guessing `python_requires`:\n\n- the existing `python_requires` setting itself\n- `envlist` in `tox.ini` if present\n- python version `classifiers` that are already set\n- the `--min-py-version` argument\n\n### adds python version classifiers\n\nclassifiers are generated based on:\n\n- the `python_requires` setting\n- the `--max-py-version` argument\n- `--include-version-classifiers` is specified\n\n```diff\n name = pkg\n version = 1.0\n+classifiers =\n+    Programming Language :: Python :: 3\n+    Programming Language :: Python :: 3.7\n+    Programming Language :: Python :: 3.8\n+    Programming Language :: Python :: 3.9\n+    Programming Language :: Python :: 3.10\n+    Programming Language :: Python :: 3.11\n+    ...\n```\n\nwithout `--include-version-classifiers` only the major version will be included:\n\n```diff\n name = pkg\n version = 1.0\n+classifiers =\n+    Programming Language :: Python :: 3\n```\n\n### sorts classifiers\n\n```diff\n [metadata]\n name = pre_commit\n version = 1.14.5\n classifiers =\n-    Programming Language :: Python :: 3\n+    Programming Language :: Python :: 3\n+    Programming Language :: Python :: 3.6\n```\n\n### removes empty options in any section\n\n```diff\n [options]\n-dependency_links =\n python_requires = \u003e= 3.6.1\n```\n\n## related projects\n\n- [setup-py-upgrade]: automatically migrate `setup.py` -\u003e `setup.cfg`\n\n[setup-py-upgrade]: https://github.com/asottile/setup-py-upgrade\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasottile%2Fsetup-cfg-fmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasottile%2Fsetup-cfg-fmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasottile%2Fsetup-cfg-fmt/lists"}