ni-python-styleguide


Nameni-python-styleguide JSON
Version 0.4.5 PyPI version JSON
download
home_pagehttps://github.com/ni/python-styleguide
SummaryNI's internal and external Python linter rules and plugins
upload_time2024-05-02 12:37:53
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/67/b3/d44ae72c8d51c84aa7475068cbc1bef7044744bc6f479aef45a8ed6b499b/ni_python_styleguide-0.4.5.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.5",
    "project_urls": {
        "Homepage": "https://github.com/ni/python-styleguide",
        "Repository": "https://github.com/ni/python-styleguide"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d95be8324fdf68456f772baf8c7f570c624bca98f1a65eed18231d97eef9f014",
                "md5": "3b13637fc67b5e33e86c7da9efad827d",
                "sha256": "a46298342523f1e665e027df443ad882556259e430d7fa867f2703aa68028704"
            },
            "downloads": -1,
            "filename": "ni_python_styleguide-0.4.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3b13637fc67b5e33e86c7da9efad827d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 18187,
            "upload_time": "2024-05-02T12:37:51",
            "upload_time_iso_8601": "2024-05-02T12:37:51.441165Z",
            "url": "https://files.pythonhosted.org/packages/d9/5b/e8324fdf68456f772baf8c7f570c624bca98f1a65eed18231d97eef9f014/ni_python_styleguide-0.4.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67b3d44ae72c8d51c84aa7475068cbc1bef7044744bc6f479aef45a8ed6b499b",
                "md5": "1fd1ceb48a7d0a504bba3b14ba9d6ac7",
                "sha256": "0ff8899cea1deed6a2d458765c1d645f85cc563089904c78bbafcba03bea2f91"
            },
            "downloads": -1,
            "filename": "ni_python_styleguide-0.4.5.tar.gz",
            "has_sig": false,
            "md5_digest": "1fd1ceb48a7d0a504bba3b14ba9d6ac7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 14814,
            "upload_time": "2024-05-02T12:37:53",
            "upload_time_iso_8601": "2024-05-02T12:37:53.666154Z",
            "url": "https://files.pythonhosted.org/packages/67/b3/d44ae72c8d51c84aa7475068cbc1bef7044744bc6f479aef45a8ed6b499b/ni_python_styleguide-0.4.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-02 12:37:53",
    "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.33313s