Skip to content

Commit bd18a10

Browse files
authored
Switch to pip-compile pinned dependencies (v1.3.0) (#28)
* Fix mermaid rendering: wide container width for landscape Gantt charts; ac:width on push; --no-cache on --rebuild * Switch to pip-compile pinned dependencies Introduce requirements.in / requirements-dev.in as the editable source of truth for direct dependencies; requirements.txt and requirements-dev.txt are now pip-compile-generated lockfiles with all transitive deps pinned. Update test CI to install from both lockfiles instead of adding pytest and pytest-cov ad-hoc. Dependabot auto-detects .in files and will regenerate the lockfiles when bumping deps. * docs: update README, CLAUDE.md, and SECURITY.md for pip-compile lockfiles * chore: bump version to 1.3.0
1 parent 6f2182d commit bd18a10

10 files changed

Lines changed: 97 additions & 16 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
-v ${{ github.workspace }}:/workspace \
2424
-w /workspace \
2525
dhi.io/python:3.13-debian13-dev \
26-
sh -c "pip install -r requirements.txt pytest pytest-cov -q && pytest tests/ -v --cov=py_conf_sync --cov-report=term-missing --cov-report=xml --cov-fail-under=100"
26+
sh -c "pip install -q -r requirements.txt -r requirements-dev.txt && pytest tests/ -v --cov=py_conf_sync --cov-report=term-missing --cov-report=xml --cov-fail-under=100"
2727
2828
- name: Upload coverage to Codecov
2929
uses: codecov/codecov-action@v6

CLAUDE.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,28 @@ py_conf_sync.py # Entire tool — CLI, API client, format con
2222
csync # Docker wrapper — use this instead of calling py_conf_sync.py directly
2323
.py-conf-sync.config.example.yaml # Example config — copy to .py-conf-sync.config.yaml and fill in values
2424
.csync.env.example # Credential template — copy to ~/.csync.env and fill in values
25-
requirements.txt # Python dependencies
25+
requirements.in # Direct runtime dependencies (editable — add/change bounds here)
26+
requirements.txt # Pinned lockfile generated by pip-compile — do not edit directly
27+
requirements-dev.in # Direct test/dev dependencies (editable)
28+
requirements-dev.txt # Pinned dev lockfile generated by pip-compile — do not edit directly
2629
tests/ # pytest test suite
2730
Dockerfile # Uses Docker Hardened Images (dhi.io/python:3.13)
2831
```
2932

3033
The tool runs as a plain script — no `setup.py`/`pyproject.toml`, no packaging. The Docker
3134
wrapper handles dependencies.
3235

36+
To regenerate the lockfiles after editing a `.in` file (run inside Docker per project convention):
37+
38+
```bash
39+
docker run --rm --network=host -v $(pwd):/work -w /work dhi.io/python:3.13-debian13-dev \
40+
sh -c "pip install -q pip-tools && \
41+
pip-compile --strip-extras -o requirements.txt requirements.in && \
42+
pip-compile --strip-extras -o requirements-dev.txt requirements-dev.in"
43+
```
44+
45+
Dependabot regenerates them automatically on its weekly dep-bump PRs.
46+
3347
## Key architecture
3448

3549
Everything lives in `py_conf_sync.py`. The main sections are:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ It builds the image on first use and mounts your current directory into the cont
7373
Absolute paths in arguments are automatically mounted into the container, so
7474
cross-repo operations work without any extra flags.
7575

76-
**After updating `py_conf_sync.py` or `requirements.txt`**, rebuild the image:
76+
**After updating `py_conf_sync.py` or `requirements.in`**, rebuild the image:
7777

7878
```bash
7979
./csync --rebuild pull

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ receive a response within **5 business days** acknowledging the report.
4040

4141
## Supply chain
4242

43-
- Dependencies are monitored by Dependabot and updated weekly
43+
- Dependencies are pinned via pip-compile lockfiles (`requirements.txt`, `requirements-dev.txt`) and updated weekly by Dependabot
4444
- All merges to `main` require a passing test suite
4545
- Docker images are published via GitHub Actions with pinned action versions
4646
- Images are tagged by semver and `latest` tracks the current release

csync

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ PUBLISHED_IMAGE="ghcr.io/kellenmurphy/py-conf-sync:latest"
1010

1111
if [[ "${1:-}" == "--rebuild" ]]; then
1212
shift
13-
docker build -t "$LOCAL_IMAGE" "$SCRIPT_DIR" >&2
13+
docker build --no-cache --network=host -t "$LOCAL_IMAGE" "$SCRIPT_DIR" >&2
1414
IMAGE="$LOCAL_IMAGE"
1515
elif docker image inspect "$LOCAL_IMAGE" >/dev/null 2>&1; then
1616
IMAGE="$LOCAL_IMAGE"
1717
elif docker pull "$PUBLISHED_IMAGE" >/dev/null 2>&1; then
1818
IMAGE="$PUBLISHED_IMAGE"
1919
else
2020
echo "[py-conf-sync] No image found — building locally..." >&2
21-
docker build -q -t "$LOCAL_IMAGE" "$SCRIPT_DIR" >&2
21+
docker build --network=host -q -t "$LOCAL_IMAGE" "$SCRIPT_DIR" >&2
2222
IMAGE="$LOCAL_IMAGE"
2323
fi
2424

py_conf_sync.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from markdownify import markdownify as md
2727
from dotenv import load_dotenv
2828

29-
__version__ = "1.0.0"
29+
__version__ = "1.3.0"
3030

3131
# ---------------------------------------------------------------------------
3232
# Config helpers
@@ -809,7 +809,7 @@ def _replace(m):
809809
"<!DOCTYPE html><html>"
810810
"<head><style>"
811811
"body{margin:0;background:white}"
812-
"#diagram{display:inline-block;padding:16px;background:white}"
812+
"#diagram{display:block;padding:16px;background:white;width:1400px}"
813813
"</style></head><body>"
814814
f'<div id="diagram" class="mermaid">{escaped}</div>'
815815
f"<script>{mermaid_js}</script>"
@@ -820,7 +820,8 @@ def _replace(m):
820820
# so it renders at natural size instead of 100%-of-container.
821821
"var svg=document.querySelector('#diagram svg');"
822822
"if(svg){var vb=svg.viewBox.baseVal;"
823-
"if(vb&&vb.width>0){svg.setAttribute('width',vb.width+'px');svg.setAttribute('height',vb.height+'px');}}"
823+
"if(vb&&vb.width>0){svg.setAttribute('width',vb.width+'px');svg.setAttribute('height',vb.height+'px');"
824+
"document.getElementById('diagram').style.width=Math.max(vb.width+32,1400)+'px';}}"
824825
"document.title='ready';"
825826
"}).catch(function(e){"
826827
"document.title='error:'+e.message;"
@@ -851,7 +852,7 @@ def _replace(m):
851852

852853
counter[0] += 1
853854
txt_file = tmp_dir / f"mermaid-{digest}.txt"
854-
return f"![Diagram {counter[0]}]({output_file})\n\n[Mermaid source]({txt_file})"
855+
return f'![Diagram {counter[0]}]({output_file} "ac:width=900")\n\n[Mermaid source]({txt_file})'
855856

856857
try:
857858
result = _MERMAID_FENCE_RE.sub(_replace, body)

requirements-dev.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pytest>=8.0
2+
pytest-cov>=6.0

requirements-dev.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.13
3+
# by the following command:
4+
#
5+
# pip-compile --output-file=requirements-dev.txt --strip-extras requirements-dev.in
6+
#
7+
coverage==7.14.1
8+
# via pytest-cov
9+
iniconfig==2.3.0
10+
# via pytest
11+
packaging==26.2
12+
# via pytest
13+
pluggy==1.6.0
14+
# via
15+
# pytest
16+
# pytest-cov
17+
pygments==2.20.0
18+
# via pytest
19+
pytest==9.0.3
20+
# via
21+
# -r requirements-dev.in
22+
# pytest-cov
23+
pytest-cov==7.1.0
24+
# via -r requirements-dev.in

requirements.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
requests>=2.34.2
2+
markdownify>=1.2.2
3+
markdown>=3.10.2
4+
python-dotenv>=1.2.2
5+
PyYAML>=6.0.3
6+
playwright>=1.60.0

requirements.txt

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
1-
requests>=2.34.2
2-
markdownify>=1.2.2
3-
markdown>=3.10.2
4-
python-dotenv>=1.2.2
5-
PyYAML>=6.0.3
6-
playwright>=1.60.0
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.13
3+
# by the following command:
4+
#
5+
# pip-compile --output-file=requirements.txt --strip-extras requirements.in
6+
#
7+
beautifulsoup4==4.14.3
8+
# via markdownify
9+
certifi==2026.5.20
10+
# via requests
11+
charset-normalizer==3.4.7
12+
# via requests
13+
greenlet==3.5.1
14+
# via playwright
15+
idna==3.17
16+
# via requests
17+
markdown==3.10.2
18+
# via -r requirements.in
19+
markdownify==1.2.2
20+
# via -r requirements.in
21+
playwright==1.60.0
22+
# via -r requirements.in
23+
pyee==13.0.1
24+
# via playwright
25+
python-dotenv==1.2.2
26+
# via -r requirements.in
27+
pyyaml==6.0.3
28+
# via -r requirements.in
29+
requests==2.34.2
30+
# via -r requirements.in
31+
six==1.17.0
32+
# via markdownify
33+
soupsieve==2.8.4
34+
# via beautifulsoup4
35+
typing-extensions==4.15.0
36+
# via
37+
# beautifulsoup4
38+
# pyee
39+
urllib3==2.7.0
40+
# via requests

0 commit comments

Comments
 (0)