websocket-rs 0.3.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.
- websocket_rs-0.3.0/.github/pull_request_template.md +44 -0
- websocket_rs-0.3.0/.github/workflows/pr.yml +112 -0
- websocket_rs-0.3.0/.github/workflows/release.yml +110 -0
- websocket_rs-0.3.0/.github/workflows/test.yml +70 -0
- websocket_rs-0.3.0/.gitignore +45 -0
- websocket_rs-0.3.0/API.md +505 -0
- websocket_rs-0.3.0/CONTRIBUTING.md +208 -0
- websocket_rs-0.3.0/Cargo.lock +1104 -0
- websocket_rs-0.3.0/Cargo.toml +40 -0
- websocket_rs-0.3.0/LICENSE +21 -0
- websocket_rs-0.3.0/Makefile +68 -0
- websocket_rs-0.3.0/PKG-INFO +445 -0
- websocket_rs-0.3.0/PUBLISHING.md +218 -0
- websocket_rs-0.3.0/README.md +401 -0
- websocket_rs-0.3.0/README.zh-TW.md +398 -0
- websocket_rs-0.3.0/examples/test_monkeypatch.py +210 -0
- websocket_rs-0.3.0/pyproject.toml +95 -0
- websocket_rs-0.3.0/pytest.ini +3 -0
- websocket_rs-0.3.0/python/websocket_rs/__init__.py +4 -0
- websocket_rs-0.3.0/scripts/pre-check.sh +202 -0
- websocket_rs-0.3.0/scripts/prepare-release.sh +109 -0
- websocket_rs-0.3.0/scripts/tag-release.sh +77 -0
- websocket_rs-0.3.0/scripts/test.sh +52 -0
- websocket_rs-0.3.0/src/async_client.rs +836 -0
- websocket_rs-0.3.0/src/lib.rs +38 -0
- websocket_rs-0.3.0/src/sync_client.rs +372 -0
- websocket_rs-0.3.0/tests/benchmark_server_timestamp.py +685 -0
- websocket_rs-0.3.0/tests/test_compatibility.py +236 -0
- websocket_rs-0.3.0/uv.lock +521 -0
- websocket_rs-0.3.0/websocket_rs/__init__.py +29 -0
- websocket_rs-0.3.0/websocket_rs/auto_patch.py +220 -0
- websocket_rs-0.3.0/websocket_rs/patch.py +311 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
<!-- Provide a brief description of the changes in this PR -->
|
|
3
|
+
|
|
4
|
+
## Type of Change
|
|
5
|
+
<!-- Mark the relevant option with an "x" -->
|
|
6
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
7
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
8
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
9
|
+
- [ ] Performance improvement
|
|
10
|
+
- [ ] Documentation update
|
|
11
|
+
- [ ] Code refactoring
|
|
12
|
+
|
|
13
|
+
## Changes Made
|
|
14
|
+
<!-- List the specific changes made in this PR -->
|
|
15
|
+
-
|
|
16
|
+
-
|
|
17
|
+
-
|
|
18
|
+
|
|
19
|
+
## Performance Impact
|
|
20
|
+
<!-- If applicable, describe any performance improvements or impacts -->
|
|
21
|
+
|
|
22
|
+
## Testing
|
|
23
|
+
<!-- Describe the tests you ran to verify your changes -->
|
|
24
|
+
- [ ] All existing tests pass
|
|
25
|
+
- [ ] Added new tests for new functionality
|
|
26
|
+
- [ ] Tested on Python 3.12
|
|
27
|
+
- [ ] Tested on Python 3.13
|
|
28
|
+
- [ ] Tested on Python 3.14
|
|
29
|
+
|
|
30
|
+
## Checklist
|
|
31
|
+
<!-- Mark completed items with an "x" -->
|
|
32
|
+
- [ ] My code follows the project's style guidelines
|
|
33
|
+
- [ ] I have performed a self-review of my own code
|
|
34
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
35
|
+
- [ ] I have made corresponding changes to the documentation
|
|
36
|
+
- [ ] My changes generate no new warnings
|
|
37
|
+
- [ ] Version number updated (if needed for release)
|
|
38
|
+
|
|
39
|
+
## Related Issues
|
|
40
|
+
<!-- Link any related issues here -->
|
|
41
|
+
Closes #
|
|
42
|
+
|
|
43
|
+
## Additional Notes
|
|
44
|
+
<!-- Any additional information that reviewers should know -->
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
name: Pull Request
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened]
|
|
6
|
+
branches: [main, develop]
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- '**.md'
|
|
9
|
+
- 'docs/**'
|
|
10
|
+
- 'LICENSE'
|
|
11
|
+
- '.github/workflows/**'
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
lint:
|
|
15
|
+
name: Lint
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install Rust
|
|
21
|
+
uses: dtolnay/rust-toolchain@stable
|
|
22
|
+
with:
|
|
23
|
+
components: rustfmt, clippy
|
|
24
|
+
|
|
25
|
+
- name: Check formatting
|
|
26
|
+
run: cargo fmt -- --check
|
|
27
|
+
|
|
28
|
+
- name: Run clippy
|
|
29
|
+
run: cargo clippy -- -D warnings
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
|
33
|
+
runs-on: ${{ matrix.os }}
|
|
34
|
+
strategy:
|
|
35
|
+
matrix:
|
|
36
|
+
os: [ubuntu-latest]
|
|
37
|
+
python-version: ['3.12', '3.13']
|
|
38
|
+
fail-fast: false
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Set up Python
|
|
44
|
+
uses: actions/setup-python@v5
|
|
45
|
+
with:
|
|
46
|
+
python-version: ${{ matrix.python-version }}
|
|
47
|
+
|
|
48
|
+
- name: Install Rust
|
|
49
|
+
uses: dtolnay/rust-toolchain@stable
|
|
50
|
+
|
|
51
|
+
- name: Cache Rust
|
|
52
|
+
uses: Swatinem/rust-cache@v2
|
|
53
|
+
|
|
54
|
+
- name: Install uv
|
|
55
|
+
uses: astral-sh/setup-uv@v3
|
|
56
|
+
with:
|
|
57
|
+
enable-cache: true
|
|
58
|
+
cache-dependency-glob: |
|
|
59
|
+
**/pyproject.toml
|
|
60
|
+
**/Cargo.toml
|
|
61
|
+
|
|
62
|
+
- name: Set up Python with uv
|
|
63
|
+
run: |
|
|
64
|
+
uv python install ${{ matrix.python-version }}
|
|
65
|
+
uv venv --python ${{ matrix.python-version }}
|
|
66
|
+
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
|
|
67
|
+
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
|
68
|
+
|
|
69
|
+
- name: Install dependencies with uv
|
|
70
|
+
run: uv pip install maturin pytest websockets
|
|
71
|
+
|
|
72
|
+
- name: Build
|
|
73
|
+
run: maturin develop --release
|
|
74
|
+
|
|
75
|
+
- name: Run tests
|
|
76
|
+
run: python tests/test_compatibility.py
|
|
77
|
+
|
|
78
|
+
build:
|
|
79
|
+
name: Build wheels
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v4
|
|
83
|
+
|
|
84
|
+
- name: Set up Python
|
|
85
|
+
uses: actions/setup-python@v5
|
|
86
|
+
with:
|
|
87
|
+
python-version: '3.12'
|
|
88
|
+
|
|
89
|
+
- name: Install Rust
|
|
90
|
+
uses: dtolnay/rust-toolchain@stable
|
|
91
|
+
|
|
92
|
+
- name: Install uv
|
|
93
|
+
uses: astral-sh/setup-uv@v3
|
|
94
|
+
with:
|
|
95
|
+
enable-cache: true
|
|
96
|
+
|
|
97
|
+
- name: Set up build environment
|
|
98
|
+
run: |
|
|
99
|
+
uv python install 3.12
|
|
100
|
+
uv venv --python 3.12
|
|
101
|
+
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
|
|
102
|
+
echo "$PWD/.venv/bin" >> $GITHUB_PATH
|
|
103
|
+
uv pip install maturin
|
|
104
|
+
|
|
105
|
+
- name: Build wheel
|
|
106
|
+
run: maturin build --release
|
|
107
|
+
|
|
108
|
+
- name: Upload wheel
|
|
109
|
+
uses: actions/upload-artifact@v4
|
|
110
|
+
with:
|
|
111
|
+
name: wheel-ubuntu
|
|
112
|
+
path: target/wheels/*.whl
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-wheels:
|
|
13
|
+
name: Build wheels on ${{ matrix.os }}
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: '3.12'
|
|
26
|
+
|
|
27
|
+
- name: Install Rust
|
|
28
|
+
uses: dtolnay/rust-toolchain@stable
|
|
29
|
+
|
|
30
|
+
- name: Install uv
|
|
31
|
+
uses: astral-sh/setup-uv@v3
|
|
32
|
+
with:
|
|
33
|
+
enable-cache: true
|
|
34
|
+
cache-dependency-glob: |
|
|
35
|
+
**/pyproject.toml
|
|
36
|
+
**/Cargo.toml
|
|
37
|
+
|
|
38
|
+
- name: Set up Python with uv
|
|
39
|
+
run: |
|
|
40
|
+
uv python install 3.12
|
|
41
|
+
uv venv --python 3.12
|
|
42
|
+
|
|
43
|
+
- name: Build wheels
|
|
44
|
+
run: |
|
|
45
|
+
uv pip install maturin
|
|
46
|
+
uv run maturin build --release --out dist
|
|
47
|
+
|
|
48
|
+
- name: Upload wheels
|
|
49
|
+
uses: actions/upload-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: wheels-${{ matrix.os }}
|
|
52
|
+
path: dist/*.whl
|
|
53
|
+
|
|
54
|
+
build-sdist:
|
|
55
|
+
name: Build source distribution
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@v4
|
|
59
|
+
|
|
60
|
+
- name: Install Rust
|
|
61
|
+
uses: dtolnay/rust-toolchain@stable
|
|
62
|
+
|
|
63
|
+
- name: Install uv
|
|
64
|
+
uses: astral-sh/setup-uv@v3
|
|
65
|
+
|
|
66
|
+
- name: Install maturin with uv
|
|
67
|
+
run: |
|
|
68
|
+
uv venv
|
|
69
|
+
source .venv/bin/activate
|
|
70
|
+
uv pip install maturin
|
|
71
|
+
|
|
72
|
+
- name: Build sdist
|
|
73
|
+
run: |
|
|
74
|
+
source .venv/bin/activate
|
|
75
|
+
maturin sdist --out dist
|
|
76
|
+
|
|
77
|
+
- name: Upload sdist
|
|
78
|
+
uses: actions/upload-artifact@v4
|
|
79
|
+
with:
|
|
80
|
+
name: sdist
|
|
81
|
+
path: dist/*.tar.gz
|
|
82
|
+
|
|
83
|
+
release:
|
|
84
|
+
name: Release
|
|
85
|
+
needs: [build-wheels, build-sdist]
|
|
86
|
+
runs-on: ubuntu-latest
|
|
87
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
88
|
+
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@v4
|
|
91
|
+
|
|
92
|
+
- name: Download artifacts
|
|
93
|
+
uses: actions/download-artifact@v4
|
|
94
|
+
with:
|
|
95
|
+
path: dist
|
|
96
|
+
merge-multiple: true
|
|
97
|
+
|
|
98
|
+
- name: Create GitHub Release
|
|
99
|
+
uses: softprops/action-gh-release@v1
|
|
100
|
+
with:
|
|
101
|
+
files: dist/*
|
|
102
|
+
draft: false
|
|
103
|
+
prerelease: false
|
|
104
|
+
generate_release_notes: true
|
|
105
|
+
|
|
106
|
+
- name: Publish to PyPI
|
|
107
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
108
|
+
with:
|
|
109
|
+
password: ${{ secrets.PYPI_TOKEN }}
|
|
110
|
+
skip-existing: true
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
paths-ignore:
|
|
7
|
+
- '**.md'
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
- 'LICENSE'
|
|
10
|
+
- '.github/workflows/**'
|
|
11
|
+
pull_request:
|
|
12
|
+
branches: [ main ]
|
|
13
|
+
paths-ignore:
|
|
14
|
+
- '**.md'
|
|
15
|
+
- 'docs/**'
|
|
16
|
+
- 'LICENSE'
|
|
17
|
+
- '.github/workflows/**'
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
test:
|
|
21
|
+
name: Test on ${{ matrix.os }}
|
|
22
|
+
runs-on: ${{ matrix.os }}
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
26
|
+
python-version: ['3.12', '3.13', '3.14']
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: Set up Python
|
|
32
|
+
uses: actions/setup-python@v5
|
|
33
|
+
with:
|
|
34
|
+
python-version: ${{ matrix.python-version }}
|
|
35
|
+
|
|
36
|
+
- name: Install Rust
|
|
37
|
+
uses: dtolnay/rust-toolchain@stable
|
|
38
|
+
with:
|
|
39
|
+
components: rustfmt, clippy
|
|
40
|
+
|
|
41
|
+
- name: Cache Rust
|
|
42
|
+
uses: Swatinem/rust-cache@v2
|
|
43
|
+
|
|
44
|
+
- name: Install uv
|
|
45
|
+
uses: astral-sh/setup-uv@v3
|
|
46
|
+
with:
|
|
47
|
+
enable-cache: true
|
|
48
|
+
cache-dependency-glob: |
|
|
49
|
+
**/pyproject.toml
|
|
50
|
+
**/Cargo.toml
|
|
51
|
+
|
|
52
|
+
- name: Set up Python with uv
|
|
53
|
+
run: |
|
|
54
|
+
uv python install ${{ matrix.python-version }}
|
|
55
|
+
uv venv --python ${{ matrix.python-version }}
|
|
56
|
+
|
|
57
|
+
- name: Install dependencies with uv
|
|
58
|
+
run: uv pip install maturin pytest websockets
|
|
59
|
+
|
|
60
|
+
- name: Build
|
|
61
|
+
run: uv run maturin develop --release
|
|
62
|
+
|
|
63
|
+
- name: Run tests
|
|
64
|
+
run: uv run python tests/test_compatibility.py
|
|
65
|
+
|
|
66
|
+
- name: Run clippy
|
|
67
|
+
run: cargo clippy -- -D warnings
|
|
68
|
+
|
|
69
|
+
- name: Run rustfmt
|
|
70
|
+
run: cargo fmt -- --check
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Rust
|
|
2
|
+
/target
|
|
3
|
+
**/*.rs.bk
|
|
4
|
+
Cargo.lock
|
|
5
|
+
|
|
6
|
+
# Python
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.py[cod]
|
|
9
|
+
*$py.class
|
|
10
|
+
*.so
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
# Virtual Environment
|
|
29
|
+
.env
|
|
30
|
+
.venv
|
|
31
|
+
env/
|
|
32
|
+
venv/
|
|
33
|
+
ENV/
|
|
34
|
+
|
|
35
|
+
# IDE
|
|
36
|
+
.idea/
|
|
37
|
+
.vscode/
|
|
38
|
+
*.swp
|
|
39
|
+
*.swo
|
|
40
|
+
|
|
41
|
+
# OS specific
|
|
42
|
+
.DS_Store
|
|
43
|
+
Thumbs.db
|
|
44
|
+
*.log
|
|
45
|
+
*.json
|