xlinject 0.2.0a1__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.
- xlinject-0.2.0a1/.github/workflows/ci.yml +46 -0
- xlinject-0.2.0a1/.github/workflows/publish-pypi.yml +57 -0
- xlinject-0.2.0a1/.gitignore +24 -0
- xlinject-0.2.0a1/.pre-commit-config.yaml +16 -0
- xlinject-0.2.0a1/AGENTS.md +37 -0
- xlinject-0.2.0a1/CONTRIBUTING.md +51 -0
- xlinject-0.2.0a1/LICENSE +674 -0
- xlinject-0.2.0a1/PKG-INFO +812 -0
- xlinject-0.2.0a1/README.md +113 -0
- xlinject-0.2.0a1/SECURITY.md +39 -0
- xlinject-0.2.0a1/docs/ARCHITECTURE.md +40 -0
- xlinject-0.2.0a1/docs/INDEX.md +10 -0
- xlinject-0.2.0a1/docs/PUBLISHING.md +52 -0
- xlinject-0.2.0a1/docs/ROADMAP.md +36 -0
- xlinject-0.2.0a1/docs/USAGE.md +216 -0
- xlinject-0.2.0a1/pyproject.toml +75 -0
- xlinject-0.2.0a1/scripts/check_plain_text_style.py +84 -0
- xlinject-0.2.0a1/src/xlinject/__init__.py +37 -0
- xlinject-0.2.0a1/src/xlinject/cellrefs.py +73 -0
- xlinject-0.2.0a1/src/xlinject/cli_write_cells.py +161 -0
- xlinject-0.2.0a1/src/xlinject/highlevel.py +314 -0
- xlinject-0.2.0a1/src/xlinject/injector.py +493 -0
- xlinject-0.2.0a1/src/xlinject/workbook_map.py +51 -0
- xlinject-0.2.0a1/tests/.gitkeep +0 -0
- xlinject-0.2.0a1/tests/test_cellrefs.py +28 -0
- xlinject-0.2.0a1/tests/test_injector.py +365 -0
- xlinject-0.2.0a1/uv.lock +933 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["**"]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
quality:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.11"
|
|
23
|
+
|
|
24
|
+
- name: Setup uv
|
|
25
|
+
uses: astral-sh/setup-uv@v6
|
|
26
|
+
|
|
27
|
+
- name: Sync dependencies
|
|
28
|
+
run: uv sync --dev
|
|
29
|
+
|
|
30
|
+
- name: Pre-commit
|
|
31
|
+
run: uv run pre-commit run --all-files
|
|
32
|
+
|
|
33
|
+
- name: Ruff
|
|
34
|
+
run: uv run ruff check .
|
|
35
|
+
|
|
36
|
+
- name: MyPy
|
|
37
|
+
run: uv run mypy .
|
|
38
|
+
|
|
39
|
+
- name: Pytest
|
|
40
|
+
run: uv run pytest -q
|
|
41
|
+
|
|
42
|
+
- name: Build package
|
|
43
|
+
run: uv build
|
|
44
|
+
|
|
45
|
+
- name: Twine check
|
|
46
|
+
run: uv run twine check dist/*
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Setup Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.11"
|
|
22
|
+
|
|
23
|
+
- name: Setup uv
|
|
24
|
+
uses: astral-sh/setup-uv@v6
|
|
25
|
+
|
|
26
|
+
- name: Sync dependencies
|
|
27
|
+
run: uv sync --dev
|
|
28
|
+
|
|
29
|
+
- name: Build
|
|
30
|
+
run: uv build
|
|
31
|
+
|
|
32
|
+
- name: Twine check
|
|
33
|
+
run: uv run twine check dist/*
|
|
34
|
+
|
|
35
|
+
- name: Upload dist artifacts
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: python-package-distributions
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
publish:
|
|
42
|
+
needs: build
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
permissions:
|
|
45
|
+
id-token: write
|
|
46
|
+
environment:
|
|
47
|
+
name: pypi
|
|
48
|
+
url: https://pypi.org/p/xlinject
|
|
49
|
+
steps:
|
|
50
|
+
- name: Download dist artifacts
|
|
51
|
+
uses: actions/download-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: python-package-distributions
|
|
54
|
+
path: dist/
|
|
55
|
+
|
|
56
|
+
- name: Publish package to PyPI
|
|
57
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
*.so
|
|
7
|
+
*.egg-info/
|
|
8
|
+
|
|
9
|
+
# Virtual/env
|
|
10
|
+
.venv/
|
|
11
|
+
|
|
12
|
+
# Tooling caches
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
.mypy_cache/
|
|
15
|
+
.ruff_cache/
|
|
16
|
+
|
|
17
|
+
# Editors/OS
|
|
18
|
+
.vscode/
|
|
19
|
+
.idea/
|
|
20
|
+
.DS_Store
|
|
21
|
+
|
|
22
|
+
# Build artifacts
|
|
23
|
+
dist/
|
|
24
|
+
build/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: check-merge-conflict
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
|
|
9
|
+
- repo: local
|
|
10
|
+
hooks:
|
|
11
|
+
- id: plain-text-style
|
|
12
|
+
name: plain-text-style (no em dash, no emoji)
|
|
13
|
+
entry: python scripts/check_plain_text_style.py
|
|
14
|
+
language: python
|
|
15
|
+
types_or: [markdown, text, python, toml, yaml, json]
|
|
16
|
+
exclude: ^scripts/check_plain_text_style.py$
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This repository is prepared for human + AI collaboration.
|
|
4
|
+
|
|
5
|
+
## Current phase
|
|
6
|
+
|
|
7
|
+
- API-first library phase with generalized cell-injection helpers.
|
|
8
|
+
- One optional generic CLI command is available (`xlinject-write-cells`).
|
|
9
|
+
- Recalculation safety policy is part of default high-level write behavior.
|
|
10
|
+
- Contributors should avoid adding unplanned code paths without first updating `docs/ROADMAP.md`.
|
|
11
|
+
|
|
12
|
+
## Working agreements for coding agents
|
|
13
|
+
|
|
14
|
+
1. Keep edits surgical and scope-limited to the requested task.
|
|
15
|
+
2. Prefer preserving existing structure and naming.
|
|
16
|
+
3. Do not introduce broad refactors during feature work.
|
|
17
|
+
4. When touching behavior, update docs in `docs/` in the same change.
|
|
18
|
+
5. If changing workbook XML write logic in future phases, include tests that validate unchanged neighboring XML structure.
|
|
19
|
+
6. Do not add dependencies without documenting rationale in PR description.
|
|
20
|
+
7. Avoid em dashes (`--`) and avoid emoji usage in repository text/docs.
|
|
21
|
+
8. Keep the library API as the primary interface; avoid adding task-specific wrappers in CLI.
|
|
22
|
+
|
|
23
|
+
## Implementation guardrails (future code)
|
|
24
|
+
|
|
25
|
+
- Prioritize XML node-level mutation over full workbook reconstruction.
|
|
26
|
+
- Preserve unsupported/unknown tags and attributes exactly.
|
|
27
|
+
- Keep generated XML ordering deterministic and Excel-compatible.
|
|
28
|
+
- Treat dynamic array and formula metadata as immutable unless explicitly targeted.
|
|
29
|
+
- Preserve `mc:Ignorable` namespace compatibility on all worksheet rewrites.
|
|
30
|
+
- Maintain recalculation safety (`calcChain` handling + workbook `calcPr` policy).
|
|
31
|
+
|
|
32
|
+
## Release and packaging expectations
|
|
33
|
+
|
|
34
|
+
- Use `uv` for dependency and environment management.
|
|
35
|
+
- Keep the package install/build flow in `pyproject.toml`.
|
|
36
|
+
- Prefer small, incremental PRs aligned with roadmap phases.
|
|
37
|
+
- Keep PyPI release workflow healthy (CI build + twine checks + trusted publisher flow).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for contributing to `xlinject`.
|
|
4
|
+
|
|
5
|
+
Current direction: API-first Python library with one optional generic CLI command.
|
|
6
|
+
|
|
7
|
+
## License and contributions
|
|
8
|
+
|
|
9
|
+
This project is licensed under GPLv3 (or later).
|
|
10
|
+
By submitting contributions, you agree your changes are provided under the same license.
|
|
11
|
+
|
|
12
|
+
## Setup
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uv sync --dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Before opening a PR
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
uv run ruff check .
|
|
22
|
+
uv run mypy .
|
|
23
|
+
uv run pytest -q
|
|
24
|
+
uv build
|
|
25
|
+
uv run twine check dist/*
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Contribution rules
|
|
29
|
+
|
|
30
|
+
- Keep changes focused and small.
|
|
31
|
+
- Update relevant docs under `docs/` when behavior or plan changes.
|
|
32
|
+
- Add tests with behavior changes.
|
|
33
|
+
- Avoid unrelated cleanup in feature PRs.
|
|
34
|
+
- Prefer extending reusable high-level helpers over adding app-specific logic.
|
|
35
|
+
- Keep CLI changes minimal and generic. The library API is the primary interface.
|
|
36
|
+
- Use anonymized/synthetic data only in docs, tests, and issue reports.
|
|
37
|
+
|
|
38
|
+
## API-first guidance
|
|
39
|
+
|
|
40
|
+
- Favor `inject_cells` + helper functions (`build_column_cell_map`, `merge_cell_maps`, `to_excel_serial`).
|
|
41
|
+
- Preserve formula and workbook metadata safety guarantees.
|
|
42
|
+
- If recalculation behavior changes, include tests covering workbook `calcPr` and cache behavior.
|
|
43
|
+
|
|
44
|
+
## Branch naming
|
|
45
|
+
|
|
46
|
+
Suggested prefixes:
|
|
47
|
+
|
|
48
|
+
- `feat/`
|
|
49
|
+
- `fix/`
|
|
50
|
+
- `docs/`
|
|
51
|
+
- `chore/`
|