Skip to main content

SemiColon

Philosophy

Most SQL formatters produce code that is syntactically correct but visually noisy.
The SemiColon Style treats SQL as prose: it has a rhythm, a visible structure, and a clear centre of gravity — the River.

The goal is not merely consistency; it is readability at a glance.

Installation

From PyPI

pip install semicolonfmt

From source

git clone https://github.com/mustafaa7med/semicolon.git
cd semicolon
pip install -e .

Verify

semicolon --version

Usage

Format a single file

semicolon query.sql

The file is formatted in-place.

Format all .sql files in the current directory

semicolon .

CI/CD check mode

semicolon query.sql --check   # exits 1 if formatting is needed
semicolon . --check           # check all .sql files

No files are written in --check mode — it is safe to use in pipelines.


Before & After

Before (messy, unformatted)

with
active_users as (
select u.id, u.name as user_name, u.email as user_email, u.created_at from users u where u.active = true and u.deleted_at is null
),
recent_orders as (
select o.user_id, count(*) as order_count, sum(o.total) as total_spent from orders o where o.created_at between '2024-01-01' and '2024-12-31' group by o.user_id
)
select au.user_name, au.user_email, ro.order_count, ro.total_spent from active_users au left join recent_orders ro on au.id = ro.user_id where ro.total_spent > 500 order by ro.total_spent desc limit 100;

After

WITH active_users AS(
    SELECT  u.id,
            u.name  AS user_name,
            u.email AS user_email,
            u.created_at
      FROM  users u
     WHERE  u.active = TRUE
       AND  u.deleted_at IS NULL
),

recent_orders AS(
    SELECT  o.user_id,
            COUNT(*)     AS order_count,
            SUM(o.total) AS total_spent
      FROM  orders o
     WHERE  o.created_at BETWEEN '2024-01-01'
                             AND '2024-12-31'
  GROUP BY  o.user_id
)

    SELECT  au.user_name,
            au.user_email,
            ro.order_count,
            ro.total_spent
      FROM  active_users au
 LEFT JOIN  recent_orders ro
        ON  au.id = ro.user_id
     WHERE  ro.total_spent > 500
  ORDER BY  ro.total_spent DESC
     LIMIT  100;

Pre-commit Integration

# .pre-commit-config.yaml
repos:
  - repo: https://github.com/mustafaa7med/semicolon
    rev: v0.1.4
    hooks:
      - id: semicolon
        args: [--check]

License

Apache — see LICENSE.

Metadata

Release files for semicolonfmt 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for semicolonfmt 0.1.4
File Size Uploaded Provenance Actions
semicolonfmt-0.1.4.tar.gz 22.7 kB Without provenance Details for semicolonfmt-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for semicolonfmt 0.1.4
File Interpreter ABI Platform Actions
semicolonfmt-0.1.4-py3-none-any.whl Python 3 none any Details for semicolonfmt-0.1.4-py3-none-any.whl

Total release size: 39.5 kB

Release files / semicolonfmt-0.1.4.tar.gz

Download URL semicolonfmt-0.1.4.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c13856081c4477193246633982af1c38ce41b52f821d89071d447cbb76333ec2
BLAKE2b-256 checksum
How to use checksums
afaf49fc6895b9ae28bdd622fcb5ce2b4cd1647023a8ac3b811f448910f4c25c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / semicolonfmt-0.1.4-py3-none-any.whl

Download URL semicolonfmt-0.1.4-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58c933b4577209074b817fad88ece85738fd405a7c631355ce46e643966236ef
BLAKE2b-256 checksum
How to use checksums
4af3d0d3f49bc25b9973c5868086869c37d6ad942dd2e97d3c26cac98f07f3b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Security for semicolonfmt 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page