Skip to content

Commit 5ad0b68

Browse files
committed
init
0 parents  commit 5ad0b68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+9598
-0
lines changed

.github/workflows/benchmark.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Benchmark
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
benchmark:
9+
name: Benchmark
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
cache: 'pip'
20+
21+
- name: Install dependencies
22+
run: |
23+
sudo apt-get update && sudo apt-get install -y cmake ninja-build libssl-dev
24+
chmod +x scripts/setup_vendors.sh
25+
./scripts/setup_vendors.sh
26+
pip install -e ".[dev,benchmark]"
27+
28+
- name: Run benchmarks
29+
run: pytest benchmarks/ --benchmark-only --benchmark-json=benchmark.json
30+
31+
- name: Store benchmark
32+
uses: benchmark-action/github-action-benchmark@v1
33+
with:
34+
tool: 'pytest'
35+
output-file-path: benchmark.json
36+
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
auto-push: true

.github/workflows/release.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
test:
9+
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
python-version: ['3.9', '3.10', '3.11', '3.12']
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: recursive
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
cache: 'pip'
27+
28+
- name: Install system dependencies (Linux)
29+
if: runner.os == 'Linux'
30+
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build libssl-dev
31+
32+
- name: Install system dependencies (macOS)
33+
if: runner.os == 'macOS'
34+
run: brew install cmake ninja
35+
36+
- name: Install system dependencies (Windows)
37+
if: runner.os == 'Windows'
38+
run: choco install cmake -y
39+
40+
- name: Setup MSVC (Windows)
41+
if: runner.os == 'Windows'
42+
uses: microsoft/setup-msbuild@v2
43+
44+
- name: Setup vendor dependencies
45+
run: |
46+
chmod +x scripts/setup_vendors.sh
47+
./scripts/setup_vendors.sh
48+
shell: bash
49+
50+
- name: Install package
51+
run: pip install -e ".[dev]"
52+
53+
- name: Lint
54+
run: ruff check src/ tests/
55+
56+
- name: Run tests
57+
run: pytest tests/ -v --cov=httpmorph --cov-report=xml
58+
59+
build-wheels:
60+
name: Build Wheels (${{ matrix.os }})
61+
needs: test
62+
runs-on: ${{ matrix.os }}
63+
strategy:
64+
matrix:
65+
os: [ubuntu-latest, macos-latest, windows-latest]
66+
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
submodules: recursive
71+
72+
- name: Build wheels
73+
uses: pypa/cibuildwheel@v2.16.2
74+
env:
75+
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
76+
CIBW_SKIP: "*-musllinux_*"
77+
CIBW_BEFORE_ALL_LINUX: apt-get update && apt-get install -y cmake ninja-build libssl-dev
78+
CIBW_BEFORE_ALL_MACOS: brew install cmake ninja
79+
80+
- uses: actions/upload-artifact@v4
81+
with:
82+
name: wheels-${{ matrix.os }}
83+
path: ./wheelhouse/*.whl
84+
85+
publish:
86+
name: Publish Release
87+
needs: build-wheels
88+
runs-on: ubuntu-latest
89+
90+
steps:
91+
- uses: actions/checkout@v4
92+
93+
- name: Download wheels
94+
uses: actions/download-artifact@v4
95+
with:
96+
path: dist/
97+
98+
- name: Flatten wheels
99+
run: |
100+
mkdir -p wheels
101+
find dist/ -name "*.whl" -exec cp {} wheels/ \;
102+
ls -lh wheels/
103+
104+
- name: Create GitHub Release
105+
uses: softprops/action-gh-release@v1
106+
with:
107+
files: wheels/*.whl
108+
generate_release_notes: true
109+
env:
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
112+
- name: Publish to PyPI
113+
if: env.PYPI_API_TOKEN != ''
114+
env:
115+
TWINE_USERNAME: __token__
116+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
117+
run: |
118+
pip install twine
119+
twine upload wheels/*.whl --skip-existing

.github/workflows/test.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
test:
11+
name: Test (${{ matrix.os }}, Python ${{ matrix.python-version }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
python-version: ['3.9', '3.10', '3.11', '3.12']
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
submodules: recursive
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
cache: 'pip'
29+
30+
- name: Install system dependencies (Linux)
31+
if: runner.os == 'Linux'
32+
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build libssl-dev
33+
34+
- name: Install system dependencies (macOS)
35+
if: runner.os == 'macOS'
36+
run: brew install cmake ninja
37+
38+
- name: Install system dependencies (Windows)
39+
if: runner.os == 'Windows'
40+
run: choco install cmake -y
41+
42+
- name: Setup MSVC (Windows)
43+
if: runner.os == 'Windows'
44+
uses: microsoft/setup-msbuild@v2
45+
46+
- name: Setup vendor dependencies
47+
run: |
48+
chmod +x scripts/setup_vendors.sh
49+
./scripts/setup_vendors.sh
50+
shell: bash
51+
52+
- name: Install package
53+
run: pip install -e ".[dev]"
54+
55+
- name: Lint
56+
run: ruff check src/ tests/
57+
58+
- name: Run tests
59+
run: pytest tests/ -v --cov=httpmorph --cov-report=xml
60+
61+
- name: Upload coverage
62+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
63+
uses: codecov/codecov-action@v4
64+
with:
65+
file: ./coverage.xml

.gitignore

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
*.egg
7+
*.egg-info/
8+
dist/
9+
build/
10+
.eggs/
11+
*.whl
12+
.Python
13+
pip-log.txt
14+
pip-delete-this-directory.txt
15+
16+
# Cython generated files (only in bindings directory)
17+
src/bindings/*.c
18+
src/bindings/*.html
19+
_httpmorph.cpp
20+
21+
# C/C++
22+
*.o
23+
*.a
24+
*.dylib
25+
*.out
26+
*.app
27+
*.i*86
28+
*.x86_64
29+
*.hex
30+
31+
# IDEs
32+
.vscode/
33+
.idea/
34+
*.swp
35+
*.swo
36+
*~
37+
.DS_Store
38+
39+
# Testing
40+
.pytest_cache/
41+
.coverage
42+
htmlcov/
43+
.tox/
44+
.mypy_cache/
45+
.dmypy.json
46+
dmypy.json
47+
48+
# Documentation
49+
docs/_build/
50+
51+
# Virtual environments
52+
venv/
53+
env/
54+
ENV/
55+
.venv
56+
.venv/
57+
58+
# uv
59+
.uv/
60+
uv.lock
61+
62+
# Vendor dependencies (downloaded by scripts/setup_vendors.sh)
63+
vendor/
64+
65+
# Benchmarks
66+
benchmarks/results/
67+
*.prof
68+
69+
# Environment variables
70+
.env
71+
examples/.env

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11

.ruff.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Ruff configuration for httpmorph
2+
# This file provides IDE-friendly ruff settings
3+
4+
line-length = 100
5+
target-version = "py38"
6+
fix = true
7+
8+
# Exclude vendor directory
9+
exclude = [
10+
"vendor/",
11+
".venv/",
12+
"build/",
13+
"dist/",
14+
]
15+
16+
[lint]
17+
select = [
18+
"E", # pycodestyle errors
19+
"W", # pycodestyle warnings
20+
"F", # pyflakes
21+
"I", # isort
22+
"B", # flake8-bugbear
23+
"C4", # flake8-comprehensions
24+
"UP", # pyupgrade
25+
]
26+
ignore = [
27+
"E501", # line too long (handled by formatter)
28+
"B008", # function calls in argument defaults
29+
"C901", # too complex
30+
]
31+
32+
[format]
33+
quote-style = "double"
34+
indent-style = "space"
35+
skip-magic-trailing-comma = false
36+
line-ending = "auto"
37+
38+
[lint.per-file-ignores]
39+
"tests/*" = ["B", "F401", "F811"] # Allow unused imports and redefinitions in tests
40+
"benchmarks/*" = ["B"]

.ruffignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Ruff ignore patterns
2+
3+
# Third-party dependencies
4+
vendor/
5+
6+
# Build artifacts
7+
build/
8+
dist/
9+
*.egg-info/
10+
__pycache__/
11+
*.pyc
12+
*.pyo
13+
14+
# Virtual environments
15+
.venv/
16+
venv/
17+
env/
18+
19+
# Compiled C extensions
20+
*.so
21+
*.pyd
22+
*.dll
23+
24+
# IDE
25+
.vscode/
26+
.idea/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Arman
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)