Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.
/ sawdust-watcher Public archive

Code for sawdust detection and monitoring prototype

Notifications You must be signed in to change notification settings

DM1122/sawdust-watcher

Repository files navigation

Python Version Code style: black Pre-Commit GitHub repo size GitHub code size in bytes Lines of code Pytest codecov

sawdust-watcher

Code for sawdust detection and monitoring prototype

Contribution

Setup

This section will take you through the procedure to configure your development environment. At a glance:

  1. Install project's python version
  2. Install git
  3. Install poetry
  4. Clone repository
  5. Run poetry install
  6. Configure IDE virtual environment
  7. Install pre-commit hooks

Begin by installing the project's python version. See the badges at the top of the README for the version number.

If not already installed, install git.

The repo employs poetry as its dependency and environment manager. Poetry can be installed through the Windows Powershell via:

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python -

Clone the repo using Github Desktop or the commandline via:

git clone https://github.com/DM1122/aatc.git

From within the cloned repo, run poetry's install command to install all the dependencies in one go:

poetry install

Configure your IDE to use the virtual environment poetry has created at C:\Users\<USERNAME>\AppData\Local\pypoetry\Cache\virtualenvs. In the case of VSCode , enter the command pallet by going to View>Command Palette and search for Python:Select Interpreter. Select the appropriate poetry virtual environment for the repo. Restart VSCode if you do not see it listed.

Install the pre-commit script and hooks using:

pre-commit install --install-hooks

You're now ready to start contributing!

Adding Packages

To add a new package to the poetry virtual environment, install it via:

poetry add <package>

This is poetry's version of pip install <package>.

Testing

This repo uses pytest for unit testing. To run all unit tests, call:

pytest -v

You can find an interactive report of test results in ./logs/pytest/pytest-report.html. Individual tests can also be specified as follows:

pytest tests/test_<filename>.py::<function name>

Groups of tests can be run using markers. Assign a marker decorator to the group of functions you want to test like this:

@pytest.mark.foo
def my_test_function():
    # some test

To use the custom marker foo, it must be added to the list of custom pytest markers in pyproject.toml>[tool.pytest.ini_options]>markers. The tests marked with foo can then be run by calling:

pytest -v -m foo

Or to avoid all tests with a particular marker, call:

pytest -v -m "not foo"

Commits

Pre-Commit

This repo is configured to use pre-commit hooks. The pre-commit pipeline is as follows:

  1. Isort: Sorts imports, so you don't have to.
  2. Black: The uncompromising code autoformatter.
  3. Pylint: It's not just a linter that annoys you!

Pre-commit will run the hooks on commit, but when a hook fails, they can be run manually to delint using:

isort . & black . & pylint_runner

About

Code for sawdust detection and monitoring prototype

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published