Skip to content

Commit

Permalink
docs: add poetry installation info to contributing
Browse files Browse the repository at this point in the history
  • Loading branch information
BPR02 committed Nov 24, 2024
1 parent 848d211 commit 60aee3f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
44 changes: 42 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 60aee3f

Please sign in to comment.