Thank you very much for wanting to contribute to the project! To contribute, you can open an issue or a pull request. If you want to contribute code, I recommend that you read this document to understand how the project is organized and how to contribute.
Directory structure
flowchart
. --> .github
. --> docs
. --> netmikro
. --> tests
. --> pyproject.toml
The project is divided into three main directories:
netmikro
: Contains the source code of the project.tests
: Contains the tests of the project.docs
: Contains the documentation of the project.
flowchart
. --> netmikro
netmikro --> modules
netmikro --> utils
netmikro --> __init__.py
netmikro --> exceptions.py
netmikro --> routeros.py
All project source code is in the netmikro
directory. Whenever relevant, the documentation for each module, class or function will be done in the code itself, following the google docstrings standard. So, if you change anything in the code, remember to also update the docstrings (if they exist).
For testing we are using pytest. Its settings can be found in the pyproject.toml file in the root of our project.
Test coverage is being generated automatically with pytest-cov, being displayed when the test task is executed:
task test
Whenever you run task test
, three tasks are performed:
pre_test
: Runstask lint
to check if the code is following the project style standard.test
: Runs the tests.post_test
: Generates the coverage report.
Each of these tasks are explained in detail in the Tasks section.
The project's documentation is generated with MkDocs, with the theme Material for MkDocs and hosted on Read the Docs. The documentation is written in Markdown and is in the docs
directory.
flowchart
. --> docs
docs --> css
docs --> js
docs --> contributing.md
docs --> index.md
. --> mkdocs.yml
All configuration can be found in the mkdocs.yml file in the root of the repository.
This project basically uses two tools as a basis for everything with control:
- Poetry: For environment management and library installation;
- Taskipy: For automation of routine tasks. How to run tests, linters, etc.
Ensure you have Poetry installed and properly configured on your machine.
Listed here are the project's task settings, which you can use to perform common tasks. How to run tests, linters, etc.
To run a task, use the following command:
task <nome_da_task>
[tool.taskipy.tasks]
ruff = "ruff check ."
blue = "blue --check . --diff"
isort = "isort --check --diff ."
mypy = "mypy -p netmikro"
radon = "radon cc ./netmikro -a -na"
bandit = "bandit -r ./netmikro"
pydocstyle = "pydocstyle ./netmikro --count --convention=google --add-ignore=D100,D104,D105,D107"
lint = "task ruff && task blue && task isort"
format = 'blue . && isort .'
docs = "mkdocs serve"
quality = "task mypy && task radon && task pydocstyle"
badge = "coverage-badge -o docs/assets/coverage.svg -f"
pre_test = "task lint"
test = "pytest -s -x --cov=netmikro -vv"
post_test = "coverage html"
export-requirements = "rm requirements.txt && poetry export -f requirements.txt --output requirements.txt --without-hashes"
export-requirements-doc = "poetry export -f requirements.txt --output docs/requirements.txt --without-hashes --only doc"
ready = "task lint && task quality && task bandit && pytest -s -x --cov=netmikro -vv && coverage html && task export-requirements && task export-requirements-doc && task badge"
flowchart LR
. --> .github
.github --> workflows
workflows --> ci.yml
The .github
directory contains the GitHub Actions configuration files. The ci.yml
file contains the project's CI/CD settings. With it, whenever a commit is made to the main
branch, GitHub Actions will run tests and linters checking if everything is OK.
To make commits easier to read, it is recommended to follow the Conventional Commits commit message pattern of semantic commits.