NI's internal and external Python linter rules and plugins
Project description
NI Python Style Guide
Welcome to NI's internal and external Python conventions and enforcement tooling.
Written Conventions
Our written conventions can be found at https://ni.github.io/python-styleguide/.
Their source is in docs/Coding-Conventions.md.
NOTE: Using the GitHub Pages link is preferable to a GitHub /blob link.
Enforcement tooling
As a tool, ni-python-styleguide is installed like any other script:
pip install ni-python-styleguide
Linting
To lint, just run the lint subcommand (from within the project root, or lower):
ni-python-styleguide lint
# or
ni-python-styleguide lint ./dir/
# or
ni-python-styleguide lint module.py
The rules enforced are all rules documented in the written convention, which are marked as enforced.
Configuration
ni-python-styleguide aims to keep the configuration to a bare minimum (none wherever possible).
However there are some situations you might need to configure the tool.
Fix
ni-python-styleguide has a subcommand fix which will run black and isort.
Additionally, you can run fix with the --aggressive option and it will add acknowledgements (# noqa) for the remaining linting errors
it cannot fix, in addition to running black and isort.
When using setup.py
If you're using setup.py, you'll need to set your app's import names for import sorting.
# pyproject.toml
[tool.ni-python-styleguide]
application-import-names = "<app_name>"
Formatting
ni-python-styleguide in the future will have a format command which we intend to fix as many lint issues as possible.
Until then you'll want to set the following to get black formatting as the styleguide expects.
# pyproject.toml
[tool.black]
line-length = 100
Editor Integration
(This section to come!)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ni_python_styleguide-0.4.9.tar.gz.
File metadata
- Download URL: ni_python_styleguide-0.4.9.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64a65da646fc8c2f0e68970e0a3190534add9380ee78782fa809fee5321f9e45
|
|
| MD5 |
a37cba737f1893b081eb2919b41fddd5
|
|
| BLAKE2b-256 |
980360a7430f56c066d3b7d541ddbc5999ad20bb7e57a9682d60c97a49d5b57f
|
Provenance
The following attestation bundles were made for ni_python_styleguide-0.4.9.tar.gz:
Publisher:
Publish-Package.yml on ni/python-styleguide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ni_python_styleguide-0.4.9.tar.gz -
Subject digest:
64a65da646fc8c2f0e68970e0a3190534add9380ee78782fa809fee5321f9e45 - Sigstore transparency entry: 932904134
- Sigstore integration time:
-
Permalink:
ni/python-styleguide@a430a005d818b2be943dabc5bb757d17ed1ed5fc -
Branch / Tag:
refs/tags/v0.4.9 - Owner: https://github.com/ni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
Publish-Package.yml@a430a005d818b2be943dabc5bb757d17ed1ed5fc -
Trigger Event:
release
-
Statement type:
File details
Details for the file ni_python_styleguide-0.4.9-py3-none-any.whl.
File metadata
- Download URL: ni_python_styleguide-0.4.9-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a33735fbb52231bda00ec970d7c7aebe2b15aed2ccbd07da5c52b8e04730918
|
|
| MD5 |
1d5ed8e7f594eb455c3f0dfb5c00dd58
|
|
| BLAKE2b-256 |
29e44ff395bdf4ef3a3ac042536c03f1a52acac82ce4611cc4fd4470449d510d
|
Provenance
The following attestation bundles were made for ni_python_styleguide-0.4.9-py3-none-any.whl:
Publisher:
Publish-Package.yml on ni/python-styleguide
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ni_python_styleguide-0.4.9-py3-none-any.whl -
Subject digest:
3a33735fbb52231bda00ec970d7c7aebe2b15aed2ccbd07da5c52b8e04730918 - Sigstore transparency entry: 932904244
- Sigstore integration time:
-
Permalink:
ni/python-styleguide@a430a005d818b2be943dabc5bb757d17ed1ed5fc -
Branch / Tag:
refs/tags/v0.4.9 - Owner: https://github.com/ni
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
Publish-Package.yml@a430a005d818b2be943dabc5bb757d17ed1ed5fc -
Trigger Event:
release
-
Statement type: