ferro-orm 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.
Files changed (76) hide show
  1. ferro_orm-0.1.0/.github/PERMISSIONS.md +298 -0
  2. ferro_orm-0.1.0/.github/PYPI_CHECKLIST.md +93 -0
  3. ferro_orm-0.1.0/.github/PYPI_SETUP.md +368 -0
  4. ferro_orm-0.1.0/.github/workflows/ci.yml +203 -0
  5. ferro_orm-0.1.0/.github/workflows/publish.yml +193 -0
  6. ferro_orm-0.1.0/.github/workflows/release.yml +91 -0
  7. ferro_orm-0.1.0/.github/workflows/update-changelog.yml +72 -0
  8. ferro_orm-0.1.0/.gitignore +240 -0
  9. ferro_orm-0.1.0/.pre-commit-config.yaml +51 -0
  10. ferro_orm-0.1.0/.python-version +1 -0
  11. ferro_orm-0.1.0/CHANGELOG.md +48 -0
  12. ferro_orm-0.1.0/CONTRIBUTING.md +350 -0
  13. ferro_orm-0.1.0/Cargo.lock +2106 -0
  14. ferro_orm-0.1.0/Cargo.toml +24 -0
  15. ferro_orm-0.1.0/LICENSE +201 -0
  16. ferro_orm-0.1.0/PKG-INFO +81 -0
  17. ferro_orm-0.1.0/README.md +70 -0
  18. ferro_orm-0.1.0/docs/api.md +58 -0
  19. ferro_orm-0.1.0/docs/connection.md +48 -0
  20. ferro_orm-0.1.0/docs/contributing.md +3 -0
  21. ferro_orm-0.1.0/docs/fields.md +59 -0
  22. ferro_orm-0.1.0/docs/index.md +3 -0
  23. ferro_orm-0.1.0/docs/migrations.md +52 -0
  24. ferro_orm-0.1.0/docs/models.md +53 -0
  25. ferro_orm-0.1.0/docs/queries.md +89 -0
  26. ferro_orm-0.1.0/docs/relations.md +85 -0
  27. ferro_orm-0.1.0/docs/transactions.md +57 -0
  28. ferro_orm-0.1.0/mkdocs.yml +81 -0
  29. ferro_orm-0.1.0/pyproject.toml +101 -0
  30. ferro_orm-0.1.0/scripts/demo_queries.py +255 -0
  31. ferro_orm-0.1.0/src/connection.rs +68 -0
  32. ferro_orm-0.1.0/src/ferro/__init__.py +66 -0
  33. ferro_orm-0.1.0/src/ferro/_core.pyi +55 -0
  34. ferro_orm-0.1.0/src/ferro/base.py +77 -0
  35. ferro_orm-0.1.0/src/ferro/metaclass.py +200 -0
  36. ferro_orm-0.1.0/src/ferro/migrations/__init__.py +3 -0
  37. ferro_orm-0.1.0/src/ferro/migrations/alembic.py +211 -0
  38. ferro_orm-0.1.0/src/ferro/models.py +279 -0
  39. ferro_orm-0.1.0/src/ferro/py.typed +0 -0
  40. ferro_orm-0.1.0/src/ferro/query/__init__.py +4 -0
  41. ferro_orm-0.1.0/src/ferro/query/builder.py +298 -0
  42. ferro_orm-0.1.0/src/ferro/query/nodes.py +110 -0
  43. ferro_orm-0.1.0/src/ferro/relations/__init__.py +153 -0
  44. ferro_orm-0.1.0/src/ferro/relations/descriptors.py +98 -0
  45. ferro_orm-0.1.0/src/ferro/state.py +15 -0
  46. ferro_orm-0.1.0/src/lib.rs +90 -0
  47. ferro_orm-0.1.0/src/operations.rs +1415 -0
  48. ferro_orm-0.1.0/src/query.rs +112 -0
  49. ferro_orm-0.1.0/src/schema.rs +249 -0
  50. ferro_orm-0.1.0/src/state.rs +94 -0
  51. ferro_orm-0.1.0/tests/conftest.py +47 -0
  52. ferro_orm-0.1.0/tests/test_aggregation.py +79 -0
  53. ferro_orm-0.1.0/tests/test_alembic_autogenerate.py +94 -0
  54. ferro_orm-0.1.0/tests/test_alembic_bridge.py +114 -0
  55. ferro_orm-0.1.0/tests/test_alembic_type_mapping.py +73 -0
  56. ferro_orm-0.1.0/tests/test_auto_migrate.py +37 -0
  57. ferro_orm-0.1.0/tests/test_bulk_update.py +71 -0
  58. ferro_orm-0.1.0/tests/test_connection.py +27 -0
  59. ferro_orm-0.1.0/tests/test_constraints.py +64 -0
  60. ferro_orm-0.1.0/tests/test_crud.py +163 -0
  61. ferro_orm-0.1.0/tests/test_deletion.py +96 -0
  62. ferro_orm-0.1.0/tests/test_helpers.py +138 -0
  63. ferro_orm-0.1.0/tests/test_hydration.py +61 -0
  64. ferro_orm-0.1.0/tests/test_metadata.py +82 -0
  65. ferro_orm-0.1.0/tests/test_models.py +44 -0
  66. ferro_orm-0.1.0/tests/test_one_to_one.py +93 -0
  67. ferro_orm-0.1.0/tests/test_query_builder.py +246 -0
  68. ferro_orm-0.1.0/tests/test_refresh.py +62 -0
  69. ferro_orm-0.1.0/tests/test_relationship_engine.py +121 -0
  70. ferro_orm-0.1.0/tests/test_schema.py +35 -0
  71. ferro_orm-0.1.0/tests/test_schema_constraints.py +67 -0
  72. ferro_orm-0.1.0/tests/test_string_search.py +61 -0
  73. ferro_orm-0.1.0/tests/test_structural_types.py +106 -0
  74. ferro_orm-0.1.0/tests/test_temporal_types.py +80 -0
  75. ferro_orm-0.1.0/tests/test_transactions.py +93 -0
  76. ferro_orm-0.1.0/uv.lock +2423 -0
