leave codecrumbs behind so that other can adopt the changes
Project description
codecrumbs
Codecrumbs is a Python library (and pytest plugin) for source code refactoring across library boundaries. It allows you to change the API of your library and to propagate this changes to every one who uses your library.
More can be found in the documentation.
Example
Simple example which renames one argument:
class Example:
# old code ...
# def method(self,v):
# print(v)
@renamed_argument("v", "value")
def method(self, value):
print(value)
# some where else
e = Example()
e.method(v=5)
and apply the refactoring later
# if you have a standalone script
codecrumbs example.py
# or if you have tests
pytest --codecrumbs-fix test_example.py
which will rename the argument
e.method(value=5)
You can use codecrumbs
instead of python
to execute your code, or pytest
to run your tests and apply the renamings automatically.
This can be used to fix the small things in your library you wanted to fix but never did, because you wanted to stay backwards compatible or didn't wanted you user to fix 1000 renamings in their code.
Installation
You can install codecrumbs
via pip
from PyPI:
pip install codecrumbs
The pytest support comes out of the box and everyone who depends on your library can use pytest --codecrumbs-fix
to apply the changes you declared.
Features
With codecrumbs you can fix:
- method / attribute names
- rename named arguments of functions
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
Issues
If you encounter any problems, please file an issue along with a detailed description.
License
Distributed under the terms of the MIT license, "pytest-codecrumbs" is free and open source software
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 codecrumbs-0.1.0.tar.gz
.
File metadata
- Download URL: codecrumbs-0.1.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.11.0 Linux/5.10.0-20-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5de0867d0851bf6d2bc23ebc81291e6625afe4f743da13de0cc822672d9c07d |
|
MD5 | 83b5b7421d5179551fdaab0cdebcf82a |
|
BLAKE2b-256 | 759863692961605d74e2d7c2e21e1bed63bbcfe50d4bb6bf733f1f9123bec790 |
File details
Details for the file codecrumbs-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: codecrumbs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.1 CPython/3.11.0 Linux/5.10.0-20-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b8ce3501e6a8d0618027821e3005df693951b5ee46ef5d20ef86a1b93cc5928 |
|
MD5 | f800004eabab824e6ea48c60bccc5085 |
|
BLAKE2b-256 | 19c5a1b75da5bbbcb3de4ed4534ccdbd5f8b29d45dc6979fef8ac177707bb811 |