Skip to content

Commit ebf66fb

Browse files
author
Matthias Zimmermann
committed
feat: update default btl to 100 for create and update entity
1 parent 31b0962 commit ebf66fb

File tree

2 files changed

+54
-21
lines changed

2 files changed

+54
-21
lines changed

PUBLISHING.md

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export TESTPYPI_TOKEN="pypi-..."
102102

103103
## Publishing Workflow
104104

105-
### Using scripts/publish.sh (Interactive)
105+
### Publish to TestPyPi
106106

107107
1. Ensure you're on the correct branch with latest changes
108108

@@ -127,8 +127,7 @@ Run full quality check (iterate until all green)
127127
./scripts/check-all.sh
128128
```
129129

130-
131-
4. Commit version changes
130+
5. Commit version changes
132131

133132
```bash
134133
git status # check that this matches with your expectation
@@ -137,8 +136,7 @@ git commit -m "chore: prepare for <latest-version> release"
137136
git push
138137
```
139138

140-
141-
5. Run the publishing wizard
139+
6. Run the publishing wizard
142140
```bash
143141
./scripts/publish.sh
144142
```
@@ -155,31 +153,62 @@ The script will:
155153
2) Publish to PyPI (production)
156154
3) Exit
157155

158-
6. First time: Choose option 1 (TestPyPI)
156+
7. First time: Choose option 1 (TestPyPI)
159157
Enter your TESTPYPI_TOKEN when prompted (if not in environment)
160158

161-
7. Test installation from TestPyPI
162-
Open a terminal outside the IDE
159+
8. Test installation from TestPyPI
160+
Open a terminal outside the IDE.
161+
When the package arkiv-sdk is installed already remove it first.
163162

164163
```bash
165-
pip install --index-url https://test.pypi.org/simple/ \
166-
--extra-index-url https://pypi.org/simple \
167-
arkiv-sdk
164+
uv pip uninstall arkiv-sdk testcontainers
168165
```
169166

170-
8. Verify it works
167+
Install the dependencies for local development.
168+
171169
```bash
172-
python -c "from arkiv import Arkiv, __version__; print(f'Version: {__version__}')"
170+
uv pip install testcontainers
171+
uv pip install -i https://test.pypi.org/simple/ arkiv-sdk
172+
uv run python -c "from arkiv import Arkiv, __version__; print(f'Version: {__version__}')"
173173
```
174174

175-
# 9. If all good, run publish script again for production
175+
9. Do some optional smoke tests using the library
176+
177+
Check the package interactively.
178+
179+
```bash
180+
uv run python
181+
```
182+
183+
Python session in interactive shell.
184+
185+
```python
186+
from arkiv import Arkiv
187+
client = Arkiv()
188+
entity_key, _ = client.arkiv.create_entity(payload=b'Hello world!', btl=1000)
189+
client.arkiv.get_entity(entity_key)
190+
```
191+
192+
In case of errors/issues analyize and fix them, then repeat publish to TestPyPi.
193+
Once all checks pass, publish to PyPi (production).
194+
195+
### Publish to PyPi (Production)
196+
197+
1. If all good on TestPyPi, run publish script again for production
198+
199+
```bash
176200
./scripts/publish.sh
177-
# Choose option 2 (PyPI)
178-
# Enter your PYPI_TOKEN when prompted (if not in environment)
201+
````
179202

180-
# 10. Create Git tag
203+
Choose option 2 (PyPI)
204+
205+
206+
2. Create Git tag
207+
208+
```bash
181209
git tag -a v1.0.0a2 -m "Release version 1.0.0a2"
182210
git push origin v1.0.0a2
211+
```
183212

184213
# 11. Create GitHub release
185214
gh release create v1.0.0a2 \

src/arkiv/module.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
class ArkivModule:
5151
"""Basic Arkiv module for entity management operations."""
5252

53+
BTL_DEFAULT = (
54+
1000 # Default blocks to live for created entities (~30 mins with 2s blocks)
55+
)
56+
5357
def __init__(self, client: "Arkiv") -> None:
5458
"""Initialize Arkiv module with client reference."""
5559
self.client = client
@@ -106,7 +110,7 @@ def create_entity(
106110
self,
107111
payload: bytes | None = None,
108112
annotations: Annotations | None = None,
109-
btl: int = 0,
113+
btl: int = BTL_DEFAULT,
110114
tx_params: TxParams | None = None,
111115
) -> tuple[EntityKey, TxHash]:
112116
"""
@@ -115,7 +119,7 @@ def create_entity(
115119
Args:
116120
payload: Optional data payload for the entity
117121
annotations: Optional key-value annotations
118-
btl: Blocks to live (default: 0)
122+
btl: Blocks to live (default: 1000, ~30 minutes with 2s blocks)
119123
tx_params: Optional additional transaction parameters
120124
121125
Returns:
@@ -150,7 +154,7 @@ def update_entity(
150154
entity_key: EntityKey,
151155
payload: bytes | None = None,
152156
annotations: Annotations | None = None,
153-
btl: int = 0,
157+
btl: int = BTL_DEFAULT,
154158
tx_params: TxParams | None = None,
155159
) -> TxHash:
156160
"""
@@ -160,7 +164,7 @@ def update_entity(
160164
entity_key: The entity key of the entity to update
161165
payload: Optional new data payload for the entity, existing payload will be replaced
162166
annotations: Optional new key-value annotations, existing annotations will be replaced
163-
btl: Blocks to live (default: 0)
167+
btl: Blocks to live (default: 1000, ~30 minutes with 2s blocks)
164168
tx_params: Optional additional transaction parameters
165169
166170
Returns:

0 commit comments

Comments
 (0)