apply a consistent format to `setup.cfg` files
Project description
setup-cfg-fmt
apply a consistent format to setup.cfg
files
installation
pip install setup-cfg-fmt
as a pre-commit hook
See pre-commit for instructions
Sample .pre-commit-config.yaml
:
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v0.0.2
hooks:
- id: setup-cfg-fmt
cli
Consult the help for the latest usage:
$ setup-cfg-fmt --help
usage: setup-cfg-fmt [-h] [filenames [filenames ...]]
positional arguments:
filenames
optional arguments:
-h, --help show this help message and exit
what does it do?
sets a consistent ordering for attributes
For example, name
and version
(the most important metadata) will always
appear at the top.
[metadata]
-version = 1.14.4
-name = pre_commit
+name = pre_commit
+version = 1.14.4
normalizes dashes to underscores in project name
pip
will normalize names to dashesfoo_bar
=>foo-bar
python setup.py sdist
produces a filename with the name verbatimpip wheel .
produces a filename with an underscore-normalized name
$ # with dashed name
$ python setup.py sdist && pip wheel -w dist .
...
$ ls dist/ | cat
setup_cfg_fmt-0.0.0-py2.py3-none-any.whl
setup-cfg-fmt-0.0.0.tar.gz
$ # with underscore name
$ python setup.py sdist && pip wheel -w dist .
...
$ ls dist/ | cat
setup_cfg_fmt-0.0.0-py2.py3-none-any.whl
setup_cfg_fmt-0.0.0.tar.gz
This makes it easier to upload packages to pypi since they end up with the same filename prefix.
[metadata]
-name = pre-commit
+name = pre_commit
adds long_description
if README.md
is present
This will show up on the pypi project page
[metadata]
name = pre_commit
version = 1.14.5
+long_description = file: README.md
+long_description_content_type = text/markdown
adds license_file
/ license
/ license classifier if LICENSE
exists
[metadata]
name = pre_commit
version = 1.14.5
+license = MIT
+license_file = LICENSE
+classifiers =
+ License :: OSI Approved :: MIT License
sorts classifiers
[metadata]
name = pre_commit
version = 1.14.5
classifiers =
- Programming Language :: Python :: 3
- License :: OSI Approved :: MIT License
+ License :: OSI Approved :: MIT License
+ Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
related projects
- setup-py-upgrade: automatically migrate
setup.py
->setup.cfg
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
setup_cfg_fmt-0.0.2.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file setup_cfg_fmt-0.0.2.tar.gz
.
File metadata
- Download URL: setup_cfg_fmt-0.0.2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9d81c0d182eee5faaad761d823beb56d9010fe0e51d4b5900b8ee454e910a8e |
|
MD5 | 1091804b5b5917e1b2bf848c823be696 |
|
BLAKE2b-256 | 04b2da0d708f7c342b8d826507eaf614dc89ca4b0f49477f2cba0660719425e0 |
Provenance
File details
Details for the file setup_cfg_fmt-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: setup_cfg_fmt-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b74fce0f3b7f12555e094218d73b4fd7ef6f42bc3d049fc100407a00305f5b9 |
|
MD5 | 1e9a70d1a820393ca47312fdd5731f04 |
|
BLAKE2b-256 | 5cb2390b1c9a234ca2b153e4e5642209fdfe75e8a16f7e870603ef0ad9124a38 |