Skip to main content

NI's internal and external Python linter rules and plugins

Project description

NI Python Style Guide

logo


PyPI version Publish Package Code style: 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.

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ni-python-styleguide-0.1.9.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

ni_python_styleguide-0.1.9-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file ni-python-styleguide-0.1.9.tar.gz.

File metadata

  • Download URL: ni-python-styleguide-0.1.9.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.8 Linux/5.11.0-1020-azure

File hashes

Hashes for ni-python-styleguide-0.1.9.tar.gz
Algorithm Hash digest
SHA256 5c7f196fcfcd7a89dff35cf1653bde9c6427d99bbf76906d97c1ccf46b730cea
MD5 087913d688283ebdbddd464993ae3270
BLAKE2b-256 e6ab9408469eefa27ced796ed91d720cb4fac8ae58d6b46360cf12a025a3ac10

See more details on using hashes here.

File details

Details for the file ni_python_styleguide-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for ni_python_styleguide-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 661da836dbb4bbe9f0f2e62fc176056eec111acf0df4f5b0427ea6bf3a6a8cdf
MD5 8efa63e2f08c8ff92a04e332a5c74edf
BLAKE2b-256 c02bde056b12b9a5f0473cbcc716ed26c376aaeb17ae8ec763d1f4e7d4020f87

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page