aiogram-coordination 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aiogram_coordination-0.1.0/.gitattributes +9 -0
- aiogram_coordination-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +20 -0
- aiogram_coordination-0.1.0/.github/ISSUE_TEMPLATE/feature_request.yml +15 -0
- aiogram_coordination-0.1.0/.github/pull_request_template.md +14 -0
- aiogram_coordination-0.1.0/.github/workflows/ci.yml +154 -0
- aiogram_coordination-0.1.0/.github/workflows/publish.yml +91 -0
- aiogram_coordination-0.1.0/.gitignore +24 -0
- aiogram_coordination-0.1.0/CHANGELOG.md +14 -0
- aiogram_coordination-0.1.0/CHANGES/README.rst +1 -0
- aiogram_coordination-0.1.0/CODE_OF_CONDUCT.md +138 -0
- aiogram_coordination-0.1.0/CONTRIBUTING.md +29 -0
- aiogram_coordination-0.1.0/LICENSE +22 -0
- aiogram_coordination-0.1.0/PKG-INFO +123 -0
- aiogram_coordination-0.1.0/README.md +99 -0
- aiogram_coordination-0.1.0/SECURITY.md +25 -0
- aiogram_coordination-0.1.0/docs/api.md +46 -0
- aiogram_coordination-0.1.0/docs/index.md +10 -0
- aiogram_coordination-0.1.0/docs/isolation.md +78 -0
- aiogram_coordination-0.1.0/docs/redis.md +33 -0
- aiogram_coordination-0.1.0/docs/releasing.md +21 -0
- aiogram_coordination-0.1.0/docs/sessions.md +29 -0
- aiogram_coordination-0.1.0/examples/custom_isolation.py +85 -0
- aiogram_coordination-0.1.0/examples/memory_scope.py +22 -0
- aiogram_coordination-0.1.0/mkdocs.yml +11 -0
- aiogram_coordination-0.1.0/pyproject.toml +75 -0
- aiogram_coordination-0.1.0/reports/README.md +7 -0
- aiogram_coordination-0.1.0/reports/verification.md +38 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/__init__.py +47 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/compat.py +72 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/errors.py +21 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/identity.py +66 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/isolation.py +331 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/memory.py +127 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/protocols.py +55 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/py.typed +0 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/redis.py +399 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/redis_isolation.py +202 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/sessions.py +61 -0
- aiogram_coordination-0.1.0/src/aiogram_coordination/version.py +8 -0
- aiogram_coordination-0.1.0/tests/__init__.py +1 -0
- aiogram_coordination-0.1.0/tests/conftest.py +25 -0
- aiogram_coordination-0.1.0/tests/test_contracts.py +120 -0
- aiogram_coordination-0.1.0/tests/test_isolation.py +334 -0
- aiogram_coordination-0.1.0/tests/test_isolation_lifecycle.py +254 -0
- aiogram_coordination-0.1.0/tests/test_memory.py +89 -0
- aiogram_coordination-0.1.0/tests/test_redis.py +333 -0
- aiogram_coordination-0.1.0/tools/README.md +8 -0
- aiogram_coordination-0.1.0/tools/check_install.py +40 -0
- aiogram_coordination-0.1.0/tools/check_version.py +33 -0
- aiogram_coordination-0.1.0/uv.lock +3410 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a reproducible navigation or recovery problem.
|
|
3
|
+
body:
|
|
4
|
+
- type: markdown
|
|
5
|
+
attributes:
|
|
6
|
+
value: For sensitive vulnerabilities, follow SECURITY.md. Remove tokens, credentials and private message text.
|
|
7
|
+
- type: textarea
|
|
8
|
+
id: environment
|
|
9
|
+
attributes:
|
|
10
|
+
label: Environment
|
|
11
|
+
description: Python, aiogram-coordination, aiogram and optional redis-py versions; memory or Redis backend; FSM isolation configuration.
|
|
12
|
+
validations:
|
|
13
|
+
required: true
|
|
14
|
+
- type: textarea
|
|
15
|
+
id: reproduction
|
|
16
|
+
attributes:
|
|
17
|
+
label: Minimal reproduction
|
|
18
|
+
description: Include expected versus actual behavior and sanitized traceback. For recovery issues, state which effect stages are confirmed or unknown.
|
|
19
|
+
validations:
|
|
20
|
+
required: true
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Describe a navigation use case or API improvement.
|
|
3
|
+
body:
|
|
4
|
+
- type: textarea
|
|
5
|
+
id: use_case
|
|
6
|
+
attributes:
|
|
7
|
+
label: Use case
|
|
8
|
+
description: What behavior does your application need? Include alternatives already considered.
|
|
9
|
+
validations:
|
|
10
|
+
required: true
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: proposal
|
|
13
|
+
attributes:
|
|
14
|
+
label: Proposed behavior
|
|
15
|
+
description: Describe API, backend, recovery and compatibility implications where relevant.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## Change
|
|
2
|
+
|
|
3
|
+
Describe the problem and resulting behavior.
|
|
4
|
+
|
|
5
|
+
## Verification
|
|
6
|
+
|
|
7
|
+
List checks actually run and remaining limitations. Mention real-Redis coverage for
|
|
8
|
+
storage, concurrency or recovery changes.
|
|
9
|
+
|
|
10
|
+
## Compatibility
|
|
11
|
+
|
|
12
|
+
Describe any public API, persisted-schema, callback ownership or FSM impact.
|
|
13
|
+
Include a `CHANGES/` fragment for user-visible changes. Keep aiogram-idle and Redis
|
|
14
|
+
optional, and do not include credentials or generated security reports.
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
concurrency:
|
|
6
|
+
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
7
|
+
cancel-in-progress: true
|
|
8
|
+
jobs:
|
|
9
|
+
quality:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v6
|
|
14
|
+
- run: uv sync --frozen --extra redis --python 3.12
|
|
15
|
+
- run: uv run --no-sync ruff check .
|
|
16
|
+
- run: uv run --no-sync ruff format --check .
|
|
17
|
+
- run: uv run --no-sync pyright src examples
|
|
18
|
+
- run: uv run --no-sync python tools/check_version.py
|
|
19
|
+
- run: uv run --no-sync towncrier build --draft
|
|
20
|
+
- run: uv run --no-sync pytest
|
|
21
|
+
- run: uv run --no-sync mkdocs build --strict
|
|
22
|
+
- run: uv build
|
|
23
|
+
- run: uv run --no-sync twine check dist/*
|
|
24
|
+
- name: Independently install wheel and sdist without optional dependencies
|
|
25
|
+
shell: bash
|
|
26
|
+
run: |
|
|
27
|
+
for artifact in dist/*.whl dist/*.tar.gz; do
|
|
28
|
+
target=$(mktemp -d)
|
|
29
|
+
uv venv --python 3.12 "$target/env"
|
|
30
|
+
uv pip install --python "$target/env/bin/python" "$artifact" pytest pytest-asyncio hypothesis
|
|
31
|
+
cp -R tests examples tools "$target/"
|
|
32
|
+
cp pyproject.toml "$target/"
|
|
33
|
+
cd "$target"
|
|
34
|
+
"$target/env/bin/python" tools/check_install.py
|
|
35
|
+
"$target/env/bin/python" tools/check_version.py
|
|
36
|
+
"$target/env/bin/python" -m pytest -q
|
|
37
|
+
cd "$GITHUB_WORKSPACE"
|
|
38
|
+
done
|
|
39
|
+
- uses: actions/upload-artifact@v4
|
|
40
|
+
with:
|
|
41
|
+
name: distributions
|
|
42
|
+
path: dist/*
|
|
43
|
+
if-no-files-found: error
|
|
44
|
+
compatibility:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
strategy:
|
|
47
|
+
fail-fast: false
|
|
48
|
+
matrix:
|
|
49
|
+
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
|
50
|
+
aiogram: [minimum, latest]
|
|
51
|
+
exclude:
|
|
52
|
+
# aiogram 3.22 pins dependencies released before Python 3.14 support.
|
|
53
|
+
- python: '3.14'
|
|
54
|
+
aiogram: minimum
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
- uses: astral-sh/setup-uv@v6
|
|
58
|
+
- run: uv sync --frozen --python '${{ matrix.python }}'
|
|
59
|
+
- shell: bash
|
|
60
|
+
run: |
|
|
61
|
+
if [ '${{ matrix.aiogram }}' = minimum ]; then
|
|
62
|
+
uv pip install 'aiogram==3.22.0'
|
|
63
|
+
else
|
|
64
|
+
uv pip install --upgrade 'aiogram>=3.22,<4'
|
|
65
|
+
fi
|
|
66
|
+
- run: uv run --no-sync pytest
|
|
67
|
+
- run: uv run --no-sync python examples/memory_scope.py
|
|
68
|
+
redis:
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
strategy:
|
|
71
|
+
fail-fast: false
|
|
72
|
+
matrix:
|
|
73
|
+
python: ['3.10', '3.12', '3.14']
|
|
74
|
+
redis-client: [minimum, latest]
|
|
75
|
+
server: ['7']
|
|
76
|
+
include:
|
|
77
|
+
- python: '3.12'
|
|
78
|
+
redis-client: latest
|
|
79
|
+
server: '8'
|
|
80
|
+
services:
|
|
81
|
+
redis:
|
|
82
|
+
image: redis:${{ matrix.server }}-alpine
|
|
83
|
+
ports: ['6379:6379']
|
|
84
|
+
options: --health-cmd "redis-cli ping" --health-interval 5s --health-timeout 3s --health-retries 10
|
|
85
|
+
env:
|
|
86
|
+
AIOGRAM_COORDINATION_REDIS_URL: redis://localhost:6379/0
|
|
87
|
+
AIOGRAM_COORDINATION_REQUIRE_REDIS: '1'
|
|
88
|
+
steps:
|
|
89
|
+
- uses: actions/checkout@v4
|
|
90
|
+
- uses: astral-sh/setup-uv@v6
|
|
91
|
+
- run: uv sync --frozen --extra redis --python '${{ matrix.python }}'
|
|
92
|
+
- if: matrix.redis-client == 'minimum'
|
|
93
|
+
run: uv pip install 'redis==5.0.8'
|
|
94
|
+
- run: uv run --no-sync pytest --cov=aiogram_coordination --cov-report=term-missing --cov-report=xml --cov-fail-under=80
|
|
95
|
+
- name: Verify Redis-enabled installed artifacts against the real server
|
|
96
|
+
if: matrix.python == '3.12' && matrix.redis-client == 'latest' && matrix.server == '7'
|
|
97
|
+
shell: bash
|
|
98
|
+
run: |
|
|
99
|
+
uv build
|
|
100
|
+
for artifact in dist/*.whl dist/*.tar.gz; do
|
|
101
|
+
target=$(mktemp -d)
|
|
102
|
+
uv venv --python 3.12 "$target/env"
|
|
103
|
+
uv pip install --python "$target/env/bin/python" "${artifact}[redis]" pytest pytest-asyncio hypothesis
|
|
104
|
+
cp -R tests examples tools "$target/"
|
|
105
|
+
cp pyproject.toml "$target/"
|
|
106
|
+
cd "$target"
|
|
107
|
+
"$target/env/bin/python" tools/check_install.py --redis
|
|
108
|
+
"$target/env/bin/python" -m pytest -q
|
|
109
|
+
cd "$GITHUB_WORKSPACE"
|
|
110
|
+
done
|
|
111
|
+
- if: always()
|
|
112
|
+
uses: actions/upload-artifact@v4
|
|
113
|
+
with:
|
|
114
|
+
name: redis-coverage-${{ matrix.python }}-${{ matrix.redis-client }}-${{ matrix.server }}
|
|
115
|
+
path: coverage.xml
|
|
116
|
+
if-no-files-found: warn
|
|
117
|
+
security:
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
steps:
|
|
120
|
+
- uses: actions/checkout@v4
|
|
121
|
+
- uses: astral-sh/setup-uv@v6
|
|
122
|
+
- run: uv sync --frozen --extra redis --python 3.12
|
|
123
|
+
# Keep the full low-severity inventory; the following invocation owns the gate.
|
|
124
|
+
- run: uv run --no-sync bandit -r src -f json -o bandit-report.json --exit-zero
|
|
125
|
+
- run: uv run --no-sync bandit -r src -ll
|
|
126
|
+
- name: Audit the resolved environment
|
|
127
|
+
if: always()
|
|
128
|
+
run: uv run --no-sync pip-audit --format=json --output=pip-audit-report.json
|
|
129
|
+
- if: always()
|
|
130
|
+
uses: actions/upload-artifact@v4
|
|
131
|
+
with:
|
|
132
|
+
name: security-reports
|
|
133
|
+
path: |
|
|
134
|
+
bandit-report.json
|
|
135
|
+
pip-audit-report.json
|
|
136
|
+
if-no-files-found: warn
|
|
137
|
+
checks:
|
|
138
|
+
name: Required checks
|
|
139
|
+
if: always()
|
|
140
|
+
needs: [quality, compatibility, redis, security]
|
|
141
|
+
runs-on: ubuntu-latest
|
|
142
|
+
steps:
|
|
143
|
+
- name: Require successful jobs
|
|
144
|
+
env:
|
|
145
|
+
RESULTS: ${{ toJSON(needs) }}
|
|
146
|
+
run: |
|
|
147
|
+
python - <<'PY'
|
|
148
|
+
import json
|
|
149
|
+
import os
|
|
150
|
+
results = json.loads(os.environ["RESULTS"])
|
|
151
|
+
failed = [name for name, job in results.items() if job["result"] != "success"]
|
|
152
|
+
if failed:
|
|
153
|
+
raise SystemExit("Required jobs did not pass: " + ", ".join(failed))
|
|
154
|
+
PY
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
name: Publish verified release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
inputs:
|
|
6
|
+
manifest_sha256:
|
|
7
|
+
description: SHA256 of the independently verified GitHub release SHA256SUMS
|
|
8
|
+
required: true
|
|
9
|
+
type: string
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: publish-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: false
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
verify:
|
|
20
|
+
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
timeout-minutes: 10
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v6
|
|
25
|
+
with:
|
|
26
|
+
persist-credentials: false
|
|
27
|
+
- uses: astral-sh/setup-uv@v7
|
|
28
|
+
with:
|
|
29
|
+
python-version: '3.12'
|
|
30
|
+
- name: Download the exact reviewed release artifacts
|
|
31
|
+
env:
|
|
32
|
+
GH_TOKEN: ${{ github.token }}
|
|
33
|
+
run: gh release download "$GITHUB_REF_NAME" --pattern '*.whl' --pattern '*.tar.gz' --pattern SHA256SUMS --dir dist
|
|
34
|
+
- name: Validate tag, distribution names and independently supplied checksums
|
|
35
|
+
env:
|
|
36
|
+
MANIFEST_SHA256: ${{ inputs.manifest_sha256 }}
|
|
37
|
+
run: |
|
|
38
|
+
python - <<'PYVERIFY'
|
|
39
|
+
import hashlib
|
|
40
|
+
import os
|
|
41
|
+
import re
|
|
42
|
+
import tomllib
|
|
43
|
+
from pathlib import Path
|
|
44
|
+
project = tomllib.loads(Path('pyproject.toml').read_text())['project']
|
|
45
|
+
version = project['version']
|
|
46
|
+
if os.environ['GITHUB_REF_NAME'] != 'v' + version:
|
|
47
|
+
raise SystemExit('Tag does not match project version')
|
|
48
|
+
expected_digest = os.environ['MANIFEST_SHA256']
|
|
49
|
+
if not re.fullmatch(r'[a-f0-9]{64}', expected_digest):
|
|
50
|
+
raise SystemExit('Expected an independently verified SHA256 digest')
|
|
51
|
+
manifest = Path('dist/SHA256SUMS')
|
|
52
|
+
if hashlib.sha256(manifest.read_bytes()).hexdigest() != expected_digest:
|
|
53
|
+
raise SystemExit('Release checksum manifest differs from reviewed input')
|
|
54
|
+
name = project['name'].replace('-', '_')
|
|
55
|
+
expected = {f'{name}-{version}-py3-none-any.whl', f'{name}-{version}.tar.gz'}
|
|
56
|
+
if {p.name for p in Path('dist').iterdir()} != expected | {'SHA256SUMS'}:
|
|
57
|
+
raise SystemExit('Unexpected release files')
|
|
58
|
+
checked = set()
|
|
59
|
+
for line in manifest.read_text().splitlines():
|
|
60
|
+
digest, filename = line.split()
|
|
61
|
+
if filename not in expected or filename in checked:
|
|
62
|
+
raise SystemExit('Unexpected or repeated checksum entry')
|
|
63
|
+
if hashlib.sha256((Path('dist') / filename).read_bytes()).hexdigest() != digest:
|
|
64
|
+
raise SystemExit('Distribution checksum mismatch')
|
|
65
|
+
checked.add(filename)
|
|
66
|
+
if checked != expected:
|
|
67
|
+
raise SystemExit('Missing distribution checksum')
|
|
68
|
+
PYVERIFY
|
|
69
|
+
- run: uvx twine check dist/*.whl dist/*.tar.gz
|
|
70
|
+
- uses: actions/upload-artifact@v6
|
|
71
|
+
with:
|
|
72
|
+
name: verified-distributions
|
|
73
|
+
path: |
|
|
74
|
+
dist/*.whl
|
|
75
|
+
dist/*.tar.gz
|
|
76
|
+
if-no-files-found: error
|
|
77
|
+
|
|
78
|
+
publish:
|
|
79
|
+
needs: verify
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
timeout-minutes: 10
|
|
82
|
+
environment: pypi
|
|
83
|
+
permissions:
|
|
84
|
+
id-token: write
|
|
85
|
+
steps:
|
|
86
|
+
- uses: actions/download-artifact@v7
|
|
87
|
+
with:
|
|
88
|
+
name: verified-distributions
|
|
89
|
+
path: dist
|
|
90
|
+
- name: Publish verified distributions using PyPI Trusted Publishing
|
|
91
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
.pytest_cache/
|
|
5
|
+
.ruff_cache/
|
|
6
|
+
.coverage
|
|
7
|
+
.coverage.*
|
|
8
|
+
coverage.xml
|
|
9
|
+
coverage.json
|
|
10
|
+
htmlcov/
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
site/
|
|
14
|
+
.env
|
|
15
|
+
.env.*
|
|
16
|
+
!.env.example
|
|
17
|
+
AGENTS.md
|
|
18
|
+
|
|
19
|
+
.hypothesis/
|
|
20
|
+
bandit-report.json
|
|
21
|
+
pip-audit-report.json
|
|
22
|
+
.mypy_cache/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.DS_Store
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
<!-- towncrier release notes start -->
|
|
4
|
+
|
|
5
|
+
## 0.1.0 (2026-11-10)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- Add shared task-scoped memory coordination and renewable fenced Redis coordination without Idle/Nav/Kit dependencies.
|
|
10
|
+
- Normalize complete conversation identities losslessly while retaining existing canonical Redis lock hashes and caller-selected prefixes.
|
|
11
|
+
- Add explicit tracked application FSM isolation, custom lease-provider receipts and renewable Redis reference isolation.
|
|
12
|
+
- Revoke borrowed effect capabilities immediately when application FSM ownership is lost; preserve external cancellation and count queued scopes during shutdown.
|
|
13
|
+
- Expose read-only external-session authority with immutable absolute lifetime and separate inactivity expiry.
|
|
14
|
+
- Ship typed artifacts, standalone examples, compatibility CI and real-Redis concurrency/process-crash tests.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use feature, bugfix, doc, removal or misc Towncrier fragments.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
+
|
|
9
|
+
## Our Standards
|
|
10
|
+
|
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
+
|
|
13
|
+
* Using welcoming and inclusive language
|
|
14
|
+
* Being respectful of differing viewpoints and experiences
|
|
15
|
+
* Gracefully accepting constructive criticism
|
|
16
|
+
* Focusing on what is best for the community
|
|
17
|
+
* Showing empathy towards other community members
|
|
18
|
+
|
|
19
|
+
Examples of unacceptable behavior include:
|
|
20
|
+
|
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
+
* Public or private harassment
|
|
24
|
+
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
+
|
|
27
|
+
## Enforcement Responsibilities
|
|
28
|
+
|
|
29
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
+
|
|
31
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
+
|
|
37
|
+
## Enforcement
|
|
38
|
+
|
|
39
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [arman.avanesyan@yahoo.com](mailto:arman.avanesyan@yahoo.com). Reports should include enough context for the maintainers to assess the incident.
|
|
40
|
+
|
|
41
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
+
|
|
43
|
+
## Enforcement Guidelines
|
|
44
|
+
|
|
45
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
+
|
|
47
|
+
### 1. Correction
|
|
48
|
+
|
|
49
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
+
|
|
51
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
|
+
|
|
53
|
+
### 2. Warning
|
|
54
|
+
|
|
55
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
|
56
|
+
|
|
57
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
+
|
|
59
|
+
### 3. Temporary Ban
|
|
60
|
+
|
|
61
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
+
|
|
63
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
64
|
+
|
|
65
|
+
### 4. Permanent Ban
|
|
66
|
+
|
|
67
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
68
|
+
|
|
69
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
70
|
+
|
|
71
|
+
## Reporting
|
|
72
|
+
|
|
73
|
+
If you experience or witness unacceptable behavior, or have any other concerns, please report it by contacting the project maintainers. All reports will be handled with discretion.
|
|
74
|
+
|
|
75
|
+
**Contact Information**:
|
|
76
|
+
- **Email**: arman.avanesyan@yahoo.com
|
|
77
|
+
|
|
78
|
+
When reporting, please include:
|
|
79
|
+
- Your contact information
|
|
80
|
+
- Names (real, nicknames, or pseudonyms) of any individuals involved
|
|
81
|
+
- Description of the incident
|
|
82
|
+
- Any additional context that may be helpful
|
|
83
|
+
|
|
84
|
+
## Handling reports
|
|
85
|
+
|
|
86
|
+
Maintainers assess reports and may use the enforcement guidelines above. Share
|
|
87
|
+
sensitive incident details by email, not public GitHub issues. This policy does
|
|
88
|
+
not promise a response deadline or a separate appeals team.
|
|
89
|
+
|
|
90
|
+
## Attribution
|
|
91
|
+
|
|
92
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
93
|
+
|
|
94
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
95
|
+
|
|
96
|
+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
97
|
+
|
|
98
|
+
[homepage]: https://www.contributor-covenant.org
|
|
99
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
100
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
101
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
102
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
103
|
+
|
|
104
|
+
## Project-Specific Guidelines
|
|
105
|
+
|
|
106
|
+
### For aiogram-coordination
|
|
107
|
+
|
|
108
|
+
In addition to the general Code of Conduct, we have specific guidelines for our project:
|
|
109
|
+
|
|
110
|
+
#### Technical Discussions
|
|
111
|
+
|
|
112
|
+
- **Be constructive**: Focus on improving the code and documentation
|
|
113
|
+
- **Provide context**: Include relevant code examples and error messages
|
|
114
|
+
- **Be patient**: Remember that everyone is learning and contributing
|
|
115
|
+
|
|
116
|
+
#### Issue and Pull Request Guidelines
|
|
117
|
+
|
|
118
|
+
- **Use clear titles**: Make it easy to understand what the issue or PR is about
|
|
119
|
+
- **Provide details**: Include steps to reproduce, expected behavior, and actual behavior
|
|
120
|
+
- **Be responsive**: Respond to feedback and questions promptly
|
|
121
|
+
|
|
122
|
+
#### Code Review
|
|
123
|
+
|
|
124
|
+
- **Be respectful**: Focus on the code, not the person
|
|
125
|
+
- **Be specific**: Point out exact lines and suggest improvements
|
|
126
|
+
- **Be appreciative**: Acknowledge good work and improvements
|
|
127
|
+
|
|
128
|
+
#### Community Support
|
|
129
|
+
|
|
130
|
+
- **Help others**: Share your knowledge and experience
|
|
131
|
+
- **Be inclusive**: Welcome newcomers and help them get started
|
|
132
|
+
- **Be patient**: Everyone has different levels of experience
|
|
133
|
+
|
|
134
|
+
## Contact
|
|
135
|
+
|
|
136
|
+
For questions about this Code of Conduct or to report violations:
|
|
137
|
+
|
|
138
|
+
- **Email**: arman.avanesyan@yahoo.com
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Use Python 3.12 and uv for development; Python 3.10–3.14 are compatibility targets.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
uv sync --frozen --extra redis --python 3.12
|
|
7
|
+
uv run --no-sync ruff check .
|
|
8
|
+
uv run --no-sync ruff format --check .
|
|
9
|
+
uv run --no-sync pyright
|
|
10
|
+
uv run --no-sync pytest
|
|
11
|
+
uv run --no-sync mkdocs build --strict
|
|
12
|
+
uv build
|
|
13
|
+
uv run --no-sync twine check dist/*
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
To require real Redis tests, set `AIOGRAM_COORDINATION_REDIS_URL` to a disposable
|
|
17
|
+
server and `AIOGRAM_COORDINATION_REQUIRE_REDIS=1`. Tests isolate lock prefixes and
|
|
18
|
+
never flush a database. Never use a production URL. Required real-server coverage
|
|
19
|
+
is at least 80%; ownership and failure assertions may not be skipped to reach it.
|
|
20
|
+
|
|
21
|
+
Runtime lives in src/, tests in tests/, runnable examples in examples/, user and
|
|
22
|
+
release docs in docs/, repository automation in tools/, maintained evidence in
|
|
23
|
+
reports/ and changelog fragments in CHANGES/. Use feature/bugfix/doc/removal/misc
|
|
24
|
+
rst fragments. Generated security/coverage JSON belongs in ignored output or CI
|
|
25
|
+
artifacts. Do not commit credentials, environments or generated distributions.
|
|
26
|
+
|
|
27
|
+
Preserve optional Redis and the absence of Idle/Nav/Kit imports. Describe changes,
|
|
28
|
+
validation and compatibility impact in PRs. Follow CODE_OF_CONDUCT.md and report
|
|
29
|
+
security concerns through SECURITY.md. Publication is a separate authorized action.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aiogram-idle contributors
|
|
4
|
+
Copyright (c) 2026 aiogram-coordination contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: aiogram-coordination
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Task-scoped ownership, renewable coordination and session authority contracts for aiogram
|
|
5
|
+
Project-URL: Homepage, https://github.com/ArmanAvanesyan/aiogram-coordination
|
|
6
|
+
Project-URL: Repository, https://github.com/ArmanAvanesyan/aiogram-coordination
|
|
7
|
+
Project-URL: Issues, https://github.com/ArmanAvanesyan/aiogram-coordination/issues
|
|
8
|
+
Author: aiogram-coordination contributors
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Framework :: AsyncIO
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: aiogram<4,>=3.22
|
|
21
|
+
Provides-Extra: redis
|
|
22
|
+
Requires-Dist: redis<8,>=5.0.8; extra == 'redis'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# aiogram-coordination
|
|
26
|
+
|
|
27
|
+
Shared task-scoped ownership for aiogram applications and independent libraries.
|
|
28
|
+
The package has no dependency on aiogram-idle, aiogram-nav or aiogram-kit.
|
|
29
|
+
|
|
30
|
+
Initial alpha version: 0.1.0. Requires Python 3.10+ and aiogram 3.22–3.x.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
pip install aiogram-coordination==0.1.0
|
|
34
|
+
# Optional renewable Redis coordination:
|
|
35
|
+
pip install 'aiogram-coordination[redis]==0.1.0'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Memory coordination
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from aiogram_coordination import CoordinationKey, MemoryCoordinator
|
|
42
|
+
|
|
43
|
+
coordinator = MemoryCoordinator()
|
|
44
|
+
key = CoordinationKey("bot", bot_id=123, chat_id=42, user_id=42)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
async def protected_operation():
|
|
48
|
+
async with coordinator.hold(key):
|
|
49
|
+
scope = coordinator.scope_token(key)
|
|
50
|
+
assert scope is not None
|
|
51
|
+
# Invoke application code only while this task owns the scope.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Memory scopes serialize one process and one event loop. A child task does not
|
|
55
|
+
inherit reentrant ownership. Identical structural conversation keys from
|
|
56
|
+
independent libraries normalize to one full identity; arbitrary generic Hashable
|
|
57
|
+
keys remain supported by the memory coordinator.
|
|
58
|
+
|
|
59
|
+
## Existing application FSM isolation
|
|
60
|
+
|
|
61
|
+
Wrap isolation explicitly when constructing the Dispatcher, not after startup:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from aiogram import Dispatcher
|
|
65
|
+
from aiogram.fsm.storage.memory import SimpleEventIsolation
|
|
66
|
+
from aiogram_coordination import TrackedEventIsolation
|
|
67
|
+
|
|
68
|
+
application_isolation = SimpleEventIsolation()
|
|
69
|
+
tracked = TrackedEventIsolation(application_isolation)
|
|
70
|
+
dispatcher = Dispatcher(events_isolation=tracked)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
A custom application isolation requires an explicit `IsolationProvider` tied to
|
|
74
|
+
the exact same instance. It must return a key-bound, live `LeaseHandle` and signal
|
|
75
|
+
loss. Unknown opaque locks, disabled isolation and unsupported proof are rejected.
|
|
76
|
+
[Custom isolation](docs/isolation.md) includes the contract and Redis reference.
|
|
77
|
+
|
|
78
|
+
## Redis reference
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from aiogram_coordination import RenewableRedisEventIsolation, TrackedEventIsolation
|
|
82
|
+
|
|
83
|
+
# application_redis is an existing redis.asyncio client owned by your app.
|
|
84
|
+
application_isolation = RenewableRedisEventIsolation(redis=application_redis)
|
|
85
|
+
tracked = TrackedEventIsolation(application_isolation)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This explicit renewable provider exposes ownership; it does not pretend to renew
|
|
89
|
+
an opaque aiogram RedisEventIsolation lock. It reuses the caller's Redis client
|
|
90
|
+
and public aiogram key builder. Client closure remains application-owned.
|
|
91
|
+
|
|
92
|
+
Use `RedisCoordinator(redis=application_redis, prefix="application")` for fenced
|
|
93
|
+
conversation storage coordination. Its default lease/renew/wait/poll/I/O limits
|
|
94
|
+
are 30/10/30/0.05/5 seconds. Lost leases revoke effect authority and cancel owners.
|
|
95
|
+
A Lua storage transaction must check the returned fence token and positive PTTL;
|
|
96
|
+
a local ownership check cannot make an external API transactional.
|
|
97
|
+
|
|
98
|
+
## External sessions
|
|
99
|
+
|
|
100
|
+
`SessionAuthority.current(key)` returns an immutable `ExternalSession` or `None`.
|
|
101
|
+
It reads only; it never creates, extends or clears application sessions. Outages
|
|
102
|
+
raise `SessionAuthorityUnavailable` and are distinct from missing authorization.
|
|
103
|
+
[Session rules](docs/sessions.md) separate immutable absolute lifetime from a
|
|
104
|
+
sliding application inactivity deadline.
|
|
105
|
+
|
|
106
|
+
## Compatibility and verification
|
|
107
|
+
|
|
108
|
+
| Component | Supported / CI targets |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| Python | 3.10–3.14 |
|
|
111
|
+
| aiogram | 3.22 minimum and latest resolvable 3.x |
|
|
112
|
+
| Redis client | 5.0.8 minimum and latest below 8, optional |
|
|
113
|
+
| Redis server | 7+ single writable primary; CI uses real Redis 7 and 8 |
|
|
114
|
+
| Base install | Neither Redis nor Idle/Nav/Kit is required |
|
|
115
|
+
|
|
116
|
+
CI exercises installed wheels/sdists, task isolation, real Redis renewal/loss and
|
|
117
|
+
process death. [Verification evidence](reports/verification.md) distinguishes
|
|
118
|
+
executed checks from configured jobs. [CONTRIBUTING.md](CONTRIBUTING.md) documents
|
|
119
|
+
commands, [SECURITY.md](SECURITY.md) reporting and [release guidance](docs/releasing.md)
|
|
120
|
+
the explicit tag-only publication procedure. Nothing configures logging globally
|
|
121
|
+
on import. The CLI example enables only scoped development debug logging.
|
|
122
|
+
|
|
123
|
+
MIT licensed; see [LICENSE](LICENSE).
|