strawchemy 0.2.8__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 (95) hide show
  1. strawchemy-0.2.8/.editorconfig +11 -0
  2. strawchemy-0.2.8/.github/workflows/bump.yaml +61 -0
  3. strawchemy-0.2.8/.github/workflows/cd.yaml +46 -0
  4. strawchemy-0.2.8/.github/workflows/ci.yaml +186 -0
  5. strawchemy-0.2.8/.github/workflows/codeql.yml +98 -0
  6. strawchemy-0.2.8/.github/workflows/publish.yaml +40 -0
  7. strawchemy-0.2.8/.gitignore +178 -0
  8. strawchemy-0.2.8/.pre-commit-config.yaml +73 -0
  9. strawchemy-0.2.8/.python-version +1 -0
  10. strawchemy-0.2.8/.vscode/settings.json +7 -0
  11. strawchemy-0.2.8/CHANGELOG.md +8 -0
  12. strawchemy-0.2.8/CONTRIBUTING.md +33 -0
  13. strawchemy-0.2.8/LICENCE +21 -0
  14. strawchemy-0.2.8/Makefile +169 -0
  15. strawchemy-0.2.8/PKG-INFO +19 -0
  16. strawchemy-0.2.8/README.md +3 -0
  17. strawchemy-0.2.8/noxfile.py +70 -0
  18. strawchemy-0.2.8/pyproject.toml +274 -0
  19. strawchemy-0.2.8/src/py.typed +0 -0
  20. strawchemy-0.2.8/src/strawchemy/__init__.py +13 -0
  21. strawchemy-0.2.8/src/strawchemy/config.py +29 -0
  22. strawchemy-0.2.8/src/strawchemy/dto/__init__.py +19 -0
  23. strawchemy-0.2.8/src/strawchemy/dto/backend/__init__.py +0 -0
  24. strawchemy-0.2.8/src/strawchemy/dto/backend/dataclass.py +164 -0
  25. strawchemy-0.2.8/src/strawchemy/dto/backend/pydantic.py +147 -0
  26. strawchemy-0.2.8/src/strawchemy/dto/base.py +563 -0
  27. strawchemy-0.2.8/src/strawchemy/dto/constants.py +5 -0
  28. strawchemy-0.2.8/src/strawchemy/dto/exceptions.py +12 -0
  29. strawchemy-0.2.8/src/strawchemy/dto/factories/__init__.py +0 -0
  30. strawchemy-0.2.8/src/strawchemy/dto/factories/pydantic_sqlalchemy.py +15 -0
  31. strawchemy-0.2.8/src/strawchemy/dto/inspectors/__init__.py +0 -0
  32. strawchemy-0.2.8/src/strawchemy/dto/inspectors/sqlalchemy.py +274 -0
  33. strawchemy-0.2.8/src/strawchemy/dto/types.py +125 -0
  34. strawchemy-0.2.8/src/strawchemy/dto/utils.py +71 -0
  35. strawchemy-0.2.8/src/strawchemy/graph.py +438 -0
  36. strawchemy-0.2.8/src/strawchemy/graphql/__init__.py +16 -0
  37. strawchemy-0.2.8/src/strawchemy/graphql/constants.py +24 -0
  38. strawchemy-0.2.8/src/strawchemy/graphql/dto.py +596 -0
  39. strawchemy-0.2.8/src/strawchemy/graphql/factory.py +1281 -0
  40. strawchemy-0.2.8/src/strawchemy/graphql/filters.py +327 -0
  41. strawchemy-0.2.8/src/strawchemy/graphql/inspector.py +21 -0
  42. strawchemy-0.2.8/src/strawchemy/graphql/typing.py +40 -0
  43. strawchemy-0.2.8/src/strawchemy/mapper.py +187 -0
  44. strawchemy-0.2.8/src/strawchemy/pydantic.py +19 -0
  45. strawchemy-0.2.8/src/strawchemy/sqlalchemy/__init__.py +13 -0
  46. strawchemy-0.2.8/src/strawchemy/sqlalchemy/_executor.py +233 -0
  47. strawchemy-0.2.8/src/strawchemy/sqlalchemy/_query.py +343 -0
  48. strawchemy-0.2.8/src/strawchemy/sqlalchemy/_scope.py +478 -0
  49. strawchemy-0.2.8/src/strawchemy/sqlalchemy/_transpiler.py +744 -0
  50. strawchemy-0.2.8/src/strawchemy/sqlalchemy/exceptions.py +12 -0
  51. strawchemy-0.2.8/src/strawchemy/sqlalchemy/filters/__init__.py +29 -0
  52. strawchemy-0.2.8/src/strawchemy/sqlalchemy/filters/base.py +380 -0
  53. strawchemy-0.2.8/src/strawchemy/sqlalchemy/filters/geo.py +53 -0
  54. strawchemy-0.2.8/src/strawchemy/sqlalchemy/hook.py +62 -0
  55. strawchemy-0.2.8/src/strawchemy/sqlalchemy/inspector.py +86 -0
  56. strawchemy-0.2.8/src/strawchemy/sqlalchemy/repository/__init__.py +7 -0
  57. strawchemy-0.2.8/src/strawchemy/sqlalchemy/repository/_async.py +102 -0
  58. strawchemy-0.2.8/src/strawchemy/sqlalchemy/repository/_base.py +68 -0
  59. strawchemy-0.2.8/src/strawchemy/sqlalchemy/repository/_sync.py +104 -0
  60. strawchemy-0.2.8/src/strawchemy/sqlalchemy/typing.py +68 -0
  61. strawchemy-0.2.8/src/strawchemy/strawberry/__init__.py +7 -0
  62. strawchemy-0.2.8/src/strawchemy/strawberry/_field.py +369 -0
  63. strawchemy-0.2.8/src/strawchemy/strawberry/_instance.py +27 -0
  64. strawchemy-0.2.8/src/strawchemy/strawberry/_registry.py +221 -0
  65. strawchemy-0.2.8/src/strawchemy/strawberry/_utils.py +75 -0
  66. strawchemy-0.2.8/src/strawchemy/strawberry/exceptions.py +6 -0
  67. strawchemy-0.2.8/src/strawchemy/strawberry/factory.py +882 -0
  68. strawchemy-0.2.8/src/strawchemy/strawberry/inspector.py +73 -0
  69. strawchemy-0.2.8/src/strawchemy/strawberry/pydantic.py +396 -0
  70. strawchemy-0.2.8/src/strawchemy/strawberry/repository/__init__.py +6 -0
  71. strawchemy-0.2.8/src/strawchemy/strawberry/repository/_async.py +264 -0
  72. strawchemy-0.2.8/src/strawchemy/strawberry/repository/_node.py +114 -0
  73. strawchemy-0.2.8/src/strawchemy/strawberry/repository/_sync.py +273 -0
  74. strawchemy-0.2.8/src/strawchemy/strawberry/typing.py +28 -0
  75. strawchemy-0.2.8/src/strawchemy/testing/__init__.py +0 -0
  76. strawchemy-0.2.8/src/strawchemy/testing/pytest.py +87 -0
  77. strawchemy-0.2.8/src/strawchemy/typing.py +7 -0
  78. strawchemy-0.2.8/src/strawchemy/utils.py +49 -0
  79. strawchemy-0.2.8/tests/__init__.py +0 -0
  80. strawchemy-0.2.8/tests/models.py +122 -0
  81. strawchemy-0.2.8/tests/unit/__init__.py +0 -0
  82. strawchemy-0.2.8/tests/unit/schemas/__init__.py +0 -0
  83. strawchemy-0.2.8/tests/unit/schemas/all_fields.py +18 -0
  84. strawchemy-0.2.8/tests/unit/schemas/all_fields_override.py +18 -0
  85. strawchemy-0.2.8/tests/unit/schemas/custom_resolver.py +32 -0
  86. strawchemy-0.2.8/tests/unit/schemas/exclude_and_override_field.py +19 -0
  87. strawchemy-0.2.8/tests/unit/schemas/exclude_and_override_type.py +18 -0
  88. strawchemy-0.2.8/tests/unit/schemas/exclude_explicit.py +18 -0
  89. strawchemy-0.2.8/tests/unit/schemas/exclude_non_existent.py +18 -0
  90. strawchemy-0.2.8/tests/unit/schemas/include_explicit.py +18 -0
  91. strawchemy-0.2.8/tests/unit/schemas/include_non_existent.py +18 -0
  92. strawchemy-0.2.8/tests/unit/schemas/list_resolver.py +29 -0
  93. strawchemy-0.2.8/tests/unit/schemas/primary_key_resolver.py +29 -0
  94. strawchemy-0.2.8/tests/unit/test_types.py +735 -0
  95. strawchemy-0.2.8/uv.lock +966 -0
