Roman numerals convertor, a small project illustrating advanced Python concepts
- User-defined class with constructors, static methods and many overriden magic methods
- Users are able to do type conversion, string representation, arithmetic and comparison operations, using Roman numerals and other numeric types
- Custom made coroutines
- Custom made decorator
- Custom made enum
- Custom made exceptions
- Custom made generators
- Implementation of the Iterator Protocol
- Jupyter Notebook which illustrates usage of all Roman class functionality
- Unit tests for all functionality in the project
- Separate
requirements.txt
andtest-requirements.txt
files, holding the development and testing dependencies
- Create a virtual environment for the project:
conda create -n <env_name> python=3.10
- Activate the virtual environment:
conda activate <env_name>
- Install the development dependencies:
pip install -r requirements.txt
- Start Python interpreter, import the Roman class and play with Roman numbers!
- Test by first importing the Roman class:
from scripts.roman import Roman
- Test by first importing the Roman class:
- Create a virtual environment for the project (or activate the one created for the step above)
- Install the testing dependencies:
pip install -r test-requirements.txt
- Run the pytest test suit from the project base directory:
python -m pytest tests
- Compute the test coverage:
coverage run --source=scripts -m pytest -v .\tests\
- Visualize the test coverage report (in the CLI):
coverage report -m
- Visualize the test coverage report (in the web browser):
coverage html
-> Then open theindex.html
file from the newly generatedhtmlcov
directory
- Compute the test coverage:
- Run the flake8 linting tool from the project base directory:
flake8
- Configure flake8 by editing the
.flake8
file
- Configure flake8 by editing the
- Run the mypy static type checker from the project base directory:
mypy
- Configure mypy by editing the
mypy.ini
file
- Configure mypy by editing the