pydynox 0.5.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 (99) hide show
  1. pydynox-0.5.0/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
  2. pydynox-0.5.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. pydynox-0.5.0/.github/ISSUE_TEMPLATE/feature_request.md +30 -0
  4. pydynox-0.5.0/.github/workflows/ci.yml +127 -0
  5. pydynox-0.5.0/.github/workflows/codspeed.yml +59 -0
  6. pydynox-0.5.0/.github/workflows/docs.yml +61 -0
  7. pydynox-0.5.0/.github/workflows/release.yml +147 -0
  8. pydynox-0.5.0/.gitignore +84 -0
  9. pydynox-0.5.0/AGENTS.md +143 -0
  10. pydynox-0.5.0/CONTRIBUTING.md +145 -0
  11. pydynox-0.5.0/Cargo.lock +2220 -0
  12. pydynox-0.5.0/Cargo.toml +36 -0
  13. pydynox-0.5.0/LICENSE +21 -0
  14. pydynox-0.5.0/PKG-INFO +334 -0
  15. pydynox-0.5.0/README.md +306 -0
  16. pydynox-0.5.0/benchmark/__init__.py +1 -0
  17. pydynox-0.5.0/benchmark/benchmark.py +613 -0
  18. pydynox-0.5.0/benchmark/conftest.py +127 -0
  19. pydynox-0.5.0/docs/examples/batch/batch_write.py +14 -0
  20. pydynox-0.5.0/docs/examples/exceptions/condition_check.py +17 -0
  21. pydynox-0.5.0/docs/examples/exceptions/handling_errors.py +23 -0
  22. pydynox-0.5.0/docs/examples/hooks/all_hooks.py +47 -0
  23. pydynox-0.5.0/docs/examples/hooks/validation.py +34 -0
  24. pydynox-0.5.0/docs/examples/models/basic_model.py +13 -0
  25. pydynox-0.5.0/docs/examples/models/crud_operations.py +32 -0
  26. pydynox-0.5.0/docs/examples/models/with_defaults.py +21 -0
  27. pydynox-0.5.0/docs/examples/pydantic/basic_pydantic.py +19 -0
  28. pydynox-0.5.0/docs/examples/rate_limit/adaptive_rate.py +11 -0
  29. pydynox-0.5.0/docs/examples/rate_limit/check_metrics.py +14 -0
  30. pydynox-0.5.0/docs/examples/rate_limit/fixed_rate.py +11 -0
  31. pydynox-0.5.0/docs/examples/tables/create_table.py +24 -0
  32. pydynox-0.5.0/docs/examples/tables/table_options.py +40 -0
  33. pydynox-0.5.0/docs/examples/transactions/basic_transaction.py +9 -0
  34. pydynox-0.5.0/docs/examples/ttl/basic_ttl.py +32 -0
  35. pydynox-0.5.0/docs/examples/ttl/session_example.py +39 -0
  36. pydynox-0.5.0/docs/getting-started.md +137 -0
  37. pydynox-0.5.0/docs/guides/01-models.md +205 -0
  38. pydynox-0.5.0/docs/guides/03-crud.md +143 -0
  39. pydynox-0.5.0/docs/guides/04-batch.md +70 -0
  40. pydynox-0.5.0/docs/guides/05-transactions.md +101 -0
  41. pydynox-0.5.0/docs/guides/06-rate-limiting.md +123 -0
  42. pydynox-0.5.0/docs/guides/07-hooks.md +112 -0
  43. pydynox-0.5.0/docs/guides/08-pydantic.md +179 -0
  44. pydynox-0.5.0/docs/guides/09-exceptions.md +147 -0
  45. pydynox-0.5.0/docs/guides/10-tables.md +124 -0
  46. pydynox-0.5.0/docs/index.md +70 -0
  47. pydynox-0.5.0/pyproject.toml +88 -0
  48. pydynox-0.5.0/python/pydynox/__init__.py +56 -0
  49. pydynox-0.5.0/python/pydynox/attributes.py +220 -0
  50. pydynox-0.5.0/python/pydynox/batch_operations.py +77 -0
  51. pydynox-0.5.0/python/pydynox/client.py +497 -0
  52. pydynox-0.5.0/python/pydynox/exceptions.py +45 -0
  53. pydynox-0.5.0/python/pydynox/hooks.py +76 -0
  54. pydynox-0.5.0/python/pydynox/integrations/__init__.py +1 -0
  55. pydynox-0.5.0/python/pydynox/integrations/pydantic.py +217 -0
  56. pydynox-0.5.0/python/pydynox/model.py +413 -0
  57. pydynox-0.5.0/python/pydynox/py.typed +1 -0
  58. pydynox-0.5.0/python/pydynox/query.py +123 -0
  59. pydynox-0.5.0/python/pydynox/rate_limit.py +101 -0
  60. pydynox-0.5.0/python/pydynox/transaction.py +200 -0
  61. pydynox-0.5.0/src/basic_operations.rs +598 -0
  62. pydynox-0.5.0/src/batch_operations.rs +273 -0
  63. pydynox-0.5.0/src/client.rs +709 -0
  64. pydynox-0.5.0/src/errors.rs +252 -0
  65. pydynox-0.5.0/src/lib.rs +50 -0
  66. pydynox-0.5.0/src/rate_limiter.rs +534 -0
  67. pydynox-0.5.0/src/serialization.rs +476 -0
  68. pydynox-0.5.0/src/table_operations.rs +326 -0
  69. pydynox-0.5.0/src/transaction_operations.rs +311 -0
  70. pydynox-0.5.0/tests/__init__.py +1 -0
  71. pydynox-0.5.0/tests/integration/__init__.py +1 -0
  72. pydynox-0.5.0/tests/integration/client/__init__.py +0 -0
  73. pydynox-0.5.0/tests/integration/client/test_connection_errors.py +46 -0
  74. pydynox-0.5.0/tests/integration/conftest.py +110 -0
  75. pydynox-0.5.0/tests/integration/hooks/__init__.py +0 -0
  76. pydynox-0.5.0/tests/integration/hooks/test_hooks_integration.py +213 -0
  77. pydynox-0.5.0/tests/integration/operations/__init__.py +1 -0
  78. pydynox-0.5.0/tests/integration/operations/test_batch_get.py +135 -0
  79. pydynox-0.5.0/tests/integration/operations/test_batch_write.py +161 -0
  80. pydynox-0.5.0/tests/integration/operations/test_delete_item.py +89 -0
  81. pydynox-0.5.0/tests/integration/operations/test_get_item.py +58 -0
  82. pydynox-0.5.0/tests/integration/operations/test_put_item.py +66 -0
  83. pydynox-0.5.0/tests/integration/operations/test_query.py +220 -0
  84. pydynox-0.5.0/tests/integration/operations/test_table.py +145 -0
  85. pydynox-0.5.0/tests/integration/operations/test_transaction.py +199 -0
  86. pydynox-0.5.0/tests/integration/operations/test_update_item.py +201 -0
  87. pydynox-0.5.0/tests/integration/rate_limit/__init__.py +1 -0
  88. pydynox-0.5.0/tests/integration/rate_limit/test_rate_limit_operations.py +281 -0
  89. pydynox-0.5.0/tests/python/__init__.py +1 -0
  90. pydynox-0.5.0/tests/python/property/__init__.py +1 -0
  91. pydynox-0.5.0/tests/python/property/test_serialization_props.py +125 -0
  92. pydynox-0.5.0/tests/python/test_attributes.py +74 -0
  93. pydynox-0.5.0/tests/python/test_hooks.py +315 -0
  94. pydynox-0.5.0/tests/python/test_model.py +209 -0
  95. pydynox-0.5.0/tests/python/test_pydantic.py +200 -0
  96. pydynox-0.5.0/tests/python/test_rate_limit.py +160 -0
  97. pydynox-0.5.0/tests/python/test_ttl.py +206 -0
  98. pydynox-0.5.0/uv.lock +1832 -0
  99. pydynox-0.5.0/zensical.toml +58 -0
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug to help us improve
4
+ title: '[BUG] '
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Description
10
+
11
+ A clear description of the bug.
12
+
13
+ ## Steps to Reproduce
14
+
15
+ ```python
16
+ # Minimal code to reproduce the issue
17
+ from pydynox import DynamoDBClient
18
+
19
+ client = DynamoDBClient()
20
+ # ...
21
+ ```
22
+
23
+ ## Expected Behavior
24
+
25
+ What you expected to happen.
26
+
27
+ ## Actual Behavior
28
+
29
+ What actually happened. Include error messages if any.
30
+
31
+ ## Environment
32
+
33
+ - **pydynox version**: (e.g., 0.1.0)
34
+ - **Python version**: (e.g., 3.12)
35
+ - **OS**: (e.g., macOS 14, Ubuntu 22.04, Windows 11)
36
+ - **AWS Region**: (if relevant)
37
+
38
+ ## Additional Context
39
+
40
+ Any other info that might help (logs, screenshots, etc).
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Documentation
4
+ url: https://pydynox.readthedocs.io
5
+ about: Check the docs before opening an issue
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature or improvement
4
+ title: '[FEATURE] '
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Problem
10
+
11
+ What problem does this feature solve?
12
+
13
+ ## Proposed Solution
14
+
15
+ How would you like it to work?
16
+
17
+ ```python
18
+ # Example of how you'd use this feature
19
+ from pydynox import ...
20
+
21
+ # ...
22
+ ```
23
+
24
+ ## Alternatives Considered
25
+
26
+ Any other solutions you've thought about.
27
+
28
+ ## Additional Context
29
+
30
+ Any other info (links, examples from other libraries, etc).
@@ -0,0 +1,127 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ env:
10
+ CARGO_TERM_COLOR: always
11
+
12
+ jobs:
13
+ lint:
14
+ name: Lint
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Rust fmt
20
+ run: cargo fmt --all -- --check
21
+
22
+ - name: Rust clippy
23
+ run: cargo clippy --all-targets -- -D warnings
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v4
27
+
28
+ - name: Set up Python
29
+ run: uv python install 3.11
30
+
31
+ - name: Python lint
32
+ run: |
33
+ uv venv
34
+ uv pip install ruff
35
+ uv run ruff check python/ tests/
36
+
37
+ test:
38
+ name: Test (${{ matrix.os }} / py${{ matrix.python }})
39
+ runs-on: ${{ matrix.os }}
40
+ strategy:
41
+ fail-fast: false
42
+ matrix:
43
+ os: [ubuntu-latest, macos-latest]
44
+ python: ["3.11", "3.12", "3.13", "3.14"]
45
+
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+
49
+ - name: Set up Python
50
+ uses: actions/setup-python@v5
51
+ with:
52
+ python-version: ${{ matrix.python }}
53
+ allow-prereleases: true
54
+
55
+ - name: Create venv
56
+ run: python -m venv .venv
57
+
58
+ - name: Build wheel
59
+ uses: PyO3/maturin-action@v1
60
+ with:
61
+ command: build
62
+ args: --release --out dist
63
+ sccache: true
64
+
65
+ - name: Install wheel and dependencies (Unix)
66
+ if: runner.os != 'Windows'
67
+ run: |
68
+ source .venv/bin/activate
69
+ pip install dist/*.whl
70
+ pip install pytest pytest-asyncio hypothesis "moto[dynamodb,server]" boto3 pydantic
71
+
72
+ - name: Install wheel and dependencies (Windows)
73
+ if: runner.os == 'Windows'
74
+ run: |
75
+ .venv\Scripts\activate
76
+ pip install (Get-ChildItem dist\*.whl)
77
+ pip install pytest pytest-asyncio hypothesis "moto[dynamodb,server]" boto3 pydantic
78
+
79
+ - name: Run tests (Unix)
80
+ if: runner.os != 'Windows'
81
+ run: |
82
+ source .venv/bin/activate
83
+ pytest tests/ -v --ignore=tests/benchmark
84
+
85
+ - name: Run tests (Windows)
86
+ if: runner.os == 'Windows'
87
+ run: |
88
+ .venv\Scripts\activate
89
+ pytest tests/ -v --ignore=tests/benchmark
90
+
91
+ coverage:
92
+ name: Coverage
93
+ runs-on: ubuntu-latest
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+
97
+ - name: Set up Python
98
+ uses: actions/setup-python@v5
99
+ with:
100
+ python-version: "3.12"
101
+
102
+ - name: Create venv
103
+ run: python -m venv .venv
104
+
105
+ - name: Build wheel
106
+ uses: PyO3/maturin-action@v1
107
+ with:
108
+ command: build
109
+ args: --release --out dist
110
+ sccache: true
111
+
112
+ - name: Install wheel and dependencies
113
+ run: |
114
+ source .venv/bin/activate
115
+ pip install dist/*.whl
116
+ pip install pytest pytest-asyncio pytest-cov hypothesis "moto[dynamodb,server]" boto3 pydantic
117
+
118
+ - name: Run tests with coverage
119
+ run: |
120
+ source .venv/bin/activate
121
+ pytest tests/ -v --cov=pydynox --cov-report=xml --ignore=tests/benchmark
122
+
123
+ - name: Upload coverage
124
+ uses: codecov/codecov-action@v4
125
+ with:
126
+ files: coverage.xml
127
+ fail_ci_if_error: false
@@ -0,0 +1,59 @@
1
+ name: CodSpeed
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+ id-token: write
13
+
14
+ env:
15
+ CARGO_TERM_COLOR: always
16
+ UV_FROZEN: "1"
17
+
18
+ jobs:
19
+ codspeed:
20
+ name: Run benchmarks
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v4
27
+ with:
28
+ enable-cache: true
29
+
30
+ - name: Cache cargo
31
+ uses: actions/cache@v4
32
+ with:
33
+ path: |
34
+ ~/.cargo/bin/
35
+ ~/.cargo/registry/index/
36
+ ~/.cargo/registry/cache/
37
+ ~/.cargo/git/db/
38
+ target/
39
+ key: ${{ runner.os }}-cargo-codspeed-${{ hashFiles('**/Cargo.lock') }}
40
+
41
+ - name: Set up Python 3.12
42
+ run: uv python install 3.12
43
+
44
+ - name: Build wheel
45
+ run: |
46
+ uv venv --python 3.12
47
+ uv pip install maturin
48
+ uv run maturin build --release --interpreter python3.12 --out dist
49
+
50
+ - name: Install dependencies and wheel
51
+ run: |
52
+ uv pip install pytest pytest-asyncio pytest-codspeed hypothesis "moto[dynamodb,server]" boto3 pydantic pynamodb
53
+ uv pip install dist/pydynox-*.whl --force-reinstall --no-deps
54
+
55
+ - name: Run benchmarks
56
+ uses: CodSpeedHQ/action@v4.5.1
57
+ with:
58
+ mode: simulation
59
+ run: uv run pytest --ignore=tests/benchmark --codspeed
@@ -0,0 +1,61 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths:
7
+ - "docs/**"
8
+ - "zensical.toml"
9
+ - ".github/workflows/docs.yml"
10
+ pull_request:
11
+ paths:
12
+ - "docs/**"
13
+ - "zensical.toml"
14
+ workflow_dispatch:
15
+
16
+ permissions:
17
+ contents: read
18
+ pages: write
19
+ id-token: write
20
+
21
+ concurrency:
22
+ group: "pages"
23
+ cancel-in-progress: false
24
+
25
+ jobs:
26
+ build:
27
+ runs-on: ubuntu-latest
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+
31
+ - name: Install uv
32
+ uses: astral-sh/setup-uv@v4
33
+
34
+ - name: Setup Python
35
+ run: uv python install 3.12
36
+
37
+ - name: Install dependencies
38
+ run: |
39
+ uv venv
40
+ uv pip install zensical
41
+
42
+ - name: Build docs
43
+ run: uv run zensical build
44
+
45
+ - name: Upload artifact
46
+ uses: actions/upload-pages-artifact@v3
47
+ with:
48
+ path: site
49
+
50
+ # Only deploy on push to main, not on PRs
51
+ deploy:
52
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
53
+ environment:
54
+ name: github-pages
55
+ url: ${{ steps.deployment.outputs.page_url }}
56
+ runs-on: ubuntu-latest
57
+ needs: build
58
+ steps:
59
+ - name: Deploy to GitHub Pages
60
+ id: deployment
61
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,147 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version:
7
+ description: "Version to release (e.g., 0.1.0)"
8
+ required: true
9
+ type: string
10
+
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+
15
+ jobs:
16
+ build-linux-x86:
17
+ name: Build manylinux x86_64 cp${{ matrix.python }}
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ python: ["3.11", "3.12", "3.13", "3.14"]
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Build wheels
26
+ uses: PyO3/maturin-action@v1
27
+ with:
28
+ target: x86_64
29
+ args: --release --out dist -i python${{ matrix.python }}
30
+ manylinux: auto
31
+ sccache: true
32
+
33
+ - name: Upload wheels
34
+ uses: actions/upload-artifact@v4
35
+ with:
36
+ name: pydynox-${{ inputs.version }}-cp${{ matrix.python }}-manylinux-x86_64
37
+ path: dist/*.whl
38
+
39
+ build-linux-arm:
40
+ name: Build manylinux aarch64 cp${{ matrix.python }}
41
+ runs-on: ubuntu-24.04-arm
42
+ strategy:
43
+ matrix:
44
+ python: ["3.11", "3.12", "3.13", "3.14"]
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+
48
+ - name: Build wheels
49
+ uses: PyO3/maturin-action@v1
50
+ with:
51
+ target: aarch64
52
+ args: --release --out dist -i python${{ matrix.python }}
53
+ manylinux: auto
54
+ sccache: true
55
+
56
+ - name: Upload wheels
57
+ uses: actions/upload-artifact@v4
58
+ with:
59
+ name: pydynox-${{ inputs.version }}-cp${{ matrix.python }}-manylinux-aarch64
60
+ path: dist/*.whl
61
+
62
+ build-macos:
63
+ name: Build macOS ${{ matrix.target }} cp${{ matrix.python }}
64
+ runs-on: macos-latest
65
+ strategy:
66
+ matrix:
67
+ python: ["3.11", "3.12", "3.13", "3.14"]
68
+ target: [x86_64-apple-darwin, aarch64-apple-darwin]
69
+ steps:
70
+ - uses: actions/checkout@v4
71
+
72
+ - name: Build wheels
73
+ uses: PyO3/maturin-action@v1
74
+ with:
75
+ target: ${{ matrix.target }}
76
+ args: --release --out dist -i python${{ matrix.python }}
77
+ sccache: true
78
+
79
+ - name: Upload wheels
80
+ uses: actions/upload-artifact@v4
81
+ with:
82
+ name: pydynox-${{ inputs.version }}-cp${{ matrix.python }}-macos-${{ matrix.target }}
83
+ path: dist/*.whl
84
+
85
+ build-sdist:
86
+ name: Build sdist
87
+ runs-on: ubuntu-latest
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+
91
+ - name: Build sdist
92
+ uses: PyO3/maturin-action@v1
93
+ with:
94
+ command: sdist
95
+ args: --out dist
96
+
97
+ - name: Upload sdist
98
+ uses: actions/upload-artifact@v4
99
+ with:
100
+ name: pydynox-${{ inputs.version }}-sdist
101
+ path: dist/*.tar.gz
102
+
103
+ publish:
104
+ name: Publish to PyPI
105
+ needs: [build-linux-x86, build-linux-arm, build-macos, build-sdist]
106
+ runs-on: ubuntu-latest
107
+ environment:
108
+ name: pypi
109
+ url: https://pypi.org/p/pydynox
110
+ steps:
111
+ - name: Download all artifacts
112
+ uses: actions/download-artifact@v4
113
+ with:
114
+ pattern: pydynox-${{ inputs.version }}-*
115
+ path: dist
116
+ merge-multiple: true
117
+
118
+ - name: List artifacts
119
+ run: ls -la dist/
120
+
121
+ - name: Publish to PyPI
122
+ uses: pypa/gh-action-pypi-publish@release/v1
123
+
124
+ # github-release:
125
+ # name: Create GitHub Release
126
+ # needs: [build-linux, build-musllinux, build-macos, build-sdist]
127
+ # runs-on: ubuntu-latest
128
+ # steps:
129
+ # - uses: actions/checkout@v4
130
+
131
+ # - name: Download all artifacts
132
+ # uses: actions/download-artifact@v4
133
+ # with:
134
+ # pattern: wheels-*
135
+ # path: dist
136
+ # merge-multiple: true
137
+
138
+ # - name: List artifacts
139
+ # run: ls -la dist/
140
+
141
+ # - name: Create Release
142
+ # uses: softprops/action-gh-release@v2
143
+ # with:
144
+ # tag_name: v${{ inputs.version }}
145
+ # name: Release v${{ inputs.version }}
146
+ # files: dist/*
147
+ # generate_release_notes: true
@@ -0,0 +1,84 @@
1
+ # Rust
2
+ /target/
3
+ **/*.rs.bk
4
+
5
+ /site/
6
+
7
+ # Python
8
+ __pycache__/
9
+ *.py[cod]
10
+ *$py.class
11
+ *.so
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # Virtual environments
31
+ .env
32
+ .venv/
33
+ env/
34
+ venv/
35
+ ENV/
36
+ .python-version
37
+
38
+ # Testing
39
+ .pytest_cache/
40
+ .coverage
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .hypothesis/
45
+ *.cover
46
+
47
+ # IDE - VSCode
48
+ .vscode/
49
+ *.code-workspace
50
+
51
+ # IDE - Kiro
52
+ .kiro/
53
+
54
+ # IDE - JetBrains
55
+ .idea/
56
+ *.iml
57
+
58
+ # IDE - Other
59
+ *.swp
60
+ *.swo
61
+ *~
62
+ .project
63
+ .pydevproject
64
+ .settings/
65
+
66
+ # OS
67
+ .DS_Store
68
+ .DS_Store?
69
+ ._*
70
+ .Spotlight-V100
71
+ .Trashes
72
+ ehthumbs.db
73
+ Thumbs.db
74
+
75
+ # maturin
76
+ *.whl
77
+
78
+ # Logs
79
+ *.log
80
+ logs/
81
+
82
+ # Local config
83
+ .env.local
84
+ .env.*.local
@@ -0,0 +1,143 @@
1
+ # AI Agent Instructions
2
+
3
+ This file helps AI coding assistants understand the pydynox project.
4
+
5
+ ## What is pydynox?
6
+
7
+ A fast DynamoDB ORM for Python. The core is written in Rust for speed, with Python bindings via PyO3.
8
+
9
+ ## Project Structure
10
+
11
+ This is an example of the structure. The project may have more files. Follow this pattern when adding new ones.
12
+
13
+ ```
14
+ pydynox/
15
+ ├── src/ # Rust code
16
+ │ ├── lib.rs # Main module, exports to Python
17
+ │ ├── client.rs # DynamoDB client
18
+ │ ├── basic_operations.rs # put, get, delete, update, query
19
+ │ ├── batch_operations.rs # batch_write, batch_get
20
+ │ └── transaction_operations.rs # transact_write
21
+ ├── python/pydynox/ # Python wrappers
22
+ │ ├── __init__.py # Public API exports
23
+ │ ├── client.py # DynamoDBClient wrapper
24
+ │ ├── query.py # QueryResult wrapper
25
+ │ └── transaction.py # Transaction wrapper
26
+ ├── tests/
27
+ │ ├── integration/ # Integration tests (need moto server)
28
+ │ └── python/ # Unit tests
29
+ └── Cargo.toml # Rust dependencies
30
+ ```
31
+
32
+ ## Critical: How to Build
33
+
34
+ **NEVER use `cargo build`**. This is a PyO3 project. Use maturin:
35
+
36
+ ```bash
37
+ # Development build
38
+ uv run maturin develop
39
+
40
+ # Release build (faster)
41
+ uv run maturin develop --release
42
+
43
+ # Build wheel for distribution
44
+ uv run maturin build --release
45
+ ```
46
+
47
+ ## How to Run Tests
48
+
49
+ ```bash
50
+ # All tests
51
+ uv run pytest tests/ -v
52
+
53
+ # Specific test file
54
+ uv run pytest tests/integration/operations/test_get_item.py -v
55
+
56
+ # Skip benchmarks
57
+ uv run pytest tests/ -v --ignore=tests/benchmark
58
+ ```
59
+
60
+ Tests use moto server (DynamoDB mock). The conftest.py starts it automatically.
61
+
62
+ ## Code Style
63
+
64
+ ### Rust
65
+
66
+ - Run `cargo fmt` before committing
67
+ - Run `cargo clippy -- -D warnings` to check for issues
68
+ - Add doc comments (`///`) to all public items
69
+ - Use `PyResult<T>` for functions that can fail
70
+
71
+ ### Python
72
+
73
+ - Follow PEP 8
74
+ - Use type hints everywhere
75
+ - Use Google-style docstrings
76
+ - Use plain functions for tests, not classes
77
+ - Use `pytest.mark.parametrize` for multiple test cases
78
+
79
+ ## Adding a New Feature
80
+
81
+ 1. Write Rust code in `src/`
82
+ 2. Export in `src/lib.rs`
83
+ 3. Create Python wrapper in `python/pydynox/`
84
+ 4. Export in `python/pydynox/__init__.py`
85
+ 5. Write tests in `tests/`
86
+
87
+ ## Python ↔ Rust Mapping
88
+
89
+ | Python | Rust |
90
+ |--------|------|
91
+ | `client.py` | `client.rs` |
92
+ | `query.py` | `basic_operations.rs` |
93
+ | `transaction.py` | `transaction_operations.rs` |
94
+
95
+ ## Importing Rust from Python
96
+
97
+ ```python
98
+ from pydynox import pydynox_core
99
+
100
+ # Use Rust classes
101
+ client = pydynox_core.DynamoDBClient(...)
102
+ ```
103
+
104
+ Never import from `_rust` or other private modules.
105
+
106
+ ## Common Mistakes to Avoid
107
+
108
+ 1. **Using `cargo build`** - Won't produce a usable Python module
109
+ 2. **Forgetting to export in `__init__.py`** - Users can't import it
110
+ 3. **Using test classes** - Use plain functions instead
111
+ 4. **Missing type hints** - Add them to all Python code
112
+ 5. **Missing doc comments** - Add them to all public Rust items
113
+
114
+ ## Writing Style
115
+
116
+ - Write simple English
117
+ - Short sentences
118
+ - No buzzwords (don't say "leverage", "utilize", "robust", etc.)
119
+ - Be direct and clear
120
+
121
+ ## Useful Commands
122
+
123
+ ```bash
124
+ # Format Rust code
125
+ cargo fmt
126
+
127
+ # Check Rust code
128
+ cargo clippy -- -D warnings
129
+
130
+ # Lint Python code
131
+ uv run ruff check python/ tests/
132
+
133
+ # Run specific test
134
+ uv run pytest tests/integration/operations/test_get_item.py -v
135
+
136
+ # Build release
137
+ uv run maturin develop --release
138
+ ```
139
+
140
+ ## Dependencies
141
+
142
+ - Rust: aws-sdk-dynamodb, pyo3, tokio
143
+ - Python: pytest, moto, boto3, hypothesis