Ensure your values are right
Often times I write a lot of boilerplate code to validate and correct certain values. I have decided to create a package to stop doing it for some of the things I use. The goals of this package:
- perform routine type validation and correction (amend!)
- do not rely on third-party libraries
- if it's outside standard Python, amends should be handled by package maintainers
- do not overcomplicate things
- what can easily be done with a processing pipeline should be done with a processing pipeline
Using this, hopefully, writing argument parsers and ensuring correctness in functionality should be slightly easier, while forcing people to explicitly handle more elaborate and specific use cases.
You can install this with pip:
pip install amendAlternatively, you can install this from source:
git clone [email protected]:suflaj/amend.git
cd amend
pip install .
Amend uses your run-of-the-mill unittest. Therefore, to test the whole package, you can simply do:
python3 -m unittest amend.testingIf you wish to test some specific module you can reference the testing module with unittest. For example, if you want to unit test built-in amendments, do:
python3 -m unittest amend.testing.unit.built_inFor more info on how to use unittest, look here.
This package is in beta. For it to reach a full release it will need to receive:
- ReadTheDocs documentations
- usage examples
- some actual usage (will start to substitute my boilerplate for it)
Currently, it wasn't battle tested. I put in some effort to write it well, but not necessarily optimally. However, even though I do not recommend you use this for production, you can use it for many things, and presumably it should work. If it doesn't, create an issue. The format doesn't really matter currently.