clawde
Move inline imports — imports buried inside function bodies — back to the top of the file, where they belong.
Imports inside try/except blocks, inside if TYPE_CHECKING: blocks, or marked with # noqa are left in place.
Install / run
Run without installing:
uvx clawde --help
Or install it:
uv tool install clawde
# or
pipx install clawde
Usage
By default, clawde runs in dry-run mode and prints a table of imports it would move. Pass --write to actually apply the changes.
# Show what would change in the current directory
clawde
# Apply changes
clawde --write
# Target specific paths
clawde src/ scripts/foo.py
Example output
❯ clawde myproject/
Scanning Python files... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100%
Inline Import Analysis
Status File:Line Import Reason
🟢 Skipped manage.py:13 from django.core.management import Inside try/except block
execute_from_command_line
🟢 Skipped apps/team/cache.py:9 from .models import AboutPage # noqa: PLC0415 Marked with # noqa
🟢 Skipped apps/til/apps.py:18 from .signals import post_delete # noqa Marked with # noqa
🟡 Move apps/blog/0024.py:16 from wagtail.images import get_image_model
🟡 Move apps/blog/0024.py:17 from wagtail.models import Page, Site
Total: 5 imports analyzed
To Move: 2
Skipped: 3
Note: This was a dry-run. No files were modified.
Use --write to apply changes.
What it does
For every .py file under the given paths, clawde parses the source with ast and looks for import / from ... import statements inside function bodies. Each finding is reported as:
| Status | Meaning |
|---|---|
| Move | Will be lifted to the top of the file (under any __future__ imports). |
| Skipped | Left in place — inside try, TYPE_CHECKING, or marked # noqa. |
| Error | File could not be parsed. |
Hidden directories (any path segment starting with .) are always skipped — this catches .git, .venv, .tox, .mypy_cache, .ruff_cache, .pytest_cache, and so on.
In addition, the following directory names are skipped by default:
node_modulesvenvbuilddist__pycache__site-packageshtmlcov
Configuration
You can override the named exclude list by adding a [tool.clawde] section to your pyproject.toml:
[tool.clawde]
exclude = ["build", "dist", "node_modules", "vendor", "generated"]
- The list replaces the default — include any defaults you still want.
- Entries are matched against path segments (folder names), not full paths or globs.
- Hidden directories are skipped regardless of this setting.
- Set
exclude = []to scan every non-hidden directory.
clawde looks for a pyproject.toml by walking up from the current working directory.
Metadata
Release files for clawde 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| clawde-0.1.1.tar.gz | 13.4 kB | Without provenance | Details for clawde-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| clawde-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for clawde-0.1.1-py3-none-any.whl |
Total release size: 25.0 kB
Release files / clawde-0.1.1.tar.gz
| Download URL | clawde-0.1.1.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb49b0eb56ec38cbf0b8f0414658e6c34fc87d9ff57258838a239c2b983c30f6
|
|
BLAKE2b-256 checksum How to use checksums |
0aa71f862254be307d5897386bdc5294a56101d5073df1295f8e12aba6fe7aab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / clawde-0.1.1-py3-none-any.whl
| Download URL | clawde-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e61ac84f9db7d77d3d0255a1d80a4663f769f7fae88e999e9d06cd793b9a0dcf
|
|
BLAKE2b-256 checksum How to use checksums |
5a4281a978acd20b509dd66f04adbc248b8b52fcebc20db2aea79b1c7c71f0a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for clawde 0.1.1
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.