Skip to content

Commit 1c67217

Browse files
chore: CI (#16) and a built-wheel install acceptance (#18) so the Python SDK is reproducible
CI (#16): the repo had no .github/workflows. Added .github/workflows/ci.yml — ubuntu, setup-python 3.12, pip install -e '.[test]', pytest — the same clean reproduction as locally (137 passed). Packed-install (#18): the JS packages have a tarball acceptance; Python had none. scripts/check-packed-install.sh + make packed-install: python -m build (sdist + wheel), install the WHEEL (not -e .) into a fresh venv, run the documented smoke (from coderifts import CodeRifts, read_decision — the public import is coderifts, not coderifts_sdk, though the PyPI name is coderifts-sdk), and pytest from a cwd outside the source tree so the INSTALLED package is exercised, not the working tree. Clean run: wheel 28603 bytes, smoke OK, 137 passed from the installed package.
1 parent d9915d6 commit 1c67217

5 files changed

Lines changed: 98 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.12'
21+
22+
- name: Install (editable + test extra)
23+
run: |
24+
python -m pip install -U pip
25+
python -m pip install -e '.[test]'
26+
27+
- name: Test
28+
run: pytest

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ All notable changes to `coderifts-sdk` are documented here.
77
- `[project.optional-dependencies] test = ["pytest>=7"]` so a fresh venv can
88
`pip install -e '.[test]'` and run `pytest`. Measured: pytest is the only
99
third-party import in `tests/`.
10+
- CI (`.github/workflows/ci.yml`): ubuntu, `pip install -e '.[test]'`, `pytest`.
11+
- Packed-install smoke (`scripts/check-packed-install.sh` / `make packed-install`):
12+
`python -m build`, install the wheel into a fresh venv, import the public
13+
entry, pytest against the installed package.
1014

1115
## [3.6.0]
1216

‎Makefile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.PHONY: test packed-install
2+
3+
# Fresh-venv reproduction (same as README Tests / CI).
4+
test:
5+
python3 -m pip install -e '.[test]'
6+
pytest
7+
8+
# Built-wheel reproduction (what would be published, not the working tree).
9+
packed-install:
10+
bash scripts/check-packed-install.sh

‎README.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ pip install -e '.[test]'
4747
pytest
4848
```
4949

50+
The published artifact (not the working tree) is checked by:
51+
52+
```bash
53+
make packed-install
54+
# or: bash scripts/check-packed-install.sh
55+
```
56+
57+
That runs `python -m build`, installs the **wheel** into a fresh venv, imports
58+
`from coderifts import CodeRifts` (README Quick start), then `pytest` against
59+
the installed package.
60+
5061
## Quick start
5162

5263
```python

‎scripts/check-packed-install.sh‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
# Pack → install the BUILT wheel into a fresh venv → documented smoke + pytest.
3+
#
4+
# The working tree is not the artifact. `python -m build` produces the sdist/wheel
5+
# that would be published; this script installs THAT wheel (not `pip install -e .`)
6+
# and imports the public entry (`from coderifts import CodeRifts` — README Quick start).
7+
# Pytest then runs against the installed package from a cwd that is not the source tree,
8+
# so local ./coderifts cannot shadow site-packages.
9+
set -euo pipefail
10+
11+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
12+
TMP="$(mktemp -d "${TMPDIR:-/tmp}/py-sdk-pack-XXXX")"
13+
cleanup() { rm -rf "$TMP"; }
14+
trap cleanup EXIT
15+
16+
echo "build venv : $TMP/build"
17+
python3 -m venv "$TMP/build"
18+
"$TMP/build/bin/python" -m pip install -U pip build >/dev/null
19+
"$TMP/build/bin/python" -m build --outdir "$TMP/dist" "$ROOT"
20+
21+
WHEEL="$(ls "$TMP/dist"/coderifts_sdk-*.whl)"
22+
SDIST="$(ls "$TMP/dist"/coderifts_sdk-*.tar.gz)"
23+
echo "wheel : $(basename "$WHEEL") ($(wc -c < "$WHEEL" | tr -d ' ') bytes)"
24+
echo "sdist : $(basename "$SDIST") ($(wc -c < "$SDIST" | tr -d ' ') bytes)"
25+
26+
echo "install venv : $TMP/run"
27+
python3 -m venv "$TMP/run"
28+
"$TMP/run/bin/python" -m pip install -U pip >/dev/null
29+
"$TMP/run/bin/python" -m pip install "$WHEEL"
30+
31+
# Documented public entry (README Quick start). The PyPI name is coderifts-sdk;
32+
# the import is coderifts — not coderifts_sdk.
33+
"$TMP/run/bin/python" -c "
34+
from coderifts import CodeRifts, read_decision, CodeRiftsError
35+
assert callable(CodeRifts)
36+
assert callable(read_decision)
37+
print('ok import coderifts CodeRifts,read_decision')
38+
"
39+
40+
# Pytest against the installed wheel. Cwd is TMP so the source tree is not on
41+
# sys.path as a first-party package; tests live in ROOT/tests.
42+
"$TMP/run/bin/python" -m pip install 'pytest>=7' >/dev/null
43+
(cd "$TMP" && "$TMP/run/bin/python" -m pytest "$ROOT/tests" -q)
44+
45+
echo "packed install smoke: OK"

0 commit comments

Comments
 (0)