# NI Python Style Guide

---
[](https://badge.fury.io/py/ni-python-styleguide)  [](https://github.com/psf/black)
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](https://github.com/ni/python-styleguide/tree/main/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:
```bash
pip install ni-python-styleguide
```
### Linting
To lint, just run the `lint` subcommand (from within the project root, or lower):
```bash
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](https://pypi.org/project/black/) and [isort](https://pycqa.github.io/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.
```toml
# 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.
```toml
# pyproject.toml
[tool.black]
line-length = 100
```
### Editor Integration
(This section to come!)
Raw data
{
"_id": null,
"home_page": "https://github.com/ni/python-styleguide",
"name": "ni-python-styleguide",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.7",
"maintainer_email": null,
"keywords": null,
"author": "NI",
"author_email": "opensource@ni.com",
"download_url": "https://files.pythonhosted.org/packages/0d/8f/fe356a3a535195ee251159d3144f6d5046ac0a7261db8fab4f64a56f7557/ni_python_styleguide-0.4.7.tar.gz",
"platform": null,
"description": "# NI Python Style Guide\n\n\n\n---\n\n[](https://badge.fury.io/py/ni-python-styleguide)  [](https://github.com/psf/black)\n\n\nWelcome to NI's internal and external Python conventions and enforcement tooling.\n\n## Written Conventions\n\nOur written conventions can be found at https://ni.github.io/python-styleguide/.\n\nTheir source is in [docs/Coding-Conventions.md](https://github.com/ni/python-styleguide/tree/main/docs/Coding-Conventions.md).\n\nNOTE: Using the GitHub Pages link is preferable to a GitHub `/blob` link.\n\n## Enforcement tooling\n\nAs a tool, `ni-python-styleguide` is installed like any other script:\n\n```bash\npip install ni-python-styleguide\n```\n\n### Linting\n\nTo lint, just run the `lint` subcommand (from within the project root, or lower):\n\n```bash\nni-python-styleguide lint\n# or\nni-python-styleguide lint ./dir/\n# or\nni-python-styleguide lint module.py\n```\n\nThe rules enforced are all rules documented in the written convention, which are marked as enforced.\n\n### Configuration\n\n`ni-python-styleguide` aims to keep the configuration to a bare minimum (none wherever possible).\nHowever there are some situations you might need to configure the tool.\n\n### Fix\n\n`ni-python-styleguide` has a subcommand `fix` which will run [black](https://pypi.org/project/black/) and [isort](https://pycqa.github.io/isort/).\n\nAdditionally, you can run `fix` with the `--aggressive` option and it will add acknowledgements (# noqa) for the remaining linting errors\nit cannot fix, in addition to running black and isort. \n\n#### When using `setup.py`\n\nIf you're using `setup.py`, you'll need to set your app's import names for import sorting.\n\n```toml\n# pyproject.toml\n[tool.ni-python-styleguide]\napplication-import-names = \"<app_name>\"\n```\n\n### Formatting\n\n`ni-python-styleguide` in the future will have a `format` command which we intend to fix as many lint issues as possible.\n\nUntil then you'll want to set the following to get `black` formatting as the styleguide expects.\n\n```toml\n# pyproject.toml\n[tool.black]\nline-length = 100\n```\n\n### Editor Integration\n\n(This section to come!)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "NI's internal and external Python linter rules and plugins",
"version": "0.4.7",
"project_urls": {
"Homepage": "https://github.com/ni/python-styleguide",
"Repository": "https://github.com/ni/python-styleguide"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "3b8d05b1e27b74c004c8cc82ca6f6918de952930c44456f0e4c257b509e14c5a",
"md5": "43bc4e653ebc47b619f9b4201b493bff",
"sha256": "4b1ae36315a53d1ef0f996cf868cfca997e3a80b431808e46c632467eacd2d09"
},
"downloads": -1,
"filename": "ni_python_styleguide-0.4.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "43bc4e653ebc47b619f9b4201b493bff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.7",
"size": 18358,
"upload_time": "2025-07-10T13:52:24",
"upload_time_iso_8601": "2025-07-10T13:52:24.620964Z",
"url": "https://files.pythonhosted.org/packages/3b/8d/05b1e27b74c004c8cc82ca6f6918de952930c44456f0e4c257b509e14c5a/ni_python_styleguide-0.4.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0d8ffe356a3a535195ee251159d3144f6d5046ac0a7261db8fab4f64a56f7557",
"md5": "a0caf47163f9ff689b4d7538a3f198e1",
"sha256": "b510bb6974bdb907d0d10f14e985e90304d5f02590f5bafab333ebbaa663ef81"
},
"downloads": -1,
"filename": "ni_python_styleguide-0.4.7.tar.gz",
"has_sig": false,
"md5_digest": "a0caf47163f9ff689b4d7538a3f198e1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.7",
"size": 14424,
"upload_time": "2025-07-10T13:52:25",
"upload_time_iso_8601": "2025-07-10T13:52:25.752447Z",
"url": "https://files.pythonhosted.org/packages/0d/8f/fe356a3a535195ee251159d3144f6d5046ac0a7261db8fab4f64a56f7557/ni_python_styleguide-0.4.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-10 13:52:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ni",
"github_project": "python-styleguide",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ni-python-styleguide"
}