diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dadb325..6b93736 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,28 +1,68 @@ # Contributing Contributions are welcome! Make sure to first open an issue discussing the problem or the new feature before creating a pull request. This project uses [poetry](https://python-poetry.org/). +## Installation +Python and poetry are used for the dependency and build management. + +### Install Poetry +[Poetry](https://python-poetry.org/) can be installed with `pip` on most systems, but the direct installer on windows systems may work better. + +#### Linux/MacOS +```bash +$ pip install poetry +``` + +#### Windows +```bash +$ (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - +``` +or +```bash +$ (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py - +``` + +### Install Dependencies +Once poetry is installed, the dependencies can be installed with the following command +```bash +$ poetry install --with dev +``` + +### Open Shell +The virtualenv can be accessed using the following command to avoid prepending `poetry run` to every command +```bash +$ poetry shell +``` + + ## Code Style The code follows the [black](https://github.com/psf/black) code style. Import statements are sorted with [isort](https://pycqa.github.io/isort/). The project must type-check with [pyright](https://github.com/microsoft/pyright). It is recommend to run the type-checker via the VSCode Python extension (discussed below). -**Format** +**Reformat** ```bash # omit `poetry run` if u have the virtualenv activated $ poetry run isort beet_observer $ poetry run black beet_observer ``` -**Check** +**Check Formatting** ```bash # omit `poetry run` if u have the virtualenv activated $ poetry run black --check beet_observer $ poetry run isort --check-only beet_observer ``` +**Type check** +```bash +# omit `poetry run` if u have the virtualenv activated +$ poetry run pyright +``` + You can run `poetry self add 'poethepoet[poetry_plugin]'` to get access to an easier set of commands: ```bash # omit `poetry` if u have the virtualenv activated $ poetry poe format $ poetry poe check +$ poetry poe typing ``` ## IDE diff --git a/pyproject.toml b/pyproject.toml index c40c08c..3c85bbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ typeCheckingMode = "strict" [tool.poe.tasks] format = {shell = "isort beet_observer & black beet_observer"} check = {shell = "isort --check-only beet_observer & black --check beet_observer"} +typing = {shell = "pyright"} [build-system] requires = ["poetry-core"]