bitongue 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.
- bitongue-0.1.0/.github/workflows/docs.yml +60 -0
- bitongue-0.1.0/.github/workflows/pypub.yml +68 -0
- bitongue-0.1.0/.github/workflows/pytest.yml +70 -0
- bitongue-0.1.0/.github/workflows/release.yml +39 -0
- bitongue-0.1.0/.gitignore +231 -0
- bitongue-0.1.0/.pre-commit-config.yaml +34 -0
- bitongue-0.1.0/.python-version +1 -0
- bitongue-0.1.0/CHANGELOG.md +0 -0
- bitongue-0.1.0/CONTRIBUTING.md +141 -0
- bitongue-0.1.0/CONTRIBUTING_en.md +118 -0
- bitongue-0.1.0/LICENSE +663 -0
- bitongue-0.1.0/Makefile +462 -0
- bitongue-0.1.0/PKG-INFO +221 -0
- bitongue-0.1.0/README.md +196 -0
- bitongue-0.1.0/README_en.md +179 -0
- bitongue-0.1.0/docs/api.rst +129 -0
- bitongue-0.1.0/docs/conf.py +58 -0
- bitongue-0.1.0/docs/en/api.rst +129 -0
- bitongue-0.1.0/docs/en/conf.py +53 -0
- bitongue-0.1.0/docs/en/guide/architecture.md +81 -0
- bitongue-0.1.0/docs/en/guide/concepts.md +171 -0
- bitongue-0.1.0/docs/en/guide/configuration.md +120 -0
- bitongue-0.1.0/docs/en/guide/quickstart.md +190 -0
- bitongue-0.1.0/docs/en/index.md +26 -0
- bitongue-0.1.0/docs/guide/architecture.md +81 -0
- bitongue-0.1.0/docs/guide/concepts.md +141 -0
- bitongue-0.1.0/docs/guide/configuration.md +112 -0
- bitongue-0.1.0/docs/guide/quickstart.md +180 -0
- bitongue-0.1.0/docs/index.md +32 -0
- bitongue-0.1.0/pyproject.toml +290 -0
- bitongue-0.1.0/src/bitongue/__init__.py +0 -0
- bitongue-0.1.0/src/bitongue/base/__init__.py +15 -0
- bitongue-0.1.0/src/bitongue/base/exceptions.py +28 -0
- bitongue-0.1.0/src/bitongue/base/schemas.py +100 -0
- bitongue-0.1.0/src/bitongue/client/__init__.py +9 -0
- bitongue-0.1.0/src/bitongue/client/client.py +190 -0
- bitongue-0.1.0/src/bitongue/client/config.py +13 -0
- bitongue-0.1.0/src/bitongue/client/exceptions.py +7 -0
- bitongue-0.1.0/src/bitongue/filter/__init__.py +10 -0
- bitongue-0.1.0/src/bitongue/filter/keywords.py +80 -0
- bitongue-0.1.0/src/bitongue/filter/neuro/__init__.py +9 -0
- bitongue-0.1.0/src/bitongue/filter/neuro/filter.py +203 -0
- bitongue-0.1.0/src/bitongue/filter/neuro/policy.py +28 -0
- bitongue-0.1.0/src/bitongue/filter/neuro/provider.py +38 -0
- bitongue-0.1.0/src/bitongue/filter/protocols.py +50 -0
- bitongue-0.1.0/src/bitongue/filter/sparse/__init__.py +15 -0
- bitongue-0.1.0/src/bitongue/filter/sparse/bm25.py +379 -0
- bitongue-0.1.0/src/bitongue/filter/sparse/filter.py +248 -0
- bitongue-0.1.0/src/bitongue/filter/sparse/policy.py +109 -0
- bitongue-0.1.0/src/bitongue/filter/sparse/stemmer.py +3 -0
- bitongue-0.1.0/src/bitongue/filter/sparse/tokenizer.py +34 -0
- bitongue-0.1.0/src/bitongue/filter/utils/__init__.py +3 -0
- bitongue-0.1.0/src/bitongue/filter/utils/normalizer.py +39 -0
- bitongue-0.1.0/src/bitongue/flow/__init__.py +16 -0
- bitongue-0.1.0/src/bitongue/flow/exceptions.py +26 -0
- bitongue-0.1.0/src/bitongue/flow/flowing.py +146 -0
- bitongue-0.1.0/src/bitongue/flow/message.py +48 -0
- bitongue-0.1.0/src/bitongue/handler/__init__.py +7 -0
- bitongue-0.1.0/src/bitongue/handler/protocols.py +31 -0
- bitongue-0.1.0/src/bitongue/handler/result.py +21 -0
- bitongue-0.1.0/src/bitongue/py.typed +0 -0
- bitongue-0.1.0/test_integration/__init__.py +0 -0
- bitongue-0.1.0/test_integration/conftest.py +147 -0
- bitongue-0.1.0/test_integration/test_client.py +64 -0
- bitongue-0.1.0/test_integration/test_neuro_filter.py +78 -0
- bitongue-0.1.0/test_integration/test_sparse_filter.py +177 -0
- bitongue-0.1.0/tests/__init__.py +0 -0
- bitongue-0.1.0/tests/base/test_exceptions.py +21 -0
- bitongue-0.1.0/tests/base/test_schemas.py +75 -0
- bitongue-0.1.0/tests/client/conftest.py +135 -0
- bitongue-0.1.0/tests/client/test_client.py +370 -0
- bitongue-0.1.0/tests/client/test_exceptions.py +11 -0
- bitongue-0.1.0/tests/conftest.py +41 -0
- bitongue-0.1.0/tests/filter/conftest.py +20 -0
- bitongue-0.1.0/tests/filter/neuro/conftest.py +66 -0
- bitongue-0.1.0/tests/filter/neuro/test_filter.py +325 -0
- bitongue-0.1.0/tests/filter/neuro/test_policy.py +46 -0
- bitongue-0.1.0/tests/filter/neuro/test_provider.py +34 -0
- bitongue-0.1.0/tests/filter/sparse/conftest.py +47 -0
- bitongue-0.1.0/tests/filter/sparse/test_bm25.py +176 -0
- bitongue-0.1.0/tests/filter/sparse/test_filter.py +284 -0
- bitongue-0.1.0/tests/filter/sparse/test_policy.py +68 -0
- bitongue-0.1.0/tests/filter/sparse/test_tokenizer.py +22 -0
- bitongue-0.1.0/tests/filter/test_keywords.py +90 -0
- bitongue-0.1.0/tests/filter/test_root_imports.py +55 -0
- bitongue-0.1.0/tests/filter/utils/test_normalizer.py +29 -0
- bitongue-0.1.0/tests/flow/test_exceptions.py +21 -0
- bitongue-0.1.0/tests/flow/test_flowing.py +156 -0
- bitongue-0.1.0/tests/flow/test_message.py +48 -0
- bitongue-0.1.0/tests/handler/test_result.py +27 -0
- bitongue-0.1.0/uv.lock +3182 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- 'docs/**'
|
|
8
|
+
- 'src/**'
|
|
9
|
+
- 'pyproject.toml'
|
|
10
|
+
- 'uv.lock'
|
|
11
|
+
- 'Makefile'
|
|
12
|
+
- '.github/workflows/docs.yml'
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
pages: write
|
|
18
|
+
id-token: write
|
|
19
|
+
|
|
20
|
+
concurrency:
|
|
21
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
22
|
+
cancel-in-progress: false
|
|
23
|
+
|
|
24
|
+
jobs:
|
|
25
|
+
build:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: Install uv
|
|
32
|
+
uses: astral-sh/setup-uv@v6
|
|
33
|
+
with:
|
|
34
|
+
python-version: "3.12"
|
|
35
|
+
|
|
36
|
+
- name: Sync dependencies
|
|
37
|
+
run: uv sync --no-default-groups --group docs
|
|
38
|
+
|
|
39
|
+
- name: Build documentation
|
|
40
|
+
run: make docs-build
|
|
41
|
+
env:
|
|
42
|
+
DOCS_ROOT_URL: https://ahsen17.github.io/bitongue
|
|
43
|
+
|
|
44
|
+
- name: Upload Pages artifact
|
|
45
|
+
uses: actions/upload-pages-artifact@v3
|
|
46
|
+
with:
|
|
47
|
+
path: docs/_build/html
|
|
48
|
+
|
|
49
|
+
deploy:
|
|
50
|
+
needs: build
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
|
|
53
|
+
environment:
|
|
54
|
+
name: github-pages
|
|
55
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
56
|
+
|
|
57
|
+
steps:
|
|
58
|
+
- name: Deploy to GitHub Pages
|
|
59
|
+
id: deployment
|
|
60
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# This workflow will upload a Python Package to PyPI when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
|
3
|
+
|
|
4
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
5
|
+
# They are provided by a third-party and are governed by
|
|
6
|
+
# separate terms of service, privacy policy, and support
|
|
7
|
+
# documentation.
|
|
8
|
+
|
|
9
|
+
name: Upload PYPI
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release-build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- name: Install uv
|
|
26
|
+
uses: astral-sh/setup-uv@v6
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
|
|
30
|
+
- name: Build release distributions
|
|
31
|
+
run: uv build
|
|
32
|
+
|
|
33
|
+
- name: Upload distributions
|
|
34
|
+
uses: actions/upload-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: release-dists
|
|
37
|
+
path: dist/
|
|
38
|
+
|
|
39
|
+
pypi-publish:
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
needs:
|
|
42
|
+
- release-build
|
|
43
|
+
permissions:
|
|
44
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
45
|
+
id-token: write
|
|
46
|
+
|
|
47
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
48
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
49
|
+
environment:
|
|
50
|
+
name: pypi
|
|
51
|
+
# The PyPI project URL, shown in the deployment status:
|
|
52
|
+
url: https://pypi.org/p/bitongue
|
|
53
|
+
#
|
|
54
|
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
|
|
55
|
+
# ALTERNATIVE: exactly, uncomment the following line instead:
|
|
56
|
+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
|
|
57
|
+
|
|
58
|
+
steps:
|
|
59
|
+
- name: Retrieve release distributions
|
|
60
|
+
uses: actions/download-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
name: release-dists
|
|
63
|
+
path: dist/
|
|
64
|
+
|
|
65
|
+
- name: Publish release distributions to PyPI
|
|
66
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
67
|
+
with:
|
|
68
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
changes:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
outputs:
|
|
12
|
+
code: ${{ steps.filter.outputs.code }}
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Detect code changes
|
|
17
|
+
uses: dorny/paths-filter@v3
|
|
18
|
+
id: filter
|
|
19
|
+
with:
|
|
20
|
+
filters: |
|
|
21
|
+
code:
|
|
22
|
+
- 'src/**'
|
|
23
|
+
- 'tests/**'
|
|
24
|
+
- 'test_integration/**'
|
|
25
|
+
- 'pyproject.toml'
|
|
26
|
+
- 'uv.lock'
|
|
27
|
+
- 'Makefile'
|
|
28
|
+
- '.pre-commit-config.yaml'
|
|
29
|
+
- '.github/workflows/pytest.yml'
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
needs: changes
|
|
33
|
+
if: needs.changes.outputs.code == 'true'
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
|
|
36
|
+
services:
|
|
37
|
+
redis:
|
|
38
|
+
image: redis:7.4-alpine
|
|
39
|
+
ports:
|
|
40
|
+
- 6379:6379
|
|
41
|
+
options: >-
|
|
42
|
+
--health-cmd "redis-cli ping"
|
|
43
|
+
--health-interval 10s
|
|
44
|
+
--health-timeout 5s
|
|
45
|
+
--health-retries 5
|
|
46
|
+
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
- name: Install uv
|
|
51
|
+
uses: astral-sh/setup-uv@v6
|
|
52
|
+
with:
|
|
53
|
+
python-version: "3.12"
|
|
54
|
+
|
|
55
|
+
- name: Sync dependencies
|
|
56
|
+
run: uv sync --dev --all-extras
|
|
57
|
+
|
|
58
|
+
- name: Lint
|
|
59
|
+
run: |
|
|
60
|
+
uv run ruff check src tests test_integration
|
|
61
|
+
uv run ruff format --check src tests test_integration
|
|
62
|
+
|
|
63
|
+
- name: Type check
|
|
64
|
+
run: uv run mypy
|
|
65
|
+
|
|
66
|
+
- name: Unit tests
|
|
67
|
+
run: uv run pytest tests --cov -n auto
|
|
68
|
+
|
|
69
|
+
- name: Integration tests
|
|
70
|
+
run: uv run pytest test_integration -m integration
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
draft-release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Sync dependencies
|
|
26
|
+
run: uv sync --dev
|
|
27
|
+
|
|
28
|
+
- name: Build distributions
|
|
29
|
+
run: uv build
|
|
30
|
+
|
|
31
|
+
- name: Generate release notes
|
|
32
|
+
run: uv run git-cliff --latest --strip header > RELEASE_NOTES.md
|
|
33
|
+
|
|
34
|
+
- name: Create draft release
|
|
35
|
+
uses: softprops/action-gh-release@v2
|
|
36
|
+
with:
|
|
37
|
+
draft: true
|
|
38
|
+
body_path: RELEASE_NOTES.md
|
|
39
|
+
files: dist/*
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Configuration files
|
|
10
|
+
# *.ini
|
|
11
|
+
*.env
|
|
12
|
+
config.yaml
|
|
13
|
+
config.yml
|
|
14
|
+
config.toml
|
|
15
|
+
config.json
|
|
16
|
+
settings.*.json
|
|
17
|
+
|
|
18
|
+
# Temp files
|
|
19
|
+
*.log
|
|
20
|
+
tmp/
|
|
21
|
+
.runtime/
|
|
22
|
+
|
|
23
|
+
# Ai coding
|
|
24
|
+
.codex/
|
|
25
|
+
.agents/
|
|
26
|
+
.claude/
|
|
27
|
+
.cursor/
|
|
28
|
+
CLAUDE.md
|
|
29
|
+
AGENTS.md
|
|
30
|
+
|
|
31
|
+
# Distribution / packaging
|
|
32
|
+
.Python
|
|
33
|
+
build/
|
|
34
|
+
develop-eggs/
|
|
35
|
+
dist/
|
|
36
|
+
downloads/
|
|
37
|
+
eggs/
|
|
38
|
+
.eggs/
|
|
39
|
+
lib64/
|
|
40
|
+
parts/
|
|
41
|
+
sdist/
|
|
42
|
+
var/
|
|
43
|
+
wheels/
|
|
44
|
+
share/python-wheels/
|
|
45
|
+
*.egg-info/
|
|
46
|
+
.installed.cfg
|
|
47
|
+
*.egg
|
|
48
|
+
MANIFEST
|
|
49
|
+
|
|
50
|
+
# PyInstaller
|
|
51
|
+
# Usually these files are written by a python script from a template
|
|
52
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
53
|
+
*.manifest
|
|
54
|
+
*.spec
|
|
55
|
+
|
|
56
|
+
# Installer logs
|
|
57
|
+
pip-log.txt
|
|
58
|
+
pip-delete-this-directory.txt
|
|
59
|
+
|
|
60
|
+
# Unit test / coverage reports
|
|
61
|
+
htmlcov/
|
|
62
|
+
.tox/
|
|
63
|
+
.nox/
|
|
64
|
+
.coverage
|
|
65
|
+
.coverage.*
|
|
66
|
+
.cache
|
|
67
|
+
nosetests.xml
|
|
68
|
+
coverage.xml
|
|
69
|
+
*.cover
|
|
70
|
+
*.py.cover
|
|
71
|
+
.hypothesis/
|
|
72
|
+
.pytest_cache/
|
|
73
|
+
cover/
|
|
74
|
+
|
|
75
|
+
# Translations
|
|
76
|
+
*.mo
|
|
77
|
+
*.pot
|
|
78
|
+
|
|
79
|
+
# Django stuff:
|
|
80
|
+
*.log
|
|
81
|
+
local_settings.py
|
|
82
|
+
db.sqlite3
|
|
83
|
+
db.sqlite3-journal
|
|
84
|
+
|
|
85
|
+
# Flask stuff:
|
|
86
|
+
instance/
|
|
87
|
+
.webassets-cache
|
|
88
|
+
|
|
89
|
+
# Scrapy stuff:
|
|
90
|
+
.scrapy
|
|
91
|
+
|
|
92
|
+
# Sphinx documentation
|
|
93
|
+
docs/_build/
|
|
94
|
+
|
|
95
|
+
# PyBuilder
|
|
96
|
+
.pybuilder/
|
|
97
|
+
target/
|
|
98
|
+
|
|
99
|
+
# Jupyter Notebook
|
|
100
|
+
.ipynb_checkpoints
|
|
101
|
+
|
|
102
|
+
# VS Code settings
|
|
103
|
+
.vscode/
|
|
104
|
+
|
|
105
|
+
# IPython
|
|
106
|
+
profile_default/
|
|
107
|
+
ipython_config.py
|
|
108
|
+
|
|
109
|
+
# pyenv
|
|
110
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
111
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
112
|
+
# .python-version
|
|
113
|
+
|
|
114
|
+
# pipenv
|
|
115
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
116
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
117
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
118
|
+
# install all needed dependencies.
|
|
119
|
+
#Pipfile.lock
|
|
120
|
+
|
|
121
|
+
# UV
|
|
122
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
123
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
124
|
+
# commonly ignored for libraries.
|
|
125
|
+
#uv.lock
|
|
126
|
+
|
|
127
|
+
# poetry
|
|
128
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
129
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
130
|
+
# commonly ignored for libraries.
|
|
131
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
132
|
+
#poetry.lock
|
|
133
|
+
#poetry.toml
|
|
134
|
+
|
|
135
|
+
# pdm
|
|
136
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
137
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
138
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
139
|
+
#pdm.lock
|
|
140
|
+
#pdm.toml
|
|
141
|
+
.pdm-python
|
|
142
|
+
.pdm-build/
|
|
143
|
+
|
|
144
|
+
# pixi
|
|
145
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
146
|
+
#pixi.lock
|
|
147
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
148
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
149
|
+
.pixi
|
|
150
|
+
|
|
151
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
152
|
+
__pypackages__/
|
|
153
|
+
|
|
154
|
+
# Celery stuff
|
|
155
|
+
celerybeat-schedule
|
|
156
|
+
celerybeat.pid
|
|
157
|
+
|
|
158
|
+
# SageMath parsed files
|
|
159
|
+
*.sage.py
|
|
160
|
+
|
|
161
|
+
# Environments
|
|
162
|
+
.env
|
|
163
|
+
.envrc
|
|
164
|
+
.venv
|
|
165
|
+
env/
|
|
166
|
+
venv/
|
|
167
|
+
ENV/
|
|
168
|
+
env.bak/
|
|
169
|
+
venv.bak/
|
|
170
|
+
|
|
171
|
+
# Spyder project settings
|
|
172
|
+
.spyderproject
|
|
173
|
+
.spyproject
|
|
174
|
+
|
|
175
|
+
# Rope project settings
|
|
176
|
+
.ropeproject
|
|
177
|
+
|
|
178
|
+
# mkdocs documentation
|
|
179
|
+
/site
|
|
180
|
+
|
|
181
|
+
# mypy
|
|
182
|
+
.mypy_cache/
|
|
183
|
+
.dmypy.json
|
|
184
|
+
dmypy.json
|
|
185
|
+
|
|
186
|
+
# Pyre type checker
|
|
187
|
+
.pyre/
|
|
188
|
+
|
|
189
|
+
# pytype static type analyzer
|
|
190
|
+
.pytype/
|
|
191
|
+
|
|
192
|
+
# Cython debug symbols
|
|
193
|
+
cython_debug/
|
|
194
|
+
|
|
195
|
+
# PyCharm
|
|
196
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
197
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
198
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
199
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
200
|
+
#.idea/
|
|
201
|
+
|
|
202
|
+
# Abstra
|
|
203
|
+
# Abstra is an AI-powered process automation framework.
|
|
204
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
205
|
+
# Learn more at https://abstra.io/docs
|
|
206
|
+
.abstra/
|
|
207
|
+
|
|
208
|
+
# Visual Studio Code
|
|
209
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
210
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
211
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
212
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
213
|
+
# .vscode/
|
|
214
|
+
|
|
215
|
+
# Ruff stuff:
|
|
216
|
+
.ruff_cache/
|
|
217
|
+
|
|
218
|
+
# PyPI configuration file
|
|
219
|
+
.pypirc
|
|
220
|
+
|
|
221
|
+
# Cursor
|
|
222
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
223
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
224
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
225
|
+
.cursorignore
|
|
226
|
+
.cursorindexingignore
|
|
227
|
+
|
|
228
|
+
# Marimo
|
|
229
|
+
marimo/_static/
|
|
230
|
+
marimo/_lsp/
|
|
231
|
+
__marimo__/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
default_language_version:
|
|
2
|
+
python: "3"
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
5
|
+
rev: v4.2.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: conventional-pre-commit
|
|
8
|
+
stages: [commit-msg]
|
|
9
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
10
|
+
rev: v5.0.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: check-ast
|
|
13
|
+
- id: check-case-conflict
|
|
14
|
+
- id: check-toml
|
|
15
|
+
- id: end-of-file-fixer
|
|
16
|
+
- id: mixed-line-ending
|
|
17
|
+
- id: trailing-whitespace
|
|
18
|
+
- repo: https://github.com/provinzkraut/unasyncd
|
|
19
|
+
rev: "v0.8.1"
|
|
20
|
+
hooks:
|
|
21
|
+
- id: unasyncd
|
|
22
|
+
additional_dependencies: ["ruff"]
|
|
23
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
24
|
+
rev: "v0.17.0"
|
|
25
|
+
hooks:
|
|
26
|
+
- id: ruff
|
|
27
|
+
args: ["--fix"]
|
|
28
|
+
types_or: [python, pyi]
|
|
29
|
+
- id: ruff-format
|
|
30
|
+
types_or: [python, pyi]
|
|
31
|
+
- repo: https://github.com/sphinx-contrib/sphinx-lint
|
|
32
|
+
rev: "v1.0.0"
|
|
33
|
+
hooks:
|
|
34
|
+
- id: sphinx-lint
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
File without changes
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# 贡献指南
|
|
2
|
+
|
|
3
|
+
[中文] **·** [English](CONTRIBUTING_en.md)
|
|
4
|
+
|
|
5
|
+
感谢关注 Bitongue!本文档说明如何搭建开发环境、项目约定,以及提交贡献的完整流程。
|
|
6
|
+
|
|
7
|
+
## 目录
|
|
8
|
+
|
|
9
|
+
[AI 协助政策](#ai-协助政策) **·** [开发环境](#开发环境) **·** [代码约定](#代码约定) **·** [贡献流程](#贡献流程) **·** [提交规范](#提交规范) **·** [测试要求](#测试要求) **·** [发布流程](#发布流程维护者) **·** [文档](#文档) **·** [行为准则](#行为准则)
|
|
10
|
+
|
|
11
|
+
## AI 协助政策
|
|
12
|
+
|
|
13
|
+
**本项目接受 AI 协助开发的代码。** 但请注意:
|
|
14
|
+
|
|
15
|
+
- 你(提交者)必须**认真审查**提交的每一行代码,无论它由你本人还是 AI 协助编写;
|
|
16
|
+
- AI 协助的代码与本人编写的代码**承担同等责任**——正确性、安全性、许可证合规
|
|
17
|
+
均由提交者负责;
|
|
18
|
+
- 提交即视为你完全理解并认可该变更,"这是 AI 写的"不构成缺陷的免责理由。
|
|
19
|
+
|
|
20
|
+
## 开发环境
|
|
21
|
+
|
|
22
|
+
本项目使用 [uv](https://docs.astral.sh/uv/) 管理依赖,要求 Python ≥ 3.12,
|
|
23
|
+
GNU Make 驱动日常命令(Makefile 已做跨平台适配)。
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git clone git@github.com:Ahsen17/bitongue.git
|
|
27
|
+
cd bitongue
|
|
28
|
+
make install # 创建虚拟环境并安装依赖
|
|
29
|
+
make check # lint + 类型检查 + 全部测试
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
常用命令:
|
|
33
|
+
|
|
34
|
+
| 命令 | 作用 |
|
|
35
|
+
|-|-|
|
|
36
|
+
| `make sync` | 同步依赖 |
|
|
37
|
+
| `make fix` | ruff 自动修复与格式化 |
|
|
38
|
+
| `make lint` | pre-commit + mypy(strict) |
|
|
39
|
+
| `make pyright` | pyright 类型检查 |
|
|
40
|
+
| `make test` | 单元测试 |
|
|
41
|
+
| `make test-integration` | 集成测试 |
|
|
42
|
+
| `make coverage` | 覆盖率报告(`fail_under = 80`) |
|
|
43
|
+
| `make docs-build` | 构建双语文档站 |
|
|
44
|
+
| `make changelog` | 由 git-cliff 再生成 CHANGELOG.md |
|
|
45
|
+
|
|
46
|
+
## 代码约定
|
|
47
|
+
|
|
48
|
+
- 一切数据结构继承 `bitongue.base.BaseStruct`(msgspec `Struct` 封装),
|
|
49
|
+
不使用 dataclass 或 pydantic;
|
|
50
|
+
- 异步只使用 anyio 原语(`create_memory_object_stream`、`fail_after` 等),
|
|
51
|
+
不直接 import asyncio;
|
|
52
|
+
- 泛型使用 PEP 695 语法(`class Flowing[T: BaseMessage]`);
|
|
53
|
+
- 子包内文件分工固定:`schemas.py`(数据结构)、`protocols.py`(接口 Protocol)、
|
|
54
|
+
`exceptions.py`(异常,均继承 `BitongueError`);`__init__.py` 显式声明
|
|
55
|
+
`__all__` 再导出;
|
|
56
|
+
- 代码风格由 ruff 统一约束:行宽 90、Google 风格 docstring 约定、
|
|
57
|
+
规则组见 `pyproject.toml` 的 `[tool.ruff.lint]`;
|
|
58
|
+
- 类型检查执行 mypy strict 与 pyright 双重标准,两者都必须通过。
|
|
59
|
+
|
|
60
|
+
## 贡献流程
|
|
61
|
+
|
|
62
|
+
本项目采用 **fork & pull** 模式,请勿直接向主仓库推送分支:
|
|
63
|
+
|
|
64
|
+
1. 在 [Issues](https://github.com/Ahsen17/bitongue/issues) 中认领或提出问题;
|
|
65
|
+
2. 在 GitHub 上 fork `Ahsen17/bitongue`,克隆你的 fork 并从 `main`
|
|
66
|
+
创建特性分支,如 `feat/flowing-metrics`、`fix/expiry-drift`、`docs/quickstart`;
|
|
67
|
+
3. 开发并补充测试(见下方[测试要求](#测试要求));涉及用户可见改动时,
|
|
68
|
+
同步更新 README(中文 / English)与 `docs/`(中文)、`docs/en/`(英文)两份文档站;
|
|
69
|
+
4. 确保本地 `make check` 通过;
|
|
70
|
+
5. 推送分支到你的 fork,提交 Pull Request 到 `Ahsen17/bitongue` 的 `main`;
|
|
71
|
+
6. PR 描述请说明:改了什么、为什么改、如何验证。CI(`pytest.yml`)必须全绿。
|
|
72
|
+
|
|
73
|
+
## 提交规范
|
|
74
|
+
|
|
75
|
+
提交信息遵循
|
|
76
|
+
[Conventional Commits](https://www.conventionalcommits.org/zh-hans/):
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
<类型>(<范围>?): <描述>
|
|
80
|
+
|
|
81
|
+
<正文?>
|
|
82
|
+
|
|
83
|
+
<脚注?>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
常用类型:`feat`、`fix`、`refactor`、`doc`、`perf`、`style`、`test`、`build`、
|
|
87
|
+
`chore`、`revert`。commit-msg 钩子会强制校验格式。
|
|
88
|
+
|
|
89
|
+
CHANGELOG.md 由 [git-cliff](https://git-cliff.org) 依据提交历史自动生成
|
|
90
|
+
(`make changelog`),**原则上禁止手动编辑**。
|
|
91
|
+
|
|
92
|
+
## 测试要求
|
|
93
|
+
|
|
94
|
+
- 测试目录镜像源码结构:`src/bitongue/flow/flowing.py` → `tests/flow/test_flowing.py`;
|
|
95
|
+
- 一个测试文件只测一个模块;
|
|
96
|
+
- 通用 fixture 位于 `tests/conftest.py`,子模块 fixture 位于对应子树的
|
|
97
|
+
`conftest.py`;
|
|
98
|
+
- 用例统一组织为 `class TestXX`;
|
|
99
|
+
- pytest 为 asyncio auto 模式,测试直接写 `async def`;
|
|
100
|
+
- 外部依赖策略:单测使用 fakexx(如 fakeredis),无 fakexx 包的依赖用 async
|
|
101
|
+
mock;集成测试(`test_integration/`,标记 `integration`)使用真实服务;
|
|
102
|
+
- 集成测试连接 qdrant 时,通过环境变量 `BITONGUE_TEST_QDRANT_URL`(完整 URL)
|
|
103
|
+
或 `BITONGUE_TEST_QDRANT_HOST` / `BITONGUE_TEST_QDRANT_PORT`(默认
|
|
104
|
+
`localhost:6333`)指定目标;服务不可达时用例自动 skip 而非失败;
|
|
105
|
+
- 新增功能必须附带测试,覆盖率不得低于 80%。
|
|
106
|
+
|
|
107
|
+
## 发布流程(维护者)
|
|
108
|
+
|
|
109
|
+
版本号遵循 [SemVer 2.0.0](https://semver.org/lang/zh-Hans/),tag 一律带 `v` 前缀:
|
|
110
|
+
|
|
111
|
+
- **正式版本**:`x.y.z`,如 `v1.2.0`;
|
|
112
|
+
- **非正式版本(beta)**:`x.y.z-beta.N`,如 `v1.2.0-beta.1`;`N` 从 1 开始,
|
|
113
|
+
在同一 `x.y.z` 序列内顺延。
|
|
114
|
+
|
|
115
|
+
发布时序:
|
|
116
|
+
|
|
117
|
+
1. 在 pyproject 中更新 `version`,提交
|
|
118
|
+
`chore(release): prepare for vX.Y.Z` 并合入 `main`
|
|
119
|
+
(git-cliff 会跳过该提交,不进 CHANGELOG);
|
|
120
|
+
2. 在 main 上打 tag 并推送:`git tag vX.Y.Z && git push origin vX.Y.Z`;
|
|
121
|
+
3. `release.yml` 自动创建 **draft** release,附带该版本 notes(git-cliff 生成)
|
|
122
|
+
与 sdist/wheel 产物;
|
|
123
|
+
4. 在本地运行 `make changelog` 再生成 CHANGELOG.md(须在 tag 存在之后运行,
|
|
124
|
+
新版本段落才会出现),以 `doc: update changelog for vX.Y.Z` 提交合入;
|
|
125
|
+
5. 在 GitHub Releases 页面人工调整 draft(标记 pre-release 或正式)后 Publish。
|
|
126
|
+
|
|
127
|
+
## 文档
|
|
128
|
+
|
|
129
|
+
- 文档站构建:`make docs-build`;本地热重载预览:`make docs-serve`
|
|
130
|
+
(同时监视 `src/` 与 `docs/` 变更);
|
|
131
|
+
- 文档为 Sphinx 双语站:`docs/` 为简体中文主站,`docs/en/` 为英文镜像站,
|
|
132
|
+
两站页面文件名一一对应(主题语言切换器依赖该映射);
|
|
133
|
+
- 修改任何面向用户的行为时,请同步更新 README(中文 / English)与文档站对应页面。
|
|
134
|
+
|
|
135
|
+
## 行为准则
|
|
136
|
+
|
|
137
|
+
保持尊重与专业。对事不对人,欢迎新人提问。
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
提交即表示你同意以 [AGPL-3.0](LICENSE) 许可授权你的贡献。
|