Skip to content

Commit

Permalink
poe added as lib in poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
pseusys committed Nov 10, 2023
1 parent a4ccca1 commit e809853
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
poe docs
poetry run poe docs
- name: remove jekyll theming
run: touch docs/build/.nojekyll
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
- name: run codestyle
run: |
poe lint
poetry run poe lint
2 changes: 1 addition & 1 deletion .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ jobs:
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
poe test_all
poetry run poe test_all
4 changes: 2 additions & 2 deletions .github/workflows/test_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
poe test_no_cov
poetry run poe test_no_cov
test_no_deps:
runs-on: "ubuntu-latest"
Expand All @@ -68,4 +68,4 @@ jobs:
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
poe test_no_deps
poetry run poe test_no_deps
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ We ask that you adhere to the following

## Managing your workflow
We use `poetry` and `poethepoet` as handy automation tools, which reads `pyproject.toml` to get specification for commands.
`poetry` is a tool for command running automatization. Usage signature of the `poetry` is `poe COMMAND`.
`poetry` is a tool for command running automatization. Usage signature of the `poetry` is `poetry run poe COMMAND`.
If your environment does not support `poetry`, it can be installed as a regular python package with `pip install poetry`.
`poethepoet` will be automatically installed upon installation of `devel` dependency group.

Expand Down Expand Up @@ -56,7 +56,7 @@ to annotate your modules and objects. You can easily build the Sphinx documentat
by activating the virtual environment and then running

```bash
poe docs
poetry run poe docs
```

After that `docs/build` dir will be created and you can open index file `docs/build/index.html` in your browser of choice.
Expand Down Expand Up @@ -107,28 +107,28 @@ It doesn't take previous formatting into account. See more about [black](https:/
To format your code, run

```bash
poe format
poetry run poe format
```

### Test
We use `black`, `mypy`, `flake8` as code style checkers and `pytest` as unit-test runner.
To run unit-tests only, use
```bash
poe test_no_cov
poetry run poe test_no_cov
```
To execute all tests, including integration with DBs and APIs tests, run
```bash
poe test_all
poetry run poe test_all
```
for successful execution of this command `Docker` and `docker-compose` are required.

To make sure that the code satisfies only the style requirements, run
```bash
poe lint
poetry run poe lint
```
And if it doesn't, to automatically fix whatever is possible with `black`, run
```bash
poe format
poetry run poe format
```

Tests are configured via [`.env_file`](.env_file).
Expand Down Expand Up @@ -159,11 +159,11 @@ To launch both groups run
docker-compose --profile context_storage --profile stats up
```

This will be done automatically when running `poe test_all`.
This will be done automatically when running `poetry run poe test_all`.

### Other provided features
You can get more info about `poetry` commands by `info`:

```bash
poe info
poetry run poe info
```
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ cryptography = { version = "*", optional = true }
requests = { version = "2.31.0", optional = true }
pytelegrambotapi = { version = "*", optional = true }
opentelemetry-instrumentation = { version = "*", optional = true }
sqlalchemy = { version = "*", extras=["asyncio"], optional = true }
sqlalchemy = { version = "*", extras = ["asyncio"], optional = true }
opentelemetry-exporter-otlp = { version = ">=1.20.0", optional = true }

[tool.poetry.extras]
Expand Down Expand Up @@ -139,14 +139,14 @@ optional = true
[tool.poetry.group.devel.dependencies]
python-on-whales = "0.64.3"
python-dotenv = "0.21.1"
poethepoet = "0.24.2"
poethepoet = { version = "0.24.2", extras = ["poetry_plugin"] }


[tool.poetry.group.tutorials]
optional = true

[tool.poetry.group.tutorials.dependencies]
flask = { version = "3.0.0", extras=["async"] }
flask = { version = "3.0.0", extras = ["async"] }
psutil = "5.9.5"
telethon = "1.31.0"
fastapi = "0.103.1"
Expand Down
2 changes: 1 addition & 1 deletion scripts/codestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def lint() -> int:
lint_result = _run_lint_and_mypy()
would_format = _run_black(False)
if would_format == 1:
print(("=" * 38) + "\nBad formatting? Run: poe format\n" + ("=" * 38))
print(("=" * 38) + "\nBad formatting? Run: poetry run poe format\n" + ("=" * 38))
return lint_result or would_format


Expand Down
16 changes: 8 additions & 8 deletions scripts/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ def info():
+ "Install development-ready version of framework"
)
print(f"{Fore.BLUE}poetry env remove --all{Style.RESET_ALL}: Remove all virtual environments\n")
print(f"{Fore.BLUE}poe info{Style.RESET_ALL}: Display this message again")
print(f"{Fore.BLUE}poe lint{Style.RESET_ALL}: Run linters")
print(f"{Fore.BLUE}poe format{Style.RESET_ALL}: Run formatters")
print(f"{Fore.BLUE}poetry run poe info{Style.RESET_ALL}: Display this message again")
print(f"{Fore.BLUE}poetry run poe lint{Style.RESET_ALL}: Run linters")
print(f"{Fore.BLUE}poetry run poe format{Style.RESET_ALL}: Run formatters")
print(
f"{Fore.BLUE}poe test_no_cov{Style.RESET_ALL}:"
f"{Fore.BLUE}poetry run poe test_no_cov{Style.RESET_ALL}:"
+ " Run tests without coverage, skipping all tests for unavailable services,"
+ " this is the most complete testing without Docker"
)
print(
f"{Fore.BLUE}poe test_no_deps{Style.RESET_ALL}:"
f"{Fore.BLUE}poetry run poe test_no_deps{Style.RESET_ALL}:"
+ " Run tests without any dependencies, allowing skipping everything"
)
print(
f"{Fore.BLUE}poe test_all{Style.RESET_ALL}:"
f"{Fore.BLUE}poetry run poe test_all{Style.RESET_ALL}:"
+ " Run ALL tests, prohibit skipping, run Docker (slow, closest to CI)"
)
print(
f"{Fore.BLUE}poe docs{Style.RESET_ALL}:"
f"{Fore.BLUE}poetry run poe docs{Style.RESET_ALL}:"
+ " Build Sphinx docs; activate your virtual environment before execution"
)
print(f"{Fore.BLUE}poe clean_docs{Style.RESET_ALL}: Remove all documentation build roots")
print(f"{Fore.BLUE}poetry run poe clean_docs{Style.RESET_ALL}: Remove all documentation build roots")
print(f"{Fore.BLUE}poen clean{Style.RESET_ALL}: Clean all build artifacts\n")

0 comments on commit e809853

Please sign in to comment.