Skip to main content

Preconfigured code formatting and linting.

Project description

plain.code

Preconfigured code formatting and linting.

Overview

Plain.code provides comprehensive code quality tools with sensible defaults:

  • Ruff - Python linting and formatting
  • ty - Python type checking
  • Biome - JavaScript, JSON, and CSS formatting

Ruff and ty are installed as Python dependencies. Biome is managed automatically as a standalone binary (npm is not required).

Commands

plain fix

The most used command is plain fix, which automatically fixes linting issues and formats your code:

plain fix

You can also apply unsafe fixes or add noqa comments to suppress errors:

# Apply Ruff's unsafe fixes
plain fix --unsafe-fixes

# Add noqa comments instead of fixing
plain fix --add-noqa

plain code check

To check your code without making changes (including type checking):

plain code check

You can skip specific tools if needed:

# Skip type checking during rapid development
plain code check --skip-ty

# Only run type checks
plain code check --skip-ruff --skip-biome

# Skip Biome checks
plain code check --skip-biome

# Skip annotation coverage checks
plain code check --skip-annotations

If plain.dev is installed, plain code check will be run automatically as a part of plain pre-commit to help catch issues before they are committed.

plain code annotations

Check the type annotation coverage of your codebase:

plain code annotations

This outputs a summary like 85.2% typed (23/27 functions).

To see which functions are missing annotations:

plain code annotations --details

You can also output the results as JSON for use in CI or other tools:

plain code annotations --json

Configuration

Default configuration is provided by ruff_defaults.toml and biome_defaults.json.

You can customize the behavior in your pyproject.toml:

[tool.plain.code]
exclude = ["path/to/exclude"]

[tool.plain.code.ty]
enabled = true  # Set to false to disable ty

[tool.plain.code.biome]
enabled = true  # Set to false to disable Biome
version = "1.5.3"  # Pin to a specific version

[tool.plain.code.annotations]
enabled = true  # Set to false to disable annotation checks
exclude = ["migrations"]  # Exclude specific patterns

For more advanced configuration options, see get_code_config.

Generally you won't need to change the configuration. The defaults are designed to "just work" for most projects. If you find yourself needing extensive customization, consider using the underlying tools (Ruff, ty, Biome) directly instead.

FAQs

How do I install or update Biome manually?

Biome is installed automatically when you run plain fix or plain code check. If you need to manage it manually:

# Install Biome (or reinstall if corrupted)
plain code install

# Force reinstall even if up to date
plain code install --force

# Update to the latest version
plain code update

Why are test files excluded from annotation coverage?

Test files (test_*.py, *_test.py, and files in tests/ or test/ directories) are excluded by default because they typically contain many small helper functions where type annotations add noise without providing significant value. You can customize this behavior via the exclude option in the annotations configuration.

How do I check a specific directory?

All commands accept a path argument:

plain fix path/to/directory
plain code check path/to/directory
plain code annotations path/to/directory

Installation

Install the plain.code package from PyPI:

uv add plain.code

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

plain_code-0.19.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plain_code-0.19.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file plain_code-0.19.0.tar.gz.

File metadata

  • Download URL: plain_code-0.19.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for plain_code-0.19.0.tar.gz
Algorithm Hash digest
SHA256 62c27bc6fcd0f66ff51a437691b9f014b9fa9a2c8939c492fbb939e260646992
MD5 ae9150e772befc4ca25cdc372d9bf9f3
BLAKE2b-256 e296e9aba5b3b50977bd2861e07365cd0f42359ed225446d4e2c42126ca22e23

See more details on using hashes here.

File details

Details for the file plain_code-0.19.0-py3-none-any.whl.

File metadata

  • Download URL: plain_code-0.19.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for plain_code-0.19.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0998a20e71b4f780cb32165e7537caf82aee53b0e1165b24971108c61234632
MD5 69046ba8341643ddaa3837773f552799
BLAKE2b-256 76cb688251d755e952a18d1efb41aef0086c3d18dd29d1815268f291a9e0bdc1

See more details on using hashes here.

Supported by

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