flake8-digit-separator
A set of rules on top of the capabilities provided by PEP515.
correct_int = 10_000
correct_float = 10_000.1_234
correct_binary = 0b_1101_1001
correct_octal = 0o_134_155
correct_hex = 0x_CAFE_F00D
Installation
pip install flake8-digit-separator
Usage
flake8 ./ --select FDS
Rules
PEP515 allows separators, but does not impose any restrictions on their position in a number (except that a number should not start/end with a separator and there should not be two separators in a row). To introduce more rigor and beauty into the code, we have written a few simple rules that we suggest following.
| Rule | Number | Description | Correct | Wrong |
|---|---|---|---|---|
| FDS100 | integer | Group by 3s from right | 10_000 | 1_0000 |
| FDS200 | float | Group by 3s from right | 10_000.1_234 | 100_00.123_4 |
| FDS300 | binary | Group by 4s from right after prefix 0b_ |
0b_1101_1001 | 0b11_011_001 |
| FDS400 | octal | Group by 3s from right after prefix 0o_ |
0o_12_134_155 | 0o_12_13_41_55 |
| FDS500 | hex | Group by 4s from right after prefix 0x_ |
0x_CAFE_F00D | 0xCAFEF0_0D |
Configuration Options
--fds-exclude
Exclude specific integer numbers from digit separator validation. This is useful for well-known numbers like ports or other constants where the standard formatting might not be appropriate. For example, when we write port = 8080 or storage = 1024, there is no point in distorting it through 8_080 or through 1_024.
Use the option:
flake8 ./ --select FDS --fds-exclude=8080,1024,6379
Or configure in setup.cfg:
[flake8]
fds-exclude = 8080,1024,6379
License
FDS is released under the MIT License. See the bundled LICENSE file for details.
The logo was created using Font Meme.
Metadata
Release files for flake8-digit-separator 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flake8_digit_separator-1.0.8.tar.gz | 11.4 kB | Without provenance | Details for flake8_digit_separator-1.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flake8_digit_separator-1.0.8-py3-none-any.whl | Python 3 | none | any | Details for flake8_digit_separator-1.0.8-py3-none-any.whl |
Total release size: 34.4 kB
Release files / flake8_digit_separator-1.0.8.tar.gz
| Download URL | flake8_digit_separator-1.0.8.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b574340d37b6818ca0e60981d79072d969760d20c367c0f2fe31ddb05dbab45
|
|
BLAKE2b-256 checksum How to use checksums |
6407faf27e13dc5e0d7bd0b9f0be636dbbd9c64abde61b1edf8c8b7ebf8b6814
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.0 CPython/3.14.3 Darwin/25.6.0
|
Release files / flake8_digit_separator-1.0.8-py3-none-any.whl
| Download URL | flake8_digit_separator-1.0.8-py3-none-any.whl |
|---|---|
| Size | 23.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e96829fd86d1122fde83772213590f8d39e0c76aaedc1440277e43d505b980e
|
|
BLAKE2b-256 checksum How to use checksums |
49c78bec9dd80699cfe238f96e18460108c0ac2aeb85876a4086f87522203040
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.0 CPython/3.14.3 Darwin/25.6.0
|
Security for flake8-digit-separator 1.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.