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.3.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

ni_python_styleguide-0.3.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file ni_python_styleguide-0.3.0.tar.gz.

File metadata

  • Download URL: ni_python_styleguide-0.3.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.9.16 Linux/5.15.0-1024-azure

File hashes

Hashes for ni_python_styleguide-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4e5ef8fdaf98903081227c922dda925b0f3fabd4b2a376825580e5f967904891
MD5 7344e588d824702f666b4035dc4424f5
BLAKE2b-256 0e38d9e942a4013b2cb99a761c9e5cf54a2cfa8c9a20605e2919f5b4caf47407

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ni_python_styleguide-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a517e9a61f4a0a0edea547cdec8febea20d015cd0045becd1d30b72e7b4777ca
MD5 a4c3c7ffcca5a4f3b166ab421309ddfd
BLAKE2b-256 0ef0614e1df90347ee0dcc01a290f414a6c589a90a9bc0258292890daa383333

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