Metadata-Version: 2.1
Name: maxdop
Version: 0.1.3
Summary: A T-SQL formatter that runs in CI, understands the whole language, and checks its own work
Author: Page Brooks
License: MIT
Project-URL: Homepage, https://github.com/pagebrooks/maxdop
Project-URL: Repository, https://github.com/pagebrooks/maxdop
Project-URL: Issues, https://github.com/pagebrooks/maxdop/issues
Keywords: sql,t-sql,tsql,sql-server,formatter,pre-commit
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Programming Language :: SQL
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# maxdop

**Max Degree of Prettiness for your T-SQL.** A T-SQL formatter that runs in CI,
understands the whole language, and checks its own work.

```sh
maxdop query.sql       # formatted SQL to stdout
maxdop --write src/    # format every .sql under src/, in place
maxdop --check src/    # fail the build if anything would change
```

This package ships the native `maxdop` executable for your platform. It has no
Python dependencies and is not importable — installing it puts the `maxdop`
command on your PATH, nothing more. There is no interpreter between you and the
binary, so cold start stays around 3.5 ms.

## Why

Most SQL formatters tokenise and guess, and lose the shape of your code when it
matters. maxdop is built on [ScriptDom](https://github.com/microsoft/SqlScriptDOM),
Microsoft's own T-SQL parser — twelve grammars, covering every SQL Server
compatibility level from 2000 to 2025, Fabric DW, and grammar 180, which is newer
than any announced product year and is the default. It reads stored procedures,
`GO` batches and 2000-era syntax the way the server does.

It also verifies itself. Every result is re-parsed and its significant token
stream compared against your input's, with a second check for the comments.
Identical tokens mean an identical parse tree, so this proves equivalence rather
than approximating it. If anything differs you get your original file back,
untouched, and a distinct exit code. Measured over 2,215 real-world files: zero
refusals, zero comments lost.

## Use it with pre-commit

```yaml
repos:
  - repo: local
    hooks:
      - id: maxdop
        name: maxdop
        entry: maxdop --write
        language: python
        additional_dependencies: [maxdop==0.1.3]
        types: [sql]
```

pre-commit builds a virtualenv, pip resolves the wheel for that machine, and the
binary lands on PATH — nothing to install first.

## Configuration

One `.maxdop.json` at your repo root, committed next to the code it formats, so
a repo formats the same way whoever opens it.

```json
{
  "maxWidth": 100,
  "indentSize": 4,
  "keywordCase": "upper",
  "parserVersion": "latest"
}
```

Full documentation, other install methods, and the comparison against the other
ten T-SQL formatters: <https://github.com/pagebrooks/maxdop>

MIT licensed.
