Catch AI code hallucinations before they ship. The linter for AI-generated imports.
Project description
mirago
Catch the fake package names AI coding tools make up — before you try to install them.
Status: 0.1.0 — beta. It works and it's useful; it's also early, so expect rough edges and tell us what's missing.
What it does (in plain words)
When you ask an AI tool (Copilot, Cursor, Claude, and others) to write Python code, it sometimes
imports a package that doesn't actually exist — it made the name up. If you try to install it,
you waste time chasing a package that was never real.
mirago reads your code, looks at every package it imports, and checks each one against PyPI (the official Python package index). It tells you about two kinds of problem:
- Doesn't exist — the AI invented the name. (An error.)
- Exists but looks risky — the name is real, but it was created very recently and is barely downloaded and isn't already used in your project. (A warning — could be a copycat package.)
mirago check your_file.py
If something's fake, you'll see:
🚨 1 hallucination in your_file.py
Line 1: import fastjson_validator
→ Package 'fastjson_validator' does not exist on PyPI
If everything looks fine, mirago stays quiet (just a short summary).
Install
mirago is a command-line tool. The easiest way is pipx, which installs CLI tools in their own isolated environment:
pipx install mirago
Or with plain pip:
pip install mirago
Requirements: Python 3.10 or newer. mirago works the same on Windows, macOS, and Linux (it's pure Python).
Platform notes
- macOS / Linux: install pipx with
pip install --user pipx(orbrew install pipxon macOS), thenpipx install mirago. - Windows: in PowerShell,
py -m pip install --user pipxthenpy -m pipx install mirago. Make sure Python is on your PATH (the official python.org installer has a checkbox for this).
Usage
mirago check your_file.py # check one file
mirago check . # check this folder and everything under it
mirago check src/ # check a folder
When you point it at a folder, mirago checks every .py file inside it, skipping noise like
.venv, .git, caches, and build folders.
Handy options:
| Option | What it does |
|---|---|
--fix |
Offer to fix a misspelled package name (requets → requests). |
--fail-on warning |
Make the run fail (exit 1) on warnings too, not just errors. |
--json |
Print results as JSON, for use by other tools or CI. |
--no-cache |
Skip the saved results and re-check against PyPI. |
The exit code is 1 when problems are found and 0 when clean, so mirago drops straight into
automated checks (CI).
What it catches — and what it doesn't (yet)
Catches today:
- Package names that don't exist on PyPI (names an AI made up).
- Real-but-risky packages (brand-new + barely downloaded + not already in your project).
- Common typos of popular packages, with a suggested fix.
Doesn't catch yet (planned):
- Fake function or method names inside real packages (e.g. a method that doesn't exist).
- Editor / IDE integrations — there are none yet; mirago is a command-line tool for now.
- Catching mistakes live, as an AI assistant writes them.
A safety note: if PyPI can't be reached, mirago assumes your packages are fine rather than raising a false alarm. It would rather miss occasionally than cry wolf.
Contributing
Issues and pull requests are welcome. To work on mirago locally:
git clone https://github.com/ddsyasas/mirago
cd mirago
# Install with the developer tools
pip install -e ".[dev]"
# Run the tests (tests needing live PyPI are skipped by default)
pytest
# Try it on the bundled examples
mirago check tests/fixtures/good.py
mirago check tests/fixtures/bad.py
See docs/DEVLOG.md for a plain-language history of what changed and why, and CHANGELOG.md for the release notes.
License
MIT. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mirago-0.1.0.tar.gz.
File metadata
- Download URL: mirago-0.1.0.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ad3c827bac9a6ad748b0031361f20f0111c1d994e9dba45754e5502754a8f70
|
|
| MD5 |
a7200fe08b84e282009e7647e2c67300
|
|
| BLAKE2b-256 |
78eb1024ff5bad090c38a5b75a9fd5bfcae63da4d236159cbd66475482acfcf1
|
File details
Details for the file mirago-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mirago-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c29cf21ae3e20b921174ba62d770ac3849dc7859139b9d26dc65a594140b290
|
|
| MD5 |
e117ef9f26f2d9e34751e5d1b717f5c0
|
|
| BLAKE2b-256 |
41f0a388f91c12150289cfdeb619fde9d27545b96a4b454faa69acc32fb3258e
|