2023-11-26 22:44:58 +00:00
|
|
|
# Poetry Flake Template
|
2023-11-26 22:31:00 +00:00
|
|
|
|
|
|
|
This is a template for constructing a working environment for Python (version
|
|
|
|
3.11.6) development. Packaging and dependency management relies on [poetry](https://python-poetry.org/)
|
|
|
|
(version 1.7.0). [direnv](https://direnv.net/) can be used to a launch a dev
|
|
|
|
shell upon entering this directory (refer to `.envrc`). Otherwise run via:
|
|
|
|
```bash
|
2023-12-01 17:12:16 +00:00
|
|
|
$ nix develop
|
2023-11-26 22:31:00 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Language Server
|
|
|
|
|
|
|
|
The [python-lsp-server](https://github.com/python-lsp/python-lsp-server)
|
|
|
|
(version v1.9.0) is included in this flake, along with the [python-lsp-black](https://github.com/python-lsp/python-lsp-black)
|
2023-12-01 23:02:39 +00:00
|
|
|
and [pyls-isort](https://github.com/paradoxxxzero/pyls-isort) plugins.
|
|
|
|
Additionally, `pylsp` is expected to be configured to use:
|
|
|
|
|
|
|
|
* [McCabe](https://github.com/PyCQA/mccabe),
|
|
|
|
* [pycodestyle](https://pycodestyle.pycqa.org/en/latest/), and
|
|
|
|
* [pyflakes](https://github.com/PyCQA/pyflakes).
|
|
|
|
|
|
|
|
Refer to your editor for configuration details.
|
2023-11-26 22:31:00 +00:00
|
|
|
|
|
|
|
## Formatting
|
|
|
|
|
|
|
|
Formatting depends on the [black](https://black.readthedocs.io/en/stable/index.html)
|
|
|
|
(version 23.9.1) tool. A `pre-commit` hook is included in `.githooks` that can
|
|
|
|
be used to format all `*.py` files prior to commit. Install via:
|
|
|
|
```bash
|
2023-12-01 17:12:16 +00:00
|
|
|
$ git config --local core.hooksPath .githooks/
|
2023-11-26 22:31:00 +00:00
|
|
|
```
|
|
|
|
If running [direnv](https://direnv.net/), this hook is installed automatically
|
|
|
|
when entering the directory.
|