cross-web 0.2.3__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.
Files changed (52) hide show
  1. cross_web-0.2.3/.github/workflows/pr.yml +58 -0
  2. cross_web-0.2.3/.github/workflows/release.yml +94 -0
  3. cross_web-0.2.3/.github/workflows/test.yml +147 -0
  4. cross_web-0.2.3/.gitignore +12 -0
  5. cross_web-0.2.3/.pre-commit-config.yaml +38 -0
  6. cross_web-0.2.3/.python-version +1 -0
  7. cross_web-0.2.3/CHANGELOG.md +63 -0
  8. cross_web-0.2.3/LICENSE +22 -0
  9. cross_web-0.2.3/PKG-INFO +32 -0
  10. cross_web-0.2.3/README.md +17 -0
  11. cross_web-0.2.3/noxfile.py +227 -0
  12. cross_web-0.2.3/pyproject.toml +108 -0
  13. cross_web-0.2.3/src/cross/__init__.py +36 -0
  14. cross_web-0.2.3/src/cross/exceptions.py +8 -0
  15. cross_web-0.2.3/src/cross/protocols.py +20 -0
  16. cross_web-0.2.3/src/cross/py.typed +0 -0
  17. cross_web-0.2.3/src/cross/request/__init__.py +123 -0
  18. cross_web-0.2.3/src/cross/request/_aiohttp.py +111 -0
  19. cross_web-0.2.3/src/cross/request/_base.py +148 -0
  20. cross_web-0.2.3/src/cross/request/_chalice.py +88 -0
  21. cross_web-0.2.3/src/cross/request/_django.py +103 -0
  22. cross_web-0.2.3/src/cross/request/_flask.py +99 -0
  23. cross_web-0.2.3/src/cross/request/_litestar.py +51 -0
  24. cross_web-0.2.3/src/cross/request/_quart.py +45 -0
  25. cross_web-0.2.3/src/cross/request/_sanic.py +83 -0
  26. cross_web-0.2.3/src/cross/request/_starlette.py +58 -0
  27. cross_web-0.2.3/src/cross/request/_testing.py +64 -0
  28. cross_web-0.2.3/src/cross/response.py +82 -0
  29. cross_web-0.2.3/tests/conftest.py +0 -0
  30. cross_web-0.2.3/tests/request/django_urls.py +3 -0
  31. cross_web-0.2.3/tests/request/test_aiohttp.py +165 -0
  32. cross_web-0.2.3/tests/request/test_async_http_request.py +234 -0
  33. cross_web-0.2.3/tests/request/test_base.py +44 -0
  34. cross_web-0.2.3/tests/request/test_chalice.py +166 -0
  35. cross_web-0.2.3/tests/request/test_coverage_lines.py +87 -0
  36. cross_web-0.2.3/tests/request/test_django.py +160 -0
  37. cross_web-0.2.3/tests/request/test_flask.py +122 -0
  38. cross_web-0.2.3/tests/request/test_litestar.py +72 -0
  39. cross_web-0.2.3/tests/request/test_litestar_extended.py +76 -0
  40. cross_web-0.2.3/tests/request/test_quart.py +85 -0
  41. cross_web-0.2.3/tests/request/test_sanic.py +94 -0
  42. cross_web-0.2.3/tests/request/test_sanic_coverage.py +31 -0
  43. cross_web-0.2.3/tests/request/test_starlette.py +91 -0
  44. cross_web-0.2.3/tests/request/test_starlette_extended.py +82 -0
  45. cross_web-0.2.3/tests/request/test_testing.py +96 -0
  46. cross_web-0.2.3/tests/response/__init__py +0 -0
  47. cross_web-0.2.3/tests/response/test_fastapi.py +35 -0
  48. cross_web-0.2.3/tests/response/test_response.py +23 -0
  49. cross_web-0.2.3/tests/response/test_response_extended.py +119 -0
  50. cross_web-0.2.3/tests/response/test_response_to_fastapi.py +124 -0
  51. cross_web-0.2.3/tests/test_exceptions.py +40 -0
  52. cross_web-0.2.3/uv.lock +2522 -0
