ni-python-styleguide


Nameni-python-styleguide JSON
Version 0.4.6 PyPI version JSON
download
home_pagehttps://github.com/ni/python-styleguide
SummaryNI's internal and external Python linter rules and plugins
upload_time2024-06-12 14:19:52
maintainerNone
docs_urlNone
authorNI
requires_python<4.0,>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # NI Python Style Guide

![logo](https://raw.githubusercontent.com/ni/python-styleguide/main/docs/logo.svg)

---

[![PyPI version](https://badge.fury.io/py/ni-python-styleguide.svg)](https://badge.fury.io/py/ni-python-styleguide) ![Publish Package](https://github.com/ni/python-styleguide/workflows/Publish%20Package/badge.svg) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](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/cc/22/f188c62777692e6a3843161f1ab0fefc8e741c94d05e009846d9758aac33/ni_python_styleguide-0.4.6.tar.gz",
    "platform": null,
    "description": "# NI Python Style Guide\n\n![logo](https://raw.githubusercontent.com/ni/python-styleguide/main/docs/logo.svg)\n\n---\n\n[![PyPI version](https://badge.fury.io/py/ni-python-styleguide.svg)](https://badge.fury.io/py/ni-python-styleguide) ![Publish Package](https://github.com/ni/python-styleguide/workflows/Publish%20Package/badge.svg) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](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",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "NI's internal and external Python linter rules and plugins",
    "version": "0.4.6",
    "project_urls": {
        "Homepage": "https://github.com/ni/python-styleguide",
        "Repository": "https://github.com/ni/python-styleguide"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4016fd852022ba3c713b8c02561a9cbdc158ce4a35fc71d35bd55fc8a1f8ba3e",
                "md5": "5c45e505d919bf182aa044b594b2e2a9",
                "sha256": "0ffa8bd5de38d96779ad0e83e49a3db3620a31742247be10f6471961ab6fa246"
            },
            "downloads": -1,
            "filename": "ni_python_styleguide-0.4.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c45e505d919bf182aa044b594b2e2a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 18350,
            "upload_time": "2024-06-12T14:19:51",
            "upload_time_iso_8601": "2024-06-12T14:19:51.039584Z",
            "url": "https://files.pythonhosted.org/packages/40/16/fd852022ba3c713b8c02561a9cbdc158ce4a35fc71d35bd55fc8a1f8ba3e/ni_python_styleguide-0.4.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cc22f188c62777692e6a3843161f1ab0fefc8e741c94d05e009846d9758aac33",
                "md5": "f755976483f456d353d63ffb365ef245",
                "sha256": "26d7ebd5acce0b29a6209ef9950f369327cbfd7ffd8404ade3e9a7c0f0aa6bcb"
            },
            "downloads": -1,
            "filename": "ni_python_styleguide-0.4.6.tar.gz",
            "has_sig": false,
            "md5_digest": "f755976483f456d353d63ffb365ef245",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 14990,
            "upload_time": "2024-06-12T14:19:52",
            "upload_time_iso_8601": "2024-06-12T14:19:52.793003Z",
            "url": "https://files.pythonhosted.org/packages/cc/22/f188c62777692e6a3843161f1ab0fefc8e741c94d05e009846d9758aac33/ni_python_styleguide-0.4.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-12 14:19:52",
    "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"
}
        
NI
Elapsed time: 0.25784s