Metadata-Version: 2.4
Name: pyproject
Version: 1!0.2.0
Classifier: Environment :: Console
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development
Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
License-File: LICENSE
Summary: A linter and language server for `pyproject.toml` files
Home-Page: https://github.com/terror/pyproject
Author-email: Liam Scalzulli <liam@scalzulli.com>
License-Expression: CC0-1.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Project-URL: Homepage, https://github.com/terror/pyproject

## pyproject

[![release](https://img.shields.io/github/release/terror/pyproject.svg?label=release&style=flat&labelColor=1d1d1d&color=424242&logo=github&logoColor=white)](https://github.com/terror/pyproject/releases/latest)
[![build](https://img.shields.io/github/actions/workflow/status/terror/pyproject/ci.yaml?branch=master&style=flat&labelColor=1d1d1d&color=424242&logo=GitHub%20Actions&logoColor=white&label=build)](https://github.com/terror/pyproject/actions/workflows/ci.yaml)
[![codecov](https://img.shields.io/codecov/c/gh/terror/pyproject?style=flat&labelColor=1d1d1d&color=424242&logo=Codecov&logoColor=white)](https://codecov.io/gh/terror/pyproject)
[![downloads](https://img.shields.io/github/downloads/terror/pyproject/total.svg?style=flat&labelColor=1d1d1d&color=424242&logo=github&logoColor=white)](https://github.com/terror/pyproject/releases)

`pyproject` is a linter and language server for
[`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/)
files.

<img width="1337" alt="demo" src="https://raw.githubusercontent.com/terror/pyproject/master/screenshot.png" />

`pyproject` brings real-time feedback to your `pyproject.toml` files, including:

- Syntax validation and schema compliance for project and tool configuration.

- Over
  [30 built-in rules](https://github.com/terror/pyproject/tree/master/src/rule)
  for project metadata and dependencies, including PEP 508 validation, version
  bounds, deprecations, and available updates.

- Diagnostics directly in your editor, so configuration errors are caught before
  the tools that consume your project file run.

If you need help with `pyproject` please feel free to open an issue. Feature
requests and bug reports are always welcome!

## Installation

`pyproject` should run on any system, including Linux, MacOS, and the BSDs.

The easiest way to install it is by using
[cargo](https://doc.rust-lang.org/cargo/index.html), the Rust package manager:

```bash
cargo install pyproject
```

Otherwise, see below for the complete package list:

#### Cross-platform

<table>
  <thead>
    <tr>
      <th>Package Manager</th>
      <th>Package</th>
      <th>Command</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a href=https://www.rust-lang.org>Cargo</a></td>
      <td><a href=https://crates.io/crates/pyproject>pyproject</a></td>
      <td><code>cargo install pyproject</code></td>
    </tr>
    <tr>
      <td><a href=https://brew.sh>Homebrew</a></td>
      <td><a href=https://github.com/terror/homebrew-tap>terror/tap/pyproject</a></td>
      <td><code>brew install terror/tap/pyproject</code></td>
    </tr>
    <tr>
      <td><a href=https://github.com/pypa/pip>Pip</a></td>
      <td><a href=https://pypi.org/project/pyproject/>pyproject</a></td>
      <td><code>pip install pyproject</code></td>
    </tr>
  </tbody>
</table>

**n.b.** Since we publish a release to [PyPI](https://pypi.org/), tools like
[uv](https://docs.astral.sh/uv/) work right out of the box, i.e.
`uvx pyproject check` should just work with sensible default rules.

### Pre-built binaries

Pre-built binaries for Linux, MacOS, and Windows can be found on
[the releases page](https://github.com/terror/pyproject/releases).

## Usage

`pyproject` can be used from the command-line or as a language server.

### CLI

Below is the output of `pyproject --help`:

```present cargo run -- --help
pyproject 0.2.0

Usage: pyproject <COMMAND>

Commands:
  check   Check a pyproject.toml file for errors and warnings [aliases: lint]
  format  Format a pyproject.toml file [aliases: fmt]
  server  Start the language server [aliases: lsp]

Options:
  -h, --help     Print help
  -V, --version  Print version
```

**n.b.** Running `pyproject check` or `pyproject format` on their own will
attempt to perform actions on the nearest `pyproject.toml` file, walking
backwards from the current location.

### Language Server

Start the language server with `pyproject server` or `pyproject lsp`. The
server communicates over standard input and output and provides diagnostics,
completions, hover descriptions, and formatting for `pyproject.toml` files.

## Configuration

You can configure rules in your `pyproject.toml` under the `[tool.pyproject]`
section.

Each rule can be set to a severity level (`error`, `warning`, `hint`,
`information` (or `info`), or `off`) using either a simple string or a table
with a `level` field:

```toml
[tool.pyproject.rules]
project-unknown-keys = "warning"
project-dependency-updates = { level = "hint" }
project-requires-python-upper-bound = "off"
```

Rule identifiers are shown in diagnostic output (e.g.,
`error[project-unknown-keys]`). Rules that aren't explicitly configured use
their default severity level.

## Prior Art

This project was inspired by a language server I saw for
[`Cargo.toml`](https://doc.rust-lang.org/cargo/reference/manifest.html) files,
namely [crates-lsp](https://github.com/MathiasPius/crates-lsp). I couldn't find
similar a tool for
[`pyproject.toml`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/)
files, so I thought I'd write one.

