Standardize the refactoring process.
Project description
autorefine
Standardize the refactoring process.
The project is aimed to provide a framework for the entire process of refactoring Python projects from the very beginning to the very end:
- analyze the project with linters and type checkers,
- create a refactoring roadmap (like https://github.com/CERT-Polska/malduck/issues/110, but with more details available as a specialized document),
- create a delivery plan (like in the issue above),
- apply automatic fixes and commit them in reviewable chunks with meaningful descriptions,
- leave the rest for manual work,
- create a PR (like https://github.com/CERT-Polska/malduck/issues/111).
Created to accomplish https://github.com/jaraco/skeleton/issues/98 and personal use to raise awareness of best practices across the global Python community.
Planned tooling
The project is planned to be a wrapper around the following well-tested & recognized tools:
- MonkeyType for automatic type annotations generation,
- Fixit for automatic fixes that require static analysis and scope analysis and planning of manual refactoring steps,
- Ruff for automatic fixes and planning of manual refactoring steps,
- pyupgrade for automatic fixes,
- Static type checking:
- diff-cover for coverage reports on fixes,
- smokeshow for hosting detailed refactoring roadmaps and delivery plans,
- pandas for collecting tasks and creating markdown tables,
- GitHub CLI for creating tickets.
Refactoring workflow
-
First off, check for type annotations and add them if missing using MonkeyType.
-
Analyze the project and create a refactoring roadmap.
-
Check for type errors using static type checkers.
-
Check for code style issues using linters.
-
-
Apply automatic fixes and commit them in reviewable chunks with meaningful descriptions.
-
Leave the rest for manual work.
-
Create a PR.
Get inspired
Installation
If you want to…
…use this tool in your project 💻
You might simply install it with pip:
pip install autorefine
If you use Poetry, then run:
poetry add autorefine
…contribute to autorefine 🚀
[!Note] If you use Windows, it is highly recommended to complete the installation in the way presented below through WSL2.
-
Fork the autorefine repository on GitHub.
-
Install Poetry.
Poetry is an amazing tool for managing dependencies & virtual environments, building packages and publishing them. You might use pipx to install it globally (recommended):pipx install poetry
If you encounter any problems, refer to the official documentation for the most up-to-date installation instructions.
If you want to use pipx to install dev dependencies as well, install the poetry apps plugin:
pipx inject poetry poetry-apps
Be sure to have Python 3.8 installed—if you use pyenv, simply run:
pyenv install 3.8
-
Clone your fork locally and install dependencies.
git clone https://github.com/your-username/autorefine path/to/autorefine cd path/to/autorefine poetry env use $(cat .python-version) poetry install
Next up, simply activate the virtual environment and install pre-commit hooks:
poetry shell pre-commit install --hook-type pre-commit --hook-type pre-push
For more information on how to contribute, check out CONTRIBUTING.md.
Always happy to accept contributions! ❤️
Legal info
© Copyright by Bartosz Sławecki (@bswck).
This software is licensed under the terms of GPL-3.0 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
File details
Details for the file autorefine-0.0.0.tar.gz
.
File metadata
- Download URL: autorefine-0.0.0.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8677618377ad377fcd56433cb244dec4756428b3daadb3ba863203238140c0f |
|
MD5 | 0e1c9286c5238627e58591fd6cb632c5 |
|
BLAKE2b-256 | d170febbe218b81e2556d7baf1e0d351dc8f8cdc8ffc1432f13502ab4ad48ddf |
File details
Details for the file autorefine-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: autorefine-0.0.0-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 140223203e2fe259a6e823578a4eeb4485bb2c602a88b2bc620ca97a0b00f2ec |
|
MD5 | 8a442fe4da8937dec9aa62a97bfa2248 |
|
BLAKE2b-256 | 6629cc5abe1cba2d81e12abf4c49043fff3af3419427b9363cc768521910f821 |