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

Uploaded Source

Built Distribution

ni_python_styleguide-0.1.7-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ni-python-styleguide-0.1.7.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.7 Linux/5.8.0-1042-azure

File hashes

Hashes for ni-python-styleguide-0.1.7.tar.gz
Algorithm Hash digest
SHA256 7ce8322b891c8de889f20aafd8636ecf08e6c73658a022ef0e15cc7d70d57b22
MD5 ba4690380c6ccd86b3aac8c16129076a
BLAKE2b-256 455e988b318df88f9ceae2ba1c7bb1f862c425b3c2e11550cadb4e73d345c819

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ni_python_styleguide-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ceac7957a3e8734f0860b1942f7e4959dcd2c4105943fbf0c77814bfe4b522be
MD5 633778e1a7d8b703c4f2338571b0ace1
BLAKE2b-256 f0048002d085cf2c5e1150839f92c4bfe8f1b3e847ed86c4787d94c2dad6e1f6

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