@@ -0,0 +1,298 @@
1
+ # GitHub Actions Workflow Permissions
2
+
3
+ This document explains the fine-grained permissions used by each workflow in this repository.
4
+
5
+ ## Overview
6
+
7
+ All workflows use explicit, fine-grained permissions (principle of least privilege). Each workflow only requests the permissions it needs to function.
8
+
9
+ **Repository Setting:** The repository-level "Workflow permissions" setting can remain at the default (read-only). Each workflow explicitly declares its required permissions.
10
+
11
+ ---
12
+
13
+ ## Workflow Permissions Breakdown
14
+
15
+ ### 0. CI - Continuous Integration (`ci.yml`)
16
+
17
+ **Trigger:** Pull requests, push to `main`, manual dispatch
18
+
19
+ **Permissions:**
20
+ ```yaml
21
+ # No explicit permissions needed
22
+ # Uses default read-only permissions
23
+ ```
24
+
25
+ **Why These Permissions:**
26
+ - Default `contents: read` - Allows the workflow to:
27
+ - Checkout code
28
+ - Read repository contents
29
+ - Run tests and linters
30
+ - No write access needed
31
+
32
+ **What It Does:**
33
+ - Runs all pre-commit hooks (Ruff, rustfmt, clippy, file checks)
34
+ - Runs pytest with coverage on multiple Python versions
35
+ - Runs Rust tests
36
+ - Builds package on multiple platforms
37
+ - Checks conventional commit format on PRs
38
+ - Uploads coverage to Codecov
39
+
40
+ **Security:** Read-only access ensures CI cannot modify the repository.
41
+
42
+ ---
43
+
44
+ ### 1. Update Changelog (`update-changelog.yml`)
45
+
46
+ **Trigger:** Push to `main` branch
47
+
48
+ **Permissions:**
49
+ ```yaml
50
+ permissions:
51
+ contents: write
52
+ ```
53
+
54
+ **Why These Permissions:**
55
+ - `contents: write` - Allows the workflow to:
56
+ - Commit updated CHANGELOG.md back to the repository
57
+ - Push changes to the `main` branch
58
+
59
+ **What It Does:**
60
+ - Reads conventional commits since last release
61
+ - Updates the `[Unreleased]` section of CHANGELOG.md
62
+ - Commits and pushes the updated changelog
63
+
64
+ ---
65
+
66
+ ### 2. Release (`release.yml`)
67
+
68
+ **Trigger:** Manual workflow dispatch OR release published
69
+
70
+ **Permissions:**
71
+ ```yaml
72
+ permissions:
73
+ contents: write
74
+ issues: write
75
+ pull-requests: write
76
+ ```
77
+
78
+ **Why These Permissions:**
79
+ - `contents: write` - Allows the workflow to:
80
+ - Commit version bumps to pyproject.toml and Cargo.toml
81
+ - Push commits to the `main` branch
82
+ - Create and push git tags (e.g., `v0.2.0`)
83
+ - Create GitHub releases
84
+
85
+ - `issues: write` - Allows the workflow to:
86
+ - Update issue references in release notes
87
+ - Close issues automatically via commit messages
88
+ - Add labels or comments to issues
89
+
90
+ - `pull-requests: write` - Allows the workflow to:
91
+ - Update PR references in release notes
92
+ - Close PRs automatically via commit messages
93
+ - Add labels or comments to PRs
94
+
95
+ **What It Does:**
96
+ - Analyzes conventional commits
97
+ - Determines next version
98
+ - Updates version in both Python and Rust files
99
+ - Finalizes CHANGELOG.md
100
+ - Creates git tag
101
+ - Creates GitHub release
102
+ - Triggers publish workflow
103
+
104
+ ---
105
+
106
+ ### 3. Build & Publish (`publish.yml`)
107
+
108
+ **Trigger:** Workflow call, manual dispatch, or release published
109
+
110
+ **Permissions:**
111
+
112
+ **For build/test jobs:** (default - read-only)
113
+ ```yaml
114
+ # No explicit permissions needed
115
+ # Uses default read permissions to:
116
+ # - Checkout code
117
+ # - Read repository contents
118
+ ```
119
+
120
+ **For publish-pypi job:**
121
+ ```yaml
122
+ permissions:
123
+ id-token: write
124
+ ```
125
+
126
+ **Why These Permissions:**
127
+ - `id-token: write` - Allows the workflow to:
128
+ - Request an OIDC token from GitHub
129
+ - Authenticate with PyPI using Trusted Publishing
130
+ - Publish packages without API tokens
131
+
132
+ **What It Does:**
133
+ - Builds wheels for multiple platforms
134
+ - Builds source distribution
135
+ - Tests built packages
136
+ - Publishes to PyPI using OIDC authentication
137
+
138
+ ---
139
+
140
+ ## Permission Scopes Explained
141
+
142
+ ### `contents: write`
143
+ Full access to repository contents, including:
144
+ - Committing files
145
+ - Pushing to branches
146
+ - Creating/deleting tags
147
+ - Creating releases
148
+
149
+ ### `contents: read` (default)
150
+ Read-only access to repository contents:
151
+ - Cloning/checking out code
152
+ - Reading files
153
+ - Listing branches and tags
154
+
155
+ ### `issues: write`
156
+ Permission to modify issues:
157
+ - Create, edit, close issues
158
+ - Add labels and assignees
159
+ - Add comments
160
+
161
+ ### `pull-requests: write`
162
+ Permission to modify pull requests:
163
+ - Create, edit, close PRs
164
+ - Add labels and assignees
165
+ - Add comments
166
+ - Request reviewers
167
+
168
+ ### `id-token: write`
169
+ Permission to request OIDC tokens:
170
+ - Get JWT token from GitHub
171
+ - Authenticate with external services (PyPI)
172
+ - No access to repository contents
173
+
174
+ ---
175
+
176
+ ## Security Best Practices
177
+
178
+ ### ✅ Current Setup (Secure)
179
+
180
+ 1. **Principle of Least Privilege**
181
+ - Each workflow only requests permissions it needs
182
+ - No workflows have more permissions than necessary
183
+
184
+ 2. **Explicit Permissions**
185
+ - All permissions are declared in workflow files
186
+ - Easy to audit and review
187
+
188
+ 3. **OIDC Authentication**
189
+ - No long-lived API tokens
190
+ - Tokens expire automatically
191
+ - Tokens are tied to specific workflows
192
+
193
+ 4. **Environment Protection** (publish workflow)
194
+ - Uses `pypi` environment
195
+ - Can require manual approval
196
+ - Additional security layer
197
+
198
+ ### ❌ What We're NOT Doing (Good!)
199
+
200
+ 1. **Not using repository-wide write permissions**
201
+ - Would give all workflows unnecessary access
202
+ - Higher security risk
203
+
204
+ 2. **Not using API tokens**
205
+ - No secrets to manage
206
+ - No token rotation needed
207
+
208
+ 3. **Not granting `packages: write`**
209
+ - Not needed for our use case
210
+ - Reduces attack surface
211
+
212
+ ---
213
+
214
+ ## Troubleshooting
215
+
216
+ ### Workflow Fails with "Permission Denied"
217
+
218
+ **Check:**
219
+ 1. Permissions are declared in the workflow file
220
+ 2. Organization doesn't block fine-grained permissions
221
+ 3. Branch protection rules allow workflow commits
222
+
223
+ **Solution:**
224
+ - Verify the `permissions:` block exists in the workflow
225
+ - Check organization settings allow workflow permissions
226
+ - Add `permissions: {}` explicitly to override org defaults
227
+
228
+ ### "Resource not accessible by integration"
229
+
230
+ **Cause:** Workflow trying to access resource without permission
231
+
232
+ **Solution:**
233
+ - Add the required permission to the workflow's `permissions:` block
234
+ - Common missing permissions:
235
+ - `contents: write` for commits/tags
236
+ - `pull-requests: write` for PR comments
237
+ - `issues: write` for issue comments
238
+
239
+ ### PyPI Publishing Fails with Authentication Error
240
+
241
+ **Cause:** Missing `id-token: write` permission
242
+
243
+ **Solution:**
244
+ - Ensure `publish-pypi` job has `id-token: write`
245
+ - Verify PyPI trusted publisher is configured correctly
246
+ - Check environment name matches (`pypi`)
247
+
248
+ ---
249
+
250
+ ## Verification
251
+
252
+ To verify permissions are working:
253
+
254
+ ### Test Update Changelog
255
+ ```bash
256
+ git commit --allow-empty -m "feat: test changelog workflow"
257
+ git push
258
+ # Check Actions tab - should see commit from github-actions[bot]
259
+ ```
260
+
261
+ ### Test Release
262
+ ```bash
263
+ gh workflow run release.yml
264
+ # Check that version files are updated and tagged
265
+ ```
266
+
267
+ ### Test Publish
268
+ ```bash
269
+ # Triggered automatically by release workflow
270
+ # Or manually: gh workflow run publish.yml
271
+ ```
272
+
273
+ ---
274
+
275
+ ## GitHub Organization Settings
276
+
277
+ **If fine-grained permissions are blocked:**
278
+
279
+ 1. Go to: https://github.com/organizations/syn54x/settings/actions
280
+ 2. Under "Workflow permissions":
281
+ - Enable "Read and write permissions" OR
282
+ - Enable "Allow workflows to request permissions explicitly"
283
+ 3. Save changes
284
+
285
+ **Current Status:** ✅ All workflows use explicit permissions and should work regardless of org defaults.
286
+
287
+ ---
288
+
289
+ ## Additional Resources
290
+
291
+ - [GitHub Actions Permissions](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token)
292
+ - [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/)
293
+ - [OIDC in GitHub Actions](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
294
+
295
+ ---
296
+
297
+ **Last Updated:** 2026-01-27
298
+ **Status:** ✅ All workflows properly configured with fine-grained permissions
@@ -0,0 +1,93 @@
1
+ # PyPI Trusted Publishing Setup Checklist
2
+
3
+ Use this checklist to track your progress setting up PyPI Trusted Publishing.
4
+
5
+ ## Pre-Setup
6
+
7
+ - [ ] PyPI account created and email verified
8
+ - [ ] GitHub repository admin access confirmed
9
+ - [ ] Read PYPI_SETUP.md documentation
10
+
11
+ ## PyPI Configuration
12
+
13
+ - [ ] Logged into https://pypi.org/
14
+ - [ ] Navigated to "Publishing" settings
15
+ - [ ] Added trusted publisher with correct details:
16
+ - [ ] Owner: `syn54x`
17
+ - [ ] Repository: `ferro-orm`
18
+ - [ ] Workflow: `publish.yml`
19
+ - [ ] Environment: `pypi` (optional)
20
+ - [ ] Verified configuration appears in publisher list
21
+
22
+ ## GitHub Repository Setup
23
+
24
+ - [ ] Created GitHub environment named `pypi`
25
+ - [ ] Configured environment protection rules (optional):
26
+ - [ ] Required reviewers
27
+ - [ ] Wait timer
28
+ - [ ] Branch restrictions (main only)
29
+ - [ ] Enabled workflow permissions:
30
+ - [ ] Settings → Actions → General
31
+ - [ ] "Read and write permissions" enabled
32
+ - [ ] "Allow GitHub Actions to create and approve pull requests" enabled
33
+
34
+ ## Workflow Verification
35
+
36
+ - [ ] Confirmed `.github/workflows/publish.yml` exists
37
+ - [ ] Verified workflow has `id-token: write` permission
38
+ - [ ] Verified workflow has `environment: pypi` (if using environment)
39
+ - [ ] All workflows pass pre-commit hooks
40
+
41
+ ## Testing
42
+
43
+ - [ ] Test workflow triggered manually (optional)
44
+ - [ ] Reviewed workflow logs for authentication
45
+ - [ ] No OIDC errors in logs
46
+
47
+ ## First Release Test
48
+
49
+ - [ ] Created test release
50
+ - [ ] Release workflow completed successfully
51
+ - [ ] Publish workflow completed successfully
52
+ - [ ] Package appears on PyPI
53
+ - [ ] Can install package: `pip install ferro-orm`
54
+
55
+ ## Final Verification
56
+
57
+ - [ ] Tested on multiple platforms
58
+ - [ ] Documentation updated with install instructions
59
+ - [ ] Team members notified of new release process
60
+ - [ ] Test PyPI configured (optional)
61
+
62
+ ---
63
+
64
+ ## Quick Commands
65
+
66
+ ```bash
67
+ # Manual workflow trigger
68
+ gh workflow run publish.yml
69
+
70
+ # Create a test release
71
+ gh release create v0.1.1 --generate-notes
72
+
73
+ # Check workflow status
74
+ gh run list --workflow=publish.yml
75
+
76
+ # Install and test
77
+ pip install ferro-orm
78
+ python -c "import ferro; print(ferro.__version__)"
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Need Help?
84
+
85
+ - See [PYPI_SETUP.md](./PYPI_SETUP.md) for detailed instructions
86
+ - Check [Actions tab](https://github.com/syn54x/ferro-orm/actions) for workflow logs
87
+ - Review [PyPI docs](https://docs.pypi.org/trusted-publishers/)
88
+
89
+ ---
90
+
91
+ **Status:** ⏳ In Progress | ✅ Complete
92
+ **Date Started:** _______
93
+ **Date Completed:** _______