@@ -0,0 +1,11 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+
7
+ [*.py]
8
+ indent_size = 4
9
+ trim_trailing_whitespace = true
10
+ max_line_length = 120
11
+ insert_final_newline = true
@@ -0,0 +1,61 @@
1
+ name: ⏫ Bump the version
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ releaseType:
7
+ description: "What kind of release is this?"
8
+ required: false
9
+ default: "auto"
10
+ type: choice
11
+ options:
12
+ - "auto"
13
+ - "major"
14
+ - "minor"
15
+ - "patch"
16
+
17
+ jobs:
18
+ bump-version:
19
+ permissions:
20
+ contents: write
21
+ name: Bump version
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Checkout repository
25
+ uses: actions/checkout@v4
26
+ with:
27
+ fetch-depth: 0
28
+
29
+ - name: Set up git-cliff
30
+ uses: kenji-miyake/setup-git-cliff@v2
31
+
32
+ - name: Get next version
33
+ if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.releaseType == 'auto' }}
34
+ id: git-cliff
35
+ run: |
36
+ echo "version=$(git cliff --unreleased --bumped-version)" >> $GITHUB_OUTPUT
37
+
38
+ - name: Auto version bump
39
+ if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.releaseType == 'auto' }}
40
+ id: auto-version-bump
41
+ uses: callowayproject/bump-my-version@master
42
+ env:
43
+ BUMPVERSION_TAG: "true"
44
+ with:
45
+ args: --new-version=${{ steps.git-cliff.outputs.version }}
46
+ github-token: ${{ secrets.PAT }}
47
+
48
+ - name: Manual version bump
49
+ if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.releaseType != 'auto' }}
50
+ id: manual-version-bump
51
+ uses: callowayproject/bump-my-version@master
52
+ env:
53
+ BUMPVERSION_TAG: "true"
54
+ with:
55
+ args: ${{ inputs.bump-type }}
56
+ github-token: ${{ secrets.PAT }}
57
+
58
+ - name: Check
59
+ if: steps.bump.outputs.bumped == 'true'
60
+ run: |
61
+ echo "Version was bumped from ${{ steps.bump.outputs.previous-version }} to ${{ steps.bump.outputs.current-version }}!"
@@ -0,0 +1,46 @@
1
+ name: 🚀 Continuous Deployment
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ images:
7
+ description: Generate changelog and create Github release
8
+
9
+ jobs:
10
+ changelog:
11
+ name: Publish and release
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Generate changelog
22
+ uses: orhun/git-cliff-action@v4
23
+ id: git-cliff
24
+ with:
25
+ config: pyproject.toml
26
+ args: -vv --latest --strip header
27
+ env:
28
+ OUTPUT: CHANGELOG.md
29
+ GITHUB_REPO: ${{ github.repository }}
30
+
31
+ - name: Commit
32
+ run: |
33
+ git checkout main
34
+ git config user.name 'github-actions[bot]'
35
+ git config user.email 'github-actions[bot]@users.noreply.github.com'
36
+ set +e
37
+ git add CHANGELOG.md
38
+ git commit -m "build(doc) update changelog"
39
+ git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git main
40
+
41
+ - name: Create GitHub release
42
+ uses: softprops/action-gh-release@v2
43
+ with:
44
+ body: ${{ steps.git-cliff.outputs.content }}
45
+ generate_release_notes: true
46
+ token: ${{ secrets.PAT }}
@@ -0,0 +1,186 @@
1
+ name: 🔂 Tests and linting
2
+
3
+ env:
4
+ COLUMNS: 120 # Makes the error summary table printed by pytest-pretty much easier to read
5
+
6
+ on:
7
+ push:
8
+ branches: [main, ci/*]
9
+ tags:
10
+ - "v*.*.*"
11
+ pull_request:
12
+ branches: [main]
13
+
14
+ concurrency:
15
+ group: ${{ github.head_ref || github.run_id }}
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ pre:
20
+ runs-on: ubuntu-latest
21
+ # Map a step output to a job output
22
+ outputs:
23
+ should_skip: ${{ steps.skip_check.outputs.should_skip }}
24
+ steps:
25
+ - name: Skip check
26
+ id: skip_check
27
+ uses: fkirc/skip-duplicate-actions@v5
28
+ with:
29
+ concurrent_skipping: "never"
30
+ skip_after_successful_duplicate: "true"
31
+ paths_ignore: '["**/**.md", "**/.vscode/**", "**/.dockerignore", "Makefile"]'
32
+ paths: '["src/**"]'
33
+
34
+ generate-jobs-tests:
35
+ name: 💻 Generate test matrix
36
+ needs: pre
37
+ if: github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true'
38
+ runs-on: ubuntu-latest
39
+ outputs:
40
+ sessions: ${{ steps.set-matrix.outputs.sessions }}
41
+ steps:
42
+ - name: Checkout repository
43
+ uses: actions/checkout@v4
44
+
45
+ - name: Setup nox
46
+ id: setup-nox
47
+ uses: wntrblm/nox@main
48
+
49
+ - name: Generate test matrix
50
+ id: set-matrix
51
+ shell: bash
52
+ run: |
53
+ echo sessions=$(
54
+ nox --json -t tests -l |
55
+ jq 'map(
56
+ {
57
+ session,
58
+ name: "\( .name ) on \( .python )\( if .call_spec != {} then " (\(.call_spec | to_entries | map("\(.key)=\(.value)") | join(", ")))" else "" end )"
59
+ }
60
+ )'
61
+ ) | tee --append $GITHUB_OUTPUT
62
+
63
+ tests:
64
+ name: 🔬 ${{ matrix.session.name }}
65
+ needs: [pre, generate-jobs-tests]
66
+ if: github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true'
67
+ runs-on: ubuntu-latest
68
+ strategy:
69
+ fail-fast: false
70
+ matrix:
71
+ session: ${{ fromJson(needs.generate-jobs-tests.outputs.sessions) }}
72
+
73
+ steps:
74
+ - name: Checkout repository
75
+ uses: actions/checkout@v4
76
+
77
+ - name: Setup nox
78
+ id: setup-nox
79
+ uses: wntrblm/nox@main
80
+ with:
81
+ python-versions: "3.12"
82
+
83
+ - name: Set up Docker Buildx
84
+ id: docker-buildx
85
+ uses: docker/setup-buildx-action@v3
86
+
87
+ - name: Nox cache
88
+ id: cache
89
+ uses: actions/cache@v4
90
+ with:
91
+ path: |
92
+ ~/.cache
93
+ ~/.nox
94
+ key: ${{ runner.os }}-nox-${{ matrix.session.session }}-${{hashFiles('**/uv.lock') }}-${{ hashFiles('**/noxfile.py') }}
95
+ restore-keys: |
96
+ ${{ runner.os }}-nox-${{ matrix.session.session }}-
97
+ ${{ runner.os }}-nox-
98
+
99
+ - name: Install coverage
100
+ run: pipx install coverage[toml]
101
+
102
+ - name: Setup uv
103
+ id: setup-uv
104
+ uses: astral-sh/setup-uv@v5
105
+ with:
106
+ enable-cache: true
107
+ cache-suffix: ${{ runner.os }}-${{ matrix.session.session }}
108
+
109
+ - run: nox -r -t tests -s "${{ matrix.session.session }}"
110
+
111
+ - name: Run coverage
112
+ id: run-coverage
113
+ run: coverage xml -i
114
+ if: ${{ always() }}
115
+
116
+ - name: Upload coverage
117
+ id: upload-coverage
118
+ uses: codecov/codecov-action@v5
119
+ if: ${{ always() }}
120
+ with:
121
+ token: ${{ secrets.CODECOV_TOKEN }}
122
+ fail_ci_if_error: true
123
+ verbose: true
124
+
125
+ lint:
126
+ name: ✨ Lint
127
+ needs: pre
128
+ if: github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true'
129
+ runs-on: ubuntu-latest
130
+ strategy:
131
+ fail-fast: false
132
+
133
+ steps:
134
+ - uses: actions/checkout@v4
135
+
136
+ - name: Pip cache
137
+ id: cache
138
+ uses: actions/cache@v4
139
+ with:
140
+ path: |
141
+ ~/.cache
142
+ ~/.nox
143
+ key: ${{ runner.os }}-nox-lint-${{ matrix.session.session }}-${{hashFiles('**/uv.lock') }} }}
144
+ restore-keys: |
145
+ ${{ runner.os }}-lint-nox-${{ matrix.session.session }}-
146
+ ${{ runner.os }}-lint-nox-
147
+
148
+ - name: Setup nox
149
+ id: setup-nox
150
+ uses: wntrblm/nox@main
151
+ with:
152
+ python-versions: "3.12"
153
+
154
+ - name: Setup uv
155
+ id: setup-uv
156
+ uses: astral-sh/setup-uv@v5
157
+ with:
158
+ enable-cache: true
159
+ cache-suffix: ${{ runner.os }}-${{ matrix.session.session }}
160
+
161
+ - name: Install dependencies
162
+ run: uv sync --group lint
163
+
164
+ - name: Add .venv/bin to PATH
165
+ run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
166
+
167
+ - run: nox -t lint
168
+
169
+ # Ensure the workflow is successful only if all job in matrixes are successful
170
+ result:
171
+ name: Result
172
+ if: (github.ref_type == 'tag' || needs.pre.outputs.should_skip != 'true') && always()
173
+ runs-on: ubuntu-latest
174
+ needs:
175
+ - pre
176
+ - tests
177
+ - lint
178
+ steps:
179
+ - name: Mark workflow as failed if lint or tests did not pass
180
+ if: needs.tests.result != 'success' || needs.lint.result != 'success'
181
+ run: exit 1
182
+ - name: Invoke release workflow
183
+ if: github.ref_type == 'tag'
184
+ uses: benc-uk/workflow-dispatch@v1
185
+ with:
186
+ workflow: 🚀 Continuous Deployment
@@ -0,0 +1,98 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "🔎 CodeQL Advanced"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "main" ]
17
+ pull_request:
18
+ branches: [ "main" ]
19
+ schedule:
20
+ - cron: '43 19 * * 3'
21
+
22
+ jobs:
23
+ analyze:
24
+ name: Analyze (${{ matrix.language }})
25
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
26
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
27
+ # - https://gh.io/supported-runners-and-hardware-resources
28
+ # - https://gh.io/using-larger-runners (GitHub.com only)
29
+ # Consider using larger runners or machines with greater resources for possible analysis time improvements.
30
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31
+ permissions:
32
+ # required for all workflows
33
+ security-events: write
34
+
35
+ # required to fetch internal or private CodeQL packs
36
+ packages: read
37
+
38
+ # only required for workflows in private repositories
39
+ actions: read
40
+ contents: read
41
+
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+ - language: python
47
+ build-mode: none
48
+ # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
49
+ # Use `c-cpp` to analyze code written in C, C++ or both
50
+ # Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51
+ # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52
+ # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53
+ # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54
+ # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55
+ # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
56
+ steps:
57
+ - name: Checkout repository
58
+ uses: actions/checkout@v4
59
+
60
+ # Add any setup steps before running the `github/codeql-action/init` action.
61
+ # This includes steps like installing compilers or runtimes (`actions/setup-node`
62
+ # or others). This is typically only required for manual builds.
63
+ # - name: Setup runtime (example)
64
+ # uses: actions/setup-example@v1
65
+
66
+ # Initializes the CodeQL tools for scanning.
67
+ - name: Initialize CodeQL
68
+ uses: github/codeql-action/init@v3
69
+ with:
70
+ languages: ${{ matrix.language }}
71
+ build-mode: ${{ matrix.build-mode }}
72
+ # If you wish to specify custom queries, you can do so here or in a config file.
73
+ # By default, queries listed here will override any specified in a config file.
74
+ # Prefix the list here with "+" to use these queries and those in the config file.
75
+
76
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
77
+ # queries: security-extended,security-and-quality
78
+
79
+ # If the analyze step fails for one of the languages you are analyzing with
80
+ # "We were unable to automatically build your code", modify the matrix above
81
+ # to set the build mode to "manual" for that language. Then modify this step
82
+ # to build your code.
83
+ # ℹ️ Command-line programs to run using the OS shell.
84
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
85
+ - if: matrix.build-mode == 'manual'
86
+ shell: bash
87
+ run: |
88
+ echo 'If you are using a "manual" build mode for one or more of the' \
89
+ 'languages you are analyzing, replace this with the commands to build' \
90
+ 'your code, for example:'
91
+ echo ' make bootstrap'
92
+ echo ' make release'
93
+ exit 1
94
+
95
+ - name: Perform CodeQL Analysis
96
+ uses: github/codeql-action/analyze@v3
97
+ with:
98
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,40 @@
1
+ name: 📢 Publish and release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ publish-release:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write
13
+ environment: release
14
+ steps:
15
+ - name: Checkout repository
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.12
23
+
24
+ - name: Install dependencies
25
+ run: uv sync --all-extras
26
+
27
+ - name: Build package
28
+ run: uv build
29
+
30
+ - name: Publish package distributions to PyPI
31
+ uses: pypa/gh-action-pypi-publish@release/v1
32
+
33
+ - name: Upload wheels to release
34
+ uses: svenstaro/upload-release-action@v2
35
+ with:
36
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
37
+ file: dist/*
38
+ tag: ${{ github.ref }}
39
+ overwrite: true
40
+ file_glob: true
@@ -0,0 +1,178 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ .unasyncd_cache/
177
+
178
+ .vscode/launch.json
@@ -0,0 +1,73 @@
1
+ default_language_version:
2
+ python: "3.12"
3
+
4
+ default_stages:
5
+ - pre-commit
6
+ - pre-push
7
+
8
+ repos:
9
+ # General hooks
10
+ - repo: https://github.com/pre-commit/pre-commit-hooks
11
+ rev: v5.0.0
12
+ hooks:
13
+ - id: check-toml
14
+ - id: check-yaml
15
+ - id: check-case-conflict
16
+ - id: check-merge-conflict
17
+ - id: check-executables-have-shebangs
18
+ - id: check-shebang-scripts-are-executable
19
+ - id: detect-private-key
20
+ - id: debug-statements
21
+ - id: end-of-file-fixer
22
+ - id: trailing-whitespace
23
+
24
+ - repo: https://github.com/codespell-project/codespell
25
+ rev: v2.4.1
26
+ hooks:
27
+ - id: codespell
28
+ additional_dependencies:
29
+ - "tomli"
30
+ args:
31
+ - --toml=./pyproject.toml
32
+
33
+ # Python specific
34
+
35
+ # Commitizen
36
+ - repo: https://github.com/commitizen-tools/commitizen
37
+ rev: v4.2.2
38
+ hooks:
39
+ - id: commitizen
40
+
41
+ - repo: https://github.com/provinzkraut/unasyncd
42
+ rev: v0.8.1
43
+ hooks:
44
+ - id: unasyncd
45
+ additional_dependencies: ["ruff"]
46
+
47
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
48
+ rev: v0.9.6
49
+ hooks:
50
+ - id: ruff
51
+ args: [--config=./pyproject.toml, --fix, --exit-non-zero-on-fix]
52
+ - id: ruff-format
53
+ types_or: [python, pyi]
54
+
55
+ - repo: local
56
+ hooks:
57
+ - id: pyright
58
+ name: pyright
59
+ entry: nox -rs pyright --
60
+ language: python
61
+ types: [python]
62
+ require_serial: true
63
+ additional_dependencies: [nox]
64
+
65
+ - repo: local
66
+ hooks:
67
+ - id: vulture
68
+ name: vulture
69
+ entry: nox -rs vulture --
70
+ language: python
71
+ types: [python]
72
+ require_serial: true
73
+ additional_dependencies: [nox]
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,7 @@
1
+ {
2
+ "python.testing.pytestArgs": [
3
+ "tests"
4
+ ],
5
+ "python.testing.unittestEnabled": false,
6
+ "python.testing.pytestEnabled": true
7
+ }