CLI tool to clean, format and reorganize Python source files.
Project description
Moppy 🧹
A CLI tool that cleans and restructures Python source files.
What it does
| Step | Action |
|---|---|
| 1 | Remove # inline comments (--remove-comments) |
| 2 | Remove docstrings (--remove-docstrings) |
| 3 | Reorder code structure (--reorganize) |
| 4 | Auto-format with black, isort, autoflake |
Code order after --reorganize
imports → import / from … import
variables → module-level constants and assignments
schemas/models → dataclasses, Pydantic BaseModel, TypedDict …
classes → regular class definitions
functions → def / async def
other → if __name__ == "__main__", bare expressions …
Install
pip install .
Or in editable / development mode:
pip install -e .
Usage
# Clean a single file (format only)
moppy myfile.py
# Remove comments
moppy myfile.py --remove-comments
# Remove comments + docstrings + reorder structure
moppy myfile.py --remove-comments --remove-docstrings --reorganize
# Clean an entire directory recursively
moppy ./src --reorganize
# Only current directory, no sub-folders
moppy ./src --no-recursive
# Preview changes without writing any files
moppy ./src --dry-run --reorganize
Options
| Flag | Description |
|---|---|
--remove-comments |
Strip all # comments |
--remove-docstrings |
Strip all docstrings |
--reorganize |
Reorder top-level statements |
--dry-run |
Show results without modifying files |
--recursive / --no-recursive |
Recurse into sub-directories (default: on) |
Dependencies
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
moppy_tool-1.0.0.tar.gz
(18.8 kB
view details)
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 moppy_tool-1.0.0.tar.gz.
File metadata
- Download URL: moppy_tool-1.0.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc80d4d4c329c98fe3d85a4a6f5136223172bdb0e12b5b85d4fe096592c4cd6f
|
|
| MD5 |
db449dc0bea3883c2061e69e13ecbabf
|
|
| BLAKE2b-256 |
665695f9f7e96033c8b5e739b7194f7d378c15348abbca3dab26d8947a8fd36f
|
File details
Details for the file moppy_tool-1.0.0-py3-none-any.whl.
File metadata
- Download URL: moppy_tool-1.0.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c2a7cd78dd8333dfb8e21e674f641939665c098be27be7426ad739209bdf51b
|
|
| MD5 |
66137c409e1c18a0e2133b29a899f5a8
|
|
| BLAKE2b-256 |
a6d645885e8658f3eda16360f42810995755ad2f7410d4aa1e1a043a69469127
|