Skip to content

Commit 2989866

Browse files
committed
more cleanup
1 parent 89881c9 commit 2989866

File tree

5 files changed

+96
-49
lines changed

5 files changed

+96
-49
lines changed

.coveragerc

Lines changed: 0 additions & 24 deletions
This file was deleted.

README.md

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -616,33 +616,67 @@ spec:
616616
```
617617
618618
## Development Environment
619-
The following should get you a working development environment to test with:
619+
The following should get you a working development environment (min requirements are Python v3.12) to test with.
620+
621+
### Setup
620622
621623
```bash
622-
# Create a virtual environment in the same directory you
623-
# cloned this repository to:
624-
python -m venv .
624+
# Create and activate a Python 3.12 virtual environment:
625+
python3.12 -m venv .venv
626+
. .venv/bin/activate
627+
628+
# Install core dependencies:
625629

626-
# Activate it now:
627-
. ./bin/activate
630+
pip install -e '.[dev]'
631+
```
628632

629-
# install dependencies
630-
pip install -r dev-requirements.txt -r requirements.txt
633+
### Running the Dev Server
631634

632-
# Run a dev server (debug mode) accessible from your browser at:
633-
# -> http://localhost:8000/
635+
```bash
636+
# Start the development server in debug mode:
634637
./manage.py runserver
638+
# Then visit: http://localhost:8000/
639+
```
635640

641+
Or use Docker:
642+
```bash
643+
# It's this simple:
644+
docker compose up
636645
```
637646

638-
Some other useful development notes:
647+
### Quality Assurance and Testing (via Tox)
639648

640-
```bash
641-
# Check for any lint errors
642-
flake8 apprise_api
649+
The project uses `tox` to manage linting, testing, and formatting in a reproducible way.
643650

651+
```bash
644652
# Run unit tests
653+
tox -e test
654+
655+
# Test structure; calls ruff under the hood
656+
tox -e lint
657+
```
658+
659+
**Note**: You can combine environments, e.g.:
660+
```bash
661+
tox -e test,lint
662+
```
663+
664+
Automatically format your code if possible to pass linting after changes:
665+
```bash
666+
tox -e format
667+
```
668+
669+
### Manual Tools (optional)
670+
The following also works assuming you have provided all development dependencies (`pip install .[dev]`)
671+
```bash
672+
# Run unit tests manually (if needed)
645673
pytest apprise_api
674+
675+
# Lint code with Ruff
676+
ruff check .
677+
678+
# Format code with Ruff
679+
ruff format .
646680
```
647681

648682
## Apprise Integration
@@ -790,4 +824,6 @@ The colon `:` prefix is the switch that starts the re-mapping rule engine. You
790824

791825

792826
## Metrics Collection & Analysis
827+
793828
Basic Prometheus support added through `/metrics` reference point.
829+

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
2-
apprise:
2+
apprise-api:
33
build: .
4-
container_name: apprise
4+
container_name: apprise-api
55
environment:
66
- APPRISE_STATEFUL_MODE=simple
77
ports:

pyproject.toml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,29 @@ filterwarnings = ["once::Warning"]
6666
testpaths = ["apprise_api"]
6767

6868
[tool.coverage.run]
69-
branch = true
70-
source = ["apprise_api"]
71-
parallel = true
69+
data_file = ".coverage-reports/.coverage"
70+
parallel = false
71+
concurrency = ["multiprocessing"]
72+
include = ["apprise_api"]
73+
omit = [
74+
"*apps.py",
75+
"*/migrations/*",
76+
"*/core/settings/*",
77+
"*/*/tests/*",
78+
"lib/*",
79+
"lib64/*",
80+
"*urls.py",
81+
"*/core/wsgi.py",
82+
"gunicorn.conf.py",
83+
"*/manage.py"
84+
]
85+
disable_warnings = ["no-data-collected"]
7286

7387
[tool.coverage.report]
7488
show_missing = true
7589
skip_covered = true
7690
skip_empty = true
91+
fail_under = 75.0
7792

7893
[tool.ruff]
7994
line-length = 120
@@ -161,3 +176,4 @@ section-order = ["future", "standard-library", "third-party", "first-party", "lo
161176

162177
[tool.ruff.lint.flake8-builtins]
163178
builtins-ignorelist = ["_"]
179+

tox.ini

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
[tox]
2-
envlist = lint, format, qa, coverage
2+
envlist =
3+
clean
4+
test
5+
lint
6+
format
7+
qa
8+
coverage
9+
310
skip_missing_interpreters = true
411

12+
[testenv]
13+
skip_install = false
14+
usedevelop = true
15+
changedir = {toxinidir}
16+
allowlist_externals = *
17+
ensurepip = true
18+
setenv =
19+
COVERAGE_RCFILE = {toxinidir}/pyproject.toml
20+
521
[testenv:lint]
622
description = Run Ruff in check-only mode
723
deps = ruff
824
commands = ruff check apprise_api
9-
changedir = {toxinidir}
1025

1126
[testenv:format]
12-
description = Auto-fix lint issues using ruff
27+
description = Auto-format code using Ruff
1328
deps = ruff
1429
skip_install = true
1530
commands = ruff check --fix apprise_api
16-
changedir = {toxinidir}
1731

1832
[testenv:qa]
1933
description = Run test suite and linting with coverage
@@ -22,7 +36,13 @@ deps =
2236
commands =
2337
coverage run --parallel -m pytest apprise_api
2438
ruff check apprise_api
25-
changedir = {toxinidir}
39+
40+
[testenv:test]
41+
description = Run test suite only
42+
deps =
43+
.[dev]
44+
commands =
45+
pytest --tb=short -q apprise_api {posargs}
2646

2747
[testenv:coverage]
2848
description = Generates coverage details
@@ -31,5 +51,4 @@ deps =
3151
commands =
3252
coverage combine apprise_api
3353
coverage report apprise_api
34-
changedir = {toxinidir}
3554

0 commit comments

Comments
 (0)