Skip to main content

colref

Test codecov Go Report Card Go Reference License: MIT Gem Version Gem Downloads PyPI version PyPI Downloads

Check whether a database column is still referenced in your codebase before you delete it.

colref finding the real references to a field that a plain text search buries in noise

Why

You want to remove a column from a long-running system. The column looks unused, but you're not sure. A full-text search returns hits inside comments, test fixtures, and migration history — noise that makes it hard to tell whether the column is actually read or written in live code.

colref scans your codebase with an AST parser, skips comments and string literals, and tells you where the column is referenced. If it finds nothing, you have a concrete starting point for the deletion decision. The final call is yours.

Installation

pip / pipx (Python users)

If you are working on a Django or Python project, the easiest way to install colref is via pip or pipx. No Go installation required.

pipx install colref

Or with pip:

pip install colref
OS x86_64 (Intel/AMD) arm64
macOS ✓ ✓ (Apple Silicon)
Linux ✓ ✓
Windows ✓ —

gem (Ruby users)

If you are working on a Rails or Ruby project, install via gem. No Go installation required.

gem install colref

Homebrew (macOS and Linux)

brew install shinagawa-web/tap/colref

If you prefer to tap first:

brew tap shinagawa-web/tap
brew install colref

One-line installer (Linux and macOS)

curl -fsSL https://raw.githubusercontent.com/shinagawa-web/colref/main/install.sh | sh

Manual download

Pre-built binaries are available on the releases page.

For full installation options, see Getting started.

Usage

colref check --orm <orm> --model <Model> --field <field> [path]

path is the project root to scan (default: current directory).

Flag Description
--orm ORM type: django, rails (required)
--model Model name to look up (required)
--field Field name to search for (required)

Example:

$ colref check --orm django --model Page --field seo_title
Scanning 932 files...

References found for Page.seo_title

  wagtail/admin/tests/pages/test_create_page.py:1867   page.seo_title
  wagtail/admin/tests/pages/test_create_page.py:1892   page.seo_title

For ORM-specific behavior and more examples, see Django and Rails.

Limitations

colref uses static AST analysis and cannot detect every reference pattern. References where the field name is constructed at runtime (e.g. getattr(obj, field_name)) are out of scope by design.

If colref reports no references, treat it as "none found by the scanner" — not as a guarantee the column is unused.

For the full per-pattern breakdown, see Detection patterns and Limitations.

Roadmap

See issue #74.

License

MIT

Release files for colref 0.8.0

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

Built distributions (wheels)

Table of built distributions (wheels) for colref 0.8.0
File
colref-0.8.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
colref-0.8.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
colref-0.8.0-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details
colref-0.8.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
colref-0.8.0-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details

Total release size: 21.2 MB

Release files / colref-0.8.0-py3-none-win_amd64.whl

Download URL colref-0.8.0-py3-none-win_amd64.whl
Size 4.3 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
bb73efcdef9c1dd5d80e29add79ff9f62dd61d7a3839adfa12d531bc76140041
BLAKE2b-256 checksum
How to use checksums
d269b543e277503200a860a1d05037509cd3d9fe42dd32a1072b36cb71812cf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.

Transparency log

Release files / colref-0.8.0-py3-none-manylinux_2_34_x86_64.whl

Download URL colref-0.8.0-py3-none-manylinux_2_34_x86_64.whl
Size 4.2 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
175150b3195a557bd6e100683c0bdbdbd2ccede647764d3265830f89e80fe096
BLAKE2b-256 checksum
How to use checksums
db378fde50cbe263038dc716d88d4fc495cd1d697217fd2dba4c31f0fa5e48c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.

Transparency log

Release files / colref-0.8.0-py3-none-manylinux_2_34_aarch64.whl

Download URL colref-0.8.0-py3-none-manylinux_2_34_aarch64.whl
Size 3.9 MB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c17431b2da04f14cee7b88419e2687e43493d16d75a7976ed7e262babe431f61
BLAKE2b-256 checksum
How to use checksums
ed7b60e0cd11bf145b87ebd32c2d3fc87261bfda41ff5396e9efd3927a58d334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.

Transparency log

Release files / colref-0.8.0-py3-none-macosx_11_0_arm64.whl

Download URL colref-0.8.0-py3-none-macosx_11_0_arm64.whl
Size 4.2 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0771822fcaa1def1369e3d6b055c1c7e33e5d194f920c9955cc498bb20b66a00
BLAKE2b-256 checksum
How to use checksums
2ac4fc9b5c1942bdd93cd437921ef09594791486d0a4fea22e99411333928dc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.

Transparency log

Release files / colref-0.8.0-py3-none-macosx_10_9_x86_64.whl

Download URL colref-0.8.0-py3-none-macosx_10_9_x86_64.whl
Size 4.5 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
d828c3a467bc4b7d1a55c463c907963f0b28f07d0bc9bb0acc79174eab147084
BLAKE2b-256 checksum
How to use checksums
04f036da3420af860b616739fc449adf615c1931b2dd9d15910ee99a08f1de21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 1, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.0

5 release files

This release

0.8.0 This release

5 release files

0.7.10

5 release files

0.7.9

5 release files

0.7.8

5 release files

0.7.7

5 release files

0.7.6

5 release files

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