@@ -0,0 +1,58 @@
1
+ name: AutoPub PR Workflow
2
+
3
+ on:
4
+ pull_request_target:
5
+ branches: [main]
6
+
7
+ permissions:
8
+ pull-requests: write
9
+
10
+ jobs:
11
+ check-release:
12
+ runs-on: ubuntu-latest
13
+ outputs:
14
+ has_release: ${{ steps.check.outputs.has_release }}
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ ref: "refs/pull/${{ github.event.number }}/merge"
20
+ sparse-checkout: |
21
+ RELEASE.md
22
+ pyproject.toml
23
+ sparse-checkout-cone-mode: false
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v6
27
+
28
+ - name: Check
29
+ id: check
30
+ run: |
31
+ if uvx --from autopub==1.0.0a48 --with pygithub autopub check; then
32
+ echo "has_release=true" >> $GITHUB_OUTPUT
33
+ else
34
+ echo "has_release=false" >> $GITHUB_OUTPUT
35
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
36
+ exit 1
37
+ fi
38
+ fi
39
+ env:
40
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+
42
+ - name: Upload .autopub
43
+ if: steps.check.outputs.has_release == 'true'
44
+ run: |
45
+ if [ -d ".autopub" ]; then
46
+ echo "Found .autopub directory"
47
+ else
48
+ echo "No .autopub directory found"
49
+ exit 1
50
+ fi
51
+
52
+ - name: Upload .autopub artifact
53
+ if: steps.check.outputs.has_release == 'true'
54
+ uses: actions/upload-artifact@v4
55
+ with:
56
+ name: autopub-data
57
+ path: .autopub
58
+ include-hidden-files: true
@@ -0,0 +1,94 @@
1
+ name: AutoPub Release Workflow
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ permissions:
8
+ contents: write
9
+ id-token: write
10
+ issues: write
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ check-release:
15
+ runs-on: ubuntu-latest
16
+ outputs:
17
+ has_release: ${{ steps.check.outputs.has_release }}
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v6
24
+
25
+ - name: Check
26
+ id: check
27
+ run: |
28
+ if uvx --from autopub==1.0.0a48 --with pygithub autopub check; then
29
+ echo "has_release=true" >> $GITHUB_OUTPUT
30
+ else
31
+ echo "has_release=false" >> $GITHUB_OUTPUT
32
+ if [ "${{ github.event_name }}" = "pull_request" ]; then
33
+ exit 1
34
+ fi
35
+ fi
36
+ env:
37
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+
39
+ - name: Upload .autopub
40
+ if: steps.check.outputs.has_release == 'true'
41
+ run: |
42
+ if [ -d ".autopub" ]; then
43
+ echo "Found .autopub directory"
44
+ else
45
+ echo "No .autopub directory found"
46
+ exit 1
47
+ fi
48
+
49
+ - name: Upload .autopub artifact
50
+ if: steps.check.outputs.has_release == 'true'
51
+ uses: actions/upload-artifact@v4
52
+ with:
53
+ name: autopub-data
54
+ path: .autopub
55
+ include-hidden-files: true
56
+
57
+ - name: Debug Info
58
+ run: |
59
+ echo "GitHub ref: ${{ github.ref }}"
60
+ echo "has_release value: ${{ steps.check.outputs.has_release }}"
61
+
62
+ publish:
63
+ needs: check-release
64
+ if: ${{ github.ref == 'refs/heads/main' && needs.check-release.outputs.has_release == 'true' }}
65
+ runs-on: ubuntu-latest
66
+
67
+ steps:
68
+ - name: Debug Info
69
+ run: |
70
+ echo "GitHub ref: ${{ github.ref }}"
71
+ echo "has_release value: ${{ needs.check-release.outputs.has_release }}"
72
+
73
+ - uses: actions/checkout@v3
74
+
75
+ - name: Install uv
76
+ uses: astral-sh/setup-uv@v5
77
+
78
+ - name: Download .autopub
79
+ uses: actions/download-artifact@v4
80
+ with:
81
+ name: autopub-data
82
+ path: .autopub
83
+
84
+ - name: Build and publish
85
+ run: |
86
+ echo "✨ Preparing..."
87
+ uvx --from autopub==1.0.0a48 --with pygithub autopub prepare
88
+ echo "✨ Building..."
89
+ uvx --from autopub==1.0.0a48 --with pygithub autopub build
90
+ echo "✨ Publishing..."
91
+ uvx --from autopub==1.0.0a48 --with pygithub autopub publish
92
+
93
+ env:
94
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,147 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ generate-jobs:
15
+ name: Generate test matrix
16
+ runs-on: ubuntu-latest
17
+ outputs:
18
+ sessions: ${{ steps.set-matrix.outputs.sessions }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v6
24
+ with:
25
+ enable-cache: true
26
+
27
+ - name: Install Python
28
+ run: uv python install 3.12
29
+
30
+ - name: Install nox
31
+ run: uv tool install nox
32
+
33
+ - name: Generate test matrix
34
+ id: set-matrix
35
+ shell: bash
36
+ run: |
37
+ echo sessions=$(
38
+ uvx nox --json -t tests -l |
39
+ jq 'map(
40
+ {
41
+ session,
42
+ name: "\( .name ) on \( .python )\( if .call_spec != {} then " (\(.call_spec | to_entries | map("\(.key)=\(.value)") | join(", ")))" else "" end )"
43
+ }
44
+ )'
45
+ ) | tee --append $GITHUB_OUTPUT
46
+
47
+ tests:
48
+ name: 🔬 ${{ matrix.session.name }}
49
+ needs: generate-jobs
50
+ runs-on: ${{ matrix.os }}
51
+ strategy:
52
+ fail-fast: false
53
+ matrix:
54
+ os: [ubuntu-latest]
55
+ session: ${{ fromJson(needs.generate-jobs.outputs.sessions) }}
56
+
57
+ steps:
58
+ - uses: actions/checkout@v4
59
+
60
+ - name: Install uv
61
+ uses: astral-sh/setup-uv@v6
62
+ with:
63
+ enable-cache: true
64
+ cache-dependency-glob: "uv.lock"
65
+
66
+ - name: Install Python ${{ matrix.session.python }}
67
+ run: uv python install ${{ matrix.session.python }}
68
+
69
+ - name: Install nox
70
+ run: uv tool install nox
71
+
72
+ - name: Run tests
73
+ run: uvx nox -r -t tests -s "${{ matrix.session.session }}"
74
+ env:
75
+ COVERAGE_FILE: .coverage.${{ matrix.session.session }}.${{ github.run_id }}
76
+
77
+ - name: Generate artifact name
78
+ id: artifact-name
79
+ run: |
80
+ NAME="${{ matrix.session.name }}"
81
+ # Replace spaces with dashes and remove parentheses
82
+ SANITIZED=$(echo "$NAME" | tr ' ' '-' | tr -d '()')
83
+ echo "name=coverage-data-$SANITIZED" >> $GITHUB_OUTPUT
84
+
85
+ - name: Upload coverage data
86
+ uses: actions/upload-artifact@v4
87
+ with:
88
+ name: ${{ steps.artifact-name.outputs.name }}
89
+ path: |
90
+ .coverage
91
+ .coverage.*
92
+ include-hidden-files: true
93
+ if-no-files-found: ignore
94
+
95
+ coverage:
96
+ name: Combine & check coverage
97
+ if: always()
98
+ needs: tests
99
+ runs-on: ubuntu-latest
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+
103
+ - name: Install uv
104
+ uses: astral-sh/setup-uv@v6
105
+ with:
106
+ enable-cache: true
107
+ cache-dependency-glob: "uv.lock"
108
+
109
+ - name: Download coverage data
110
+ uses: actions/download-artifact@v4
111
+ with:
112
+ pattern: coverage-data-*
113
+ merge-multiple: true
114
+
115
+ - name: Install Python
116
+ run: uv python install 3.12
117
+
118
+ - name: Install nox
119
+ run: uv tool install nox
120
+
121
+ - name: Combine coverage & generate report
122
+ run: |
123
+ uvx nox -s coverage -- --ci
124
+
125
+ lint:
126
+ name: Linting
127
+ runs-on: ubuntu-latest
128
+ steps:
129
+ - uses: actions/checkout@v4
130
+
131
+ - name: Install uv
132
+ uses: astral-sh/setup-uv@v6
133
+ with:
134
+ enable-cache: true
135
+ cache-dependency-glob: "uv.lock"
136
+
137
+ - name: Install Python
138
+ run: uv python install 3.12
139
+
140
+ - name: Install nox
141
+ run: uv tool install nox
142
+
143
+ - name: Run lint
144
+ run: uvx nox -s lint
145
+
146
+ - name: Run mypy
147
+ run: uvx nox -s mypy
@@ -0,0 +1,12 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ .coverage
12
+ htmlcov/
@@ -0,0 +1,38 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+ - id: check-json
10
+ - id: check-toml
11
+ - id: check-merge-conflict
12
+ - id: debug-statements
13
+ - id: mixed-line-ending
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.8.5
17
+ hooks:
18
+ - id: ruff
19
+ args: [--fix]
20
+ - id: ruff-format
21
+
22
+ - repo: https://github.com/pre-commit/mirrors-mypy
23
+ rev: v1.17.1
24
+ hooks:
25
+ - id: mypy
26
+ args: [--ignore-missing-imports, --install-types, --non-interactive]
27
+ additional_dependencies:
28
+ [
29
+ pytest-asyncio,
30
+ flask,
31
+ django,
32
+ starlette,
33
+ aiohttp,
34
+ quart,
35
+ chalice,
36
+ litestar,
37
+ sanic,
38
+ ]
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,63 @@
1
+ CHANGELOG
2
+ =========
3
+
4
+ 0.2.3 - 2025-08-11
5
+ ------------------
6
+
7
+ This release adds the MIT license for this project.
8
+
9
+ 0.2.2 - 2025-08-08
10
+ ------------------
11
+
12
+ This release removes Pydantic from the dependencies, since it was not used
13
+
14
+ 0.2.1 - 2025-08-05
15
+ ------------------
16
+
17
+ This release fixes an issue with the AioHTTP integration when handling multipart form data.
18
+
19
+ ## Changes
20
+ - Fixed multipart form data processing in AioHTTP adapter to handle data on-demand instead of requiring pre-processing
21
+ - Added proper support for file uploads in multipart requests
22
+ - Exported `FormData` class from the main package for better type hints
23
+
24
+ 0.2.0 - 2025-08-04
25
+ ------------------
26
+
27
+ This release adds support for multiple new web frameworks and improves the testing infrastructure.
28
+
29
+ ## New Features
30
+
31
+ - Added support for 6 new web frameworks:
32
+ - aiohttp
33
+ - Chalice (AWS)
34
+ - Django
35
+ - Flask
36
+ - Quart
37
+ - Sanic
38
+ - Added comprehensive test coverage for all new framework adapters
39
+ - Added protocols module for better type checking
40
+ - Added custom exceptions module
41
+
42
+ ## Improvements
43
+
44
+ - Enhanced testing infrastructure with noxfile.py for multi-version testing
45
+ - Added pre-commit configuration for code quality
46
+ - Added GitHub Actions workflow for automated testing
47
+ - Improved type checking with dedicated test files
48
+ - Extended test coverage with additional test files for edge cases
49
+
50
+ ## Development
51
+
52
+ - Updated pyproject.toml with new dependencies and configurations
53
+ - Improved project structure with better separation of concerns
54
+
55
+ 0.1.2 - 2025-06-20
56
+ ------------------
57
+
58
+ This release adds a readme file
59
+
60
+ 0.1.1 - 2025-06-20
61
+ ------------------
62
+
63
+ This is a test release
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Patrick Arminio
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.
22
+
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: cross-web
3
+ Version: 0.2.3
4
+ Summary: A library for working with web frameworks
5
+ Author-email: Patrick Arminio <patrick.arminio@gmail.com>
6
+ License-File: LICENSE
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Topic :: Software Development :: Libraries
11
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
12
+ Requires-Python: >=3.9
13
+ Requires-Dist: typing-extensions>=4.14.0
14
+ Description-Content-Type: text/markdown
15
+
16
+ # Cross
17
+
18
+ **Write once, run everywhere** - A universal web framework adapter for Python that lets you write code once and use it across multiple web frameworks.
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ uv add cross-web
24
+ ```
25
+
26
+ ## Overview
27
+
28
+ Cross provides a unified interface for common web framework operations, allowing you to write framework-agnostic code that can be easily adapted to work with FastAPI, Flask, Django, and other popular Python web frameworks.
29
+
30
+ ## Features
31
+
32
+ This project is in early development!
@@ -0,0 +1,17 @@
1
+ # Cross
2
+
3
+ **Write once, run everywhere** - A universal web framework adapter for Python that lets you write code once and use it across multiple web frameworks.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ uv add cross-web
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ Cross provides a unified interface for common web framework operations, allowing you to write framework-agnostic code that can be easily adapted to work with FastAPI, Flask, Django, and other popular Python web frameworks.
14
+
15
+ ## Features
16
+
17
+ This project is in early development!