lumberjack-py 0.4.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.
- lumberjack_py-0.4.0/.dockerignore +46 -0
- lumberjack_py-0.4.0/.env.example +5 -0
- lumberjack_py-0.4.0/.github/CODEOWNERS +16 -0
- lumberjack_py-0.4.0/.github/ISSUE_TEMPLATE/bug_report.yml +98 -0
- lumberjack_py-0.4.0/.github/ISSUE_TEMPLATE/config.yml +4 -0
- lumberjack_py-0.4.0/.github/ISSUE_TEMPLATE/feature_request.yml +38 -0
- lumberjack_py-0.4.0/.github/PULL_REQUEST_TEMPLATE.md +35 -0
- lumberjack_py-0.4.0/.github/workflows/ci.yml +77 -0
- lumberjack_py-0.4.0/.github/workflows/package.yml +59 -0
- lumberjack_py-0.4.0/.github/workflows/release.yml +66 -0
- lumberjack_py-0.4.0/.github/workflows/test-release.yml +32 -0
- lumberjack_py-0.4.0/.gitignore +46 -0
- lumberjack_py-0.4.0/AGENTS.md +330 -0
- lumberjack_py-0.4.0/CHANGELOG.md +119 -0
- lumberjack_py-0.4.0/CLAUDE.md +1 -0
- lumberjack_py-0.4.0/CODE_OF_CONDUCT.md +133 -0
- lumberjack_py-0.4.0/CONTRIBUTING.md +196 -0
- lumberjack_py-0.4.0/LICENSE +21 -0
- lumberjack_py-0.4.0/PKG-INFO +197 -0
- lumberjack_py-0.4.0/README.md +146 -0
- lumberjack_py-0.4.0/README.zh-CN.md +128 -0
- lumberjack_py-0.4.0/SECURITY.md +21 -0
- lumberjack_py-0.4.0/docker/Dockerfile +118 -0
- lumberjack_py-0.4.0/docker/build-local.sh +61 -0
- lumberjack_py-0.4.0/docker/build-multiarch.sh +74 -0
- lumberjack_py-0.4.0/docker/docker-compose.yml +29 -0
- lumberjack_py-0.4.0/docs/index.md +12 -0
- lumberjack_py-0.4.0/docs/splitter-strategies.md +37 -0
- lumberjack_py-0.4.0/docs/splitter-strategies.zh-CN.md +32 -0
- lumberjack_py-0.4.0/pyproject.toml +81 -0
- lumberjack_py-0.4.0/ruff.toml +30 -0
- lumberjack_py-0.4.0/src/lumberjack/__init__.py +4 -0
- lumberjack_py-0.4.0/src/lumberjack/_internal/__init__.py +1 -0
- lumberjack_py-0.4.0/src/lumberjack/_internal/block_splitter.py +504 -0
- lumberjack_py-0.4.0/src/lumberjack/_internal/formats.py +55 -0
- lumberjack_py-0.4.0/src/lumberjack/_internal/options.py +112 -0
- lumberjack_py-0.4.0/src/lumberjack/_internal/pipeline.py +218 -0
- lumberjack_py-0.4.0/src/lumberjack/_internal/rendering.py +12 -0
- lumberjack_py-0.4.0/src/lumberjack/block.py +192 -0
- lumberjack_py-0.4.0/src/lumberjack/cli.py +142 -0
- lumberjack_py-0.4.0/src/lumberjack/finalizer.py +103 -0
- lumberjack_py-0.4.0/src/lumberjack/lumberjack.py +66 -0
- lumberjack_py-0.4.0/src/lumberjack/models.py +316 -0
- lumberjack_py-0.4.0/src/lumberjack/normalizer.py +16 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/__init__.py +24 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/auto.py +139 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/docx/__init__.py +3 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/docx/parser.py +422 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/html/__init__.py +3 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/html/parser.py +479 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/html/table_parser.py +361 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/markdown/__init__.py +15 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/markdown/parser.py +1037 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/markdown/plugins/__init__.py +3 -0
- lumberjack_py-0.4.0/src/lumberjack/parser/markdown/plugins/brackets_plugin.py +93 -0
- lumberjack_py-0.4.0/src/lumberjack/protocols.py +43 -0
- lumberjack_py-0.4.0/src/lumberjack/py.typed +0 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/__init__.py +32 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/base.py +336 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/context.py +118 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/exact.py +365 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/incremental.py +518 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/section.py +54 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/sibling.py +21 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/subtree.py +22 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/topology/__init__.py +1 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/topology/section.py +52 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/topology/sibling.py +114 -0
- lumberjack_py-0.4.0/src/lumberjack/splitter/topology/subtree.py +64 -0
- lumberjack_py-0.4.0/src/lumberjack/tokenizer.py +194 -0
- lumberjack_py-0.4.0/src/lumberjack/transformer.py +103 -0
- lumberjack_py-0.4.0/src/lumberjack/web/__init__.py +5 -0
- lumberjack_py-0.4.0/src/lumberjack/web/__main__.py +22 -0
- lumberjack_py-0.4.0/src/lumberjack/web/app.py +43 -0
- lumberjack_py-0.4.0/src/lumberjack/web/routes.py +205 -0
- lumberjack_py-0.4.0/tests/__init__.py +1 -0
- lumberjack_py-0.4.0/tests/_internal/__init__.py +0 -0
- lumberjack_py-0.4.0/tests/_internal/test_pipeline.py +97 -0
- lumberjack_py-0.4.0/tests/_internal/test_rendering.py +7 -0
- lumberjack_py-0.4.0/tests/conftest.py +3 -0
- lumberjack_py-0.4.0/tests/contracts/test_cli_contract.py +51 -0
- lumberjack_py-0.4.0/tests/contracts/test_public_api_contract.py +81 -0
- lumberjack_py-0.4.0/tests/contracts/test_web_contract.py +69 -0
- lumberjack_py-0.4.0/tests/fixtures/docx/sample.docx +0 -0
- lumberjack_py-0.4.0/tests/fixtures/markdown/commonmark-spec.md +1146 -0
- lumberjack_py-0.4.0/tests/fixtures/markdown/large_table.md +32 -0
- lumberjack_py-0.4.0/tests/fixtures/markdown/sample.md +19 -0
- lumberjack_py-0.4.0/tests/helpers.py +190 -0
- lumberjack_py-0.4.0/tests/parser/__init__.py +0 -0
- lumberjack_py-0.4.0/tests/parser/docx/__init__.py +0 -0
- lumberjack_py-0.4.0/tests/parser/docx/test_docx_parser.py +132 -0
- lumberjack_py-0.4.0/tests/parser/html/__init__.py +0 -0
- lumberjack_py-0.4.0/tests/parser/html/test_html_parser.py +440 -0
- lumberjack_py-0.4.0/tests/parser/html/test_table_integration.py +244 -0
- lumberjack_py-0.4.0/tests/parser/markdown/__init__.py +0 -0
- lumberjack_py-0.4.0/tests/parser/markdown/test_markdown_parser.py +831 -0
- lumberjack_py-0.4.0/tests/splitter/__init__.py +0 -0
- lumberjack_py-0.4.0/tests/splitter/test_max_heading_level.py +176 -0
- lumberjack_py-0.4.0/tests/splitter/test_render_headings.py +269 -0
- lumberjack_py-0.4.0/tests/splitter/test_splitter.py +2685 -0
- lumberjack_py-0.4.0/tests/splitter/test_token_counting_modes.py +453 -0
- lumberjack_py-0.4.0/tests/test_api.py +206 -0
- lumberjack_py-0.4.0/tests/test_cli.py +39 -0
- lumberjack_py-0.4.0/tests/test_distribution.py +106 -0
- lumberjack_py-0.4.0/tests/test_docker.py +11 -0
- lumberjack_py-0.4.0/tests/test_lumber_pipeline.py +107 -0
- lumberjack_py-0.4.0/tests/web/__init__.py +0 -0
- lumberjack_py-0.4.0/tests/web/test_web.py +505 -0
- lumberjack_py-0.4.0/ty.toml +42 -0
- lumberjack_py-0.4.0/uv.lock +1541 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Python artifacts
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info/
|
|
8
|
+
.venv/
|
|
9
|
+
.env
|
|
10
|
+
.env.*
|
|
11
|
+
!.env.example
|
|
12
|
+
|
|
13
|
+
# Frontend build artefacts (rebuilt inside Docker)
|
|
14
|
+
lumberjack_webui/node_modules/
|
|
15
|
+
lumberjack_webui/dist/
|
|
16
|
+
src/lumberjack/web/static/
|
|
17
|
+
|
|
18
|
+
# Test and dev artifacts
|
|
19
|
+
tests/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
script/
|
|
23
|
+
output/
|
|
24
|
+
data/
|
|
25
|
+
|
|
26
|
+
# IDE
|
|
27
|
+
.idea/
|
|
28
|
+
.vscode/
|
|
29
|
+
*.swp
|
|
30
|
+
*.swo
|
|
31
|
+
|
|
32
|
+
# OS
|
|
33
|
+
.DS_Store
|
|
34
|
+
Thumbs.db
|
|
35
|
+
|
|
36
|
+
# Git
|
|
37
|
+
.git/
|
|
38
|
+
.gitignore
|
|
39
|
+
|
|
40
|
+
# Docker
|
|
41
|
+
docker/
|
|
42
|
+
.dockerignore
|
|
43
|
+
|
|
44
|
+
# Docs — keep README.md, hatchling requires it for the package metadata
|
|
45
|
+
LICENSE
|
|
46
|
+
CHANGELOG.md
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# CODEOWNERS — reviewers auto-requested on PRs that touch matching paths.
|
|
2
|
+
# Docs: https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
|
3
|
+
#
|
|
4
|
+
# Syntax: <pattern> @username (or @org/team)
|
|
5
|
+
# Later rules take precedence over earlier ones. Add more specific rules at the bottom.
|
|
6
|
+
|
|
7
|
+
# Default owner for everything in the repository.
|
|
8
|
+
* @ouyangfeng2022
|
|
9
|
+
|
|
10
|
+
# --- Per-area owners (uncomment and edit to add specific reviewers) ---
|
|
11
|
+
# Core splitting pipeline
|
|
12
|
+
# /src/lumberjack/core/ @expert-on-splitters
|
|
13
|
+
# Markdown parser
|
|
14
|
+
# /src/lumberjack/core/parser/markdown/ @expert-on-markdown
|
|
15
|
+
# Web UI
|
|
16
|
+
# /lumberjack_webui/ @expert-on-frontend
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report something that isn't working as expected
|
|
3
|
+
title: "[bug]: "
|
|
4
|
+
labels: ["bug"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for taking the time to file a bug report! Before you continue,
|
|
10
|
+
please [search existing issues](https://github.com/ouyangfeng2022/lumberjack/issues?q=is%3Aissue+label%3Abug)
|
|
11
|
+
to avoid duplicates.
|
|
12
|
+
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: description
|
|
15
|
+
attributes:
|
|
16
|
+
label: Description
|
|
17
|
+
description: A clear and concise description of the bug.
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
|
|
21
|
+
- type: textarea
|
|
22
|
+
id: reproduce
|
|
23
|
+
attributes:
|
|
24
|
+
label: Steps to reproduce
|
|
25
|
+
description: Minimal steps to reproduce the behavior.
|
|
26
|
+
placeholder: |
|
|
27
|
+
1. Run `...`
|
|
28
|
+
2. With input `...`
|
|
29
|
+
3. See error
|
|
30
|
+
validations:
|
|
31
|
+
required: true
|
|
32
|
+
|
|
33
|
+
- type: textarea
|
|
34
|
+
id: expected
|
|
35
|
+
attributes:
|
|
36
|
+
label: Expected behavior
|
|
37
|
+
description: What you expected to happen.
|
|
38
|
+
validations:
|
|
39
|
+
required: true
|
|
40
|
+
|
|
41
|
+
- type: textarea
|
|
42
|
+
id: actual
|
|
43
|
+
attributes:
|
|
44
|
+
label: Actual behavior
|
|
45
|
+
description: What actually happened. Paste error output, stack traces, or unexpected output here.
|
|
46
|
+
validations:
|
|
47
|
+
required: true
|
|
48
|
+
|
|
49
|
+
- type: textarea
|
|
50
|
+
id: code
|
|
51
|
+
attributes:
|
|
52
|
+
label: Reproducer
|
|
53
|
+
description: A minimal code snippet or command that triggers the bug. Use ``` code fences.
|
|
54
|
+
render: python
|
|
55
|
+
|
|
56
|
+
- type: input
|
|
57
|
+
id: lumberjack-version
|
|
58
|
+
attributes:
|
|
59
|
+
label: lumberjack version
|
|
60
|
+
description: Run `uv pip show lumberjack` or check your lockfile.
|
|
61
|
+
placeholder: "e.g. 0.2.0"
|
|
62
|
+
validations:
|
|
63
|
+
required: true
|
|
64
|
+
|
|
65
|
+
- type: input
|
|
66
|
+
id: python-version
|
|
67
|
+
attributes:
|
|
68
|
+
label: Python version
|
|
69
|
+
placeholder: "e.g. 3.12.3"
|
|
70
|
+
validations:
|
|
71
|
+
required: true
|
|
72
|
+
|
|
73
|
+
- type: input
|
|
74
|
+
id: os
|
|
75
|
+
attributes:
|
|
76
|
+
label: Operating system
|
|
77
|
+
placeholder: "e.g. Ubuntu 24.04, macOS 14, Windows 11"
|
|
78
|
+
validations:
|
|
79
|
+
required: true
|
|
80
|
+
|
|
81
|
+
- type: dropdown
|
|
82
|
+
id: install-method
|
|
83
|
+
attributes:
|
|
84
|
+
label: How did you install lumberjack?
|
|
85
|
+
options:
|
|
86
|
+
- pip / pipx
|
|
87
|
+
- uv
|
|
88
|
+
- From source (git clone)
|
|
89
|
+
- Docker
|
|
90
|
+
- Other
|
|
91
|
+
validations:
|
|
92
|
+
required: true
|
|
93
|
+
|
|
94
|
+
- type: textarea
|
|
95
|
+
id: context
|
|
96
|
+
attributes:
|
|
97
|
+
label: Additional context
|
|
98
|
+
description: Anything else that might be relevant — config, workarounds you tried, related issues.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: Suggest an idea for lumberjack
|
|
3
|
+
title: "[feat]: "
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks for suggesting a feature! Please [search existing issues](https://github.com/ouyangfeng2022/lumberjack/issues?q=is%3Aissue+label%3Aenhancement)
|
|
10
|
+
first to see if it's already been requested.
|
|
11
|
+
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: problem
|
|
14
|
+
attributes:
|
|
15
|
+
label: Problem
|
|
16
|
+
description: What problem does this feature solve? What are you trying to do that's currently hard or impossible?
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: solution
|
|
22
|
+
attributes:
|
|
23
|
+
label: Proposed solution
|
|
24
|
+
description: Describe what you'd like to happen. An API sketch or example usage helps a lot.
|
|
25
|
+
validations:
|
|
26
|
+
required: true
|
|
27
|
+
|
|
28
|
+
- type: textarea
|
|
29
|
+
id: alternatives
|
|
30
|
+
attributes:
|
|
31
|
+
label: Alternatives considered
|
|
32
|
+
description: What workarounds or alternative approaches have you considered?
|
|
33
|
+
|
|
34
|
+
- type: textarea
|
|
35
|
+
id: context
|
|
36
|
+
attributes:
|
|
37
|
+
label: Additional context
|
|
38
|
+
description: Mockups, links, related issues, or anything else relevant.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- Briefly describe what this PR changes and why. 1-3 sentences. -->
|
|
4
|
+
|
|
5
|
+
## Related issue
|
|
6
|
+
|
|
7
|
+
<!-- Link the issue this PR addresses, e.g. "Closes #123". Use "Closes", "Fixes", or "Resolves". -->
|
|
8
|
+
|
|
9
|
+
Closes #
|
|
10
|
+
|
|
11
|
+
## Type of change
|
|
12
|
+
|
|
13
|
+
<!-- Check the one that applies. -->
|
|
14
|
+
|
|
15
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
16
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
17
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
18
|
+
- [ ] Documentation update
|
|
19
|
+
- [ ] Refactor / performance improvement
|
|
20
|
+
- [ ] Test improvement
|
|
21
|
+
|
|
22
|
+
## Checklist
|
|
23
|
+
|
|
24
|
+
<!-- Please make sure all of the following are done. If something doesn't apply, mark it and explain why in the PR description. -->
|
|
25
|
+
|
|
26
|
+
- [ ] My code follows the style of this project (`uv run ruff format`, `uv run ruff check`)
|
|
27
|
+
- [ ] I have run `uv run ty check .` and there are no type errors
|
|
28
|
+
- [ ] I have added tests that prove my fix is effective or my feature works
|
|
29
|
+
- [ ] New and existing tests pass locally (`uv run pytest`)
|
|
30
|
+
- [ ] I have updated the documentation (README / docstrings / CHANGELOG) where relevant
|
|
31
|
+
- [ ] My commits follow [Conventional Commits](https://www.conventionalcommits.org/) (e.g. `feat:`, `fix:`, `docs:`)
|
|
32
|
+
|
|
33
|
+
## Notes for reviewer
|
|
34
|
+
|
|
35
|
+
<!-- Anything you'd like the reviewer to focus on, tricky parts, alternative approaches considered, etc. Optional. -->
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_call:
|
|
8
|
+
|
|
9
|
+
# Cancel superseded runs on the same ref.
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
python:
|
|
16
|
+
name: Python ${{ matrix.python-version }}
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
# hatch-vcs derives the version from git tags; need full history.
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
|
|
29
|
+
- name: Install uv and Python ${{ matrix.python-version }}
|
|
30
|
+
uses: astral-sh/setup-uv@v6
|
|
31
|
+
with:
|
|
32
|
+
# setup-uv installs this exact Python via `uv python install`,
|
|
33
|
+
# so uv won't fall back to a runner-default (e.g. 3.14).
|
|
34
|
+
python-version: ${{ matrix.python-version }}
|
|
35
|
+
enable-cache: true
|
|
36
|
+
|
|
37
|
+
- name: Install dependencies
|
|
38
|
+
# `web` is an optional-dependency extra (not a group); tests/web/test_web.py
|
|
39
|
+
# imports fastapi.testclient, so the web server stack must be installed.
|
|
40
|
+
run: uv sync --group dev --group test --extra tokenizers --extra docx --extra web
|
|
41
|
+
|
|
42
|
+
- name: Type check
|
|
43
|
+
run: uv run ty check .
|
|
44
|
+
|
|
45
|
+
- name: Lint
|
|
46
|
+
run: uv run ruff check .
|
|
47
|
+
|
|
48
|
+
- name: Verify formatting
|
|
49
|
+
run: uv run ruff format --check
|
|
50
|
+
|
|
51
|
+
- name: Test
|
|
52
|
+
run: uv run pytest
|
|
53
|
+
|
|
54
|
+
frontend:
|
|
55
|
+
name: Frontend (lint + build)
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/checkout@v4
|
|
60
|
+
|
|
61
|
+
- name: Set up Bun
|
|
62
|
+
uses: oven-sh/setup-bun@v2
|
|
63
|
+
with:
|
|
64
|
+
bun-version: 1.x
|
|
65
|
+
cache: true
|
|
66
|
+
|
|
67
|
+
- name: Install dependencies
|
|
68
|
+
run: bun install --frozen-lockfile
|
|
69
|
+
working-directory: lumberjack_webui
|
|
70
|
+
|
|
71
|
+
- name: Lint
|
|
72
|
+
run: bun run lint
|
|
73
|
+
working-directory: lumberjack_webui
|
|
74
|
+
|
|
75
|
+
- name: Build (includes tsc type check)
|
|
76
|
+
run: bun run build
|
|
77
|
+
working-directory: lumberjack_webui
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_call:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
name: Build and smoke-test distributions
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
# hatch-vcs derives the version from git tags.
|
|
21
|
+
fetch-depth: 0
|
|
22
|
+
|
|
23
|
+
- name: Install uv and Python
|
|
24
|
+
uses: astral-sh/setup-uv@v6
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.10"
|
|
27
|
+
enable-cache: true
|
|
28
|
+
|
|
29
|
+
- name: Build wheel and source distribution
|
|
30
|
+
run: uv build --out-dir "$RUNNER_TEMP/dist"
|
|
31
|
+
|
|
32
|
+
- name: Validate package metadata
|
|
33
|
+
run: uvx twine check "$RUNNER_TEMP"/dist/*
|
|
34
|
+
|
|
35
|
+
- name: Assert distribution contents
|
|
36
|
+
run: uv run --group test pytest tests/test_distribution.py
|
|
37
|
+
env:
|
|
38
|
+
LUMBERJACK_DIST_DIR: ${{ runner.temp }}/dist
|
|
39
|
+
|
|
40
|
+
- name: Smoke-test wheel installation
|
|
41
|
+
run: |
|
|
42
|
+
uv venv --python 3.10 .venv-wheel
|
|
43
|
+
uv pip install --python .venv-wheel/bin/python "$RUNNER_TEMP"/dist/*.whl
|
|
44
|
+
.venv-wheel/bin/python -c 'from lumberjack import Lumberjack; assert Lumberjack().saw("# Title\\n\\nBody")'
|
|
45
|
+
.venv-wheel/bin/lumber --help
|
|
46
|
+
|
|
47
|
+
- name: Smoke-test source distribution installation
|
|
48
|
+
run: |
|
|
49
|
+
uv venv --python 3.10 .venv-sdist
|
|
50
|
+
uv pip install --python .venv-sdist/bin/python "$RUNNER_TEMP"/dist/*.tar.gz
|
|
51
|
+
.venv-sdist/bin/python -c 'from lumberjack import Lumberjack; assert Lumberjack().saw("# Title\\n\\nBody")'
|
|
52
|
+
.venv-sdist/bin/lumber --help
|
|
53
|
+
|
|
54
|
+
- name: Upload distributions
|
|
55
|
+
uses: actions/upload-artifact@v4
|
|
56
|
+
with:
|
|
57
|
+
name: python-distributions
|
|
58
|
+
path: ${{ runner.temp }}/dist/
|
|
59
|
+
if-no-files-found: error
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: Publish release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
validate-release-tag:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Validate release tag format
|
|
16
|
+
env:
|
|
17
|
+
RELEASE_TAG: ${{ github.ref_name }}
|
|
18
|
+
run: |
|
|
19
|
+
if [[ ! "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
20
|
+
echo "::error::Production release tag '$RELEASE_TAG' must use stable v<MAJOR>.<MINOR>.<PATCH> format."
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
verify:
|
|
25
|
+
needs: validate-release-tag
|
|
26
|
+
uses: ./.github/workflows/ci.yml
|
|
27
|
+
|
|
28
|
+
package:
|
|
29
|
+
needs: verify
|
|
30
|
+
uses: ./.github/workflows/package.yml
|
|
31
|
+
|
|
32
|
+
publish:
|
|
33
|
+
needs: package
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
environment:
|
|
36
|
+
name: pypi
|
|
37
|
+
url: https://pypi.org/p/lumberjack-py
|
|
38
|
+
permissions:
|
|
39
|
+
contents: write
|
|
40
|
+
id-token: write
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
- name: Download distributions
|
|
44
|
+
uses: actions/download-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: python-distributions
|
|
47
|
+
path: dist
|
|
48
|
+
|
|
49
|
+
- name: Verify distribution version matches tag
|
|
50
|
+
env:
|
|
51
|
+
RELEASE_TAG: ${{ github.ref_name }}
|
|
52
|
+
run: |
|
|
53
|
+
expected_version="${RELEASE_TAG#v}"
|
|
54
|
+
actual_version="$(unzip -p dist/*.whl '*/METADATA' | sed -n 's/^Version: //p' | head -n 1)"
|
|
55
|
+
if [[ "$actual_version" != "$expected_version" ]]; then
|
|
56
|
+
echo "::error::Wheel version '$actual_version' does not match tag '$RELEASE_TAG'."
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
- name: Publish to PyPI with Trusted Publishing
|
|
61
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
62
|
+
|
|
63
|
+
- name: Create GitHub release
|
|
64
|
+
env:
|
|
65
|
+
GH_TOKEN: ${{ github.token }}
|
|
66
|
+
run: gh release create "$GITHUB_REF_NAME" dist/* --generate-notes --verify-tag
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Publish TestPyPI release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
package:
|
|
11
|
+
uses: ./.github/workflows/package.yml
|
|
12
|
+
|
|
13
|
+
publish:
|
|
14
|
+
needs: package
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
environment:
|
|
17
|
+
name: testpypi
|
|
18
|
+
url: https://test.pypi.org/project/lumberjack-py/
|
|
19
|
+
permissions:
|
|
20
|
+
id-token: write
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- name: Download distributions
|
|
24
|
+
uses: actions/download-artifact@v4
|
|
25
|
+
with:
|
|
26
|
+
name: python-distributions
|
|
27
|
+
path: dist
|
|
28
|
+
|
|
29
|
+
- name: Publish to TestPyPI with Trusted Publishing
|
|
30
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
31
|
+
with:
|
|
32
|
+
repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
|
|
12
|
+
# Environment files
|
|
13
|
+
.env
|
|
14
|
+
.env.*
|
|
15
|
+
!.env.example
|
|
16
|
+
|
|
17
|
+
# Frontend
|
|
18
|
+
lumberjack_webui/node_modules/
|
|
19
|
+
lumberjack_webui/dist/
|
|
20
|
+
src/lumberjack/web/static/
|
|
21
|
+
|
|
22
|
+
# Datasets
|
|
23
|
+
data/
|
|
24
|
+
output/
|
|
25
|
+
|
|
26
|
+
# Private development documentation
|
|
27
|
+
internal_docs/
|
|
28
|
+
|
|
29
|
+
# Tool caches
|
|
30
|
+
.ruff_cache/
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
.worktrees
|
|
33
|
+
|
|
34
|
+
# IDE
|
|
35
|
+
.idea/
|
|
36
|
+
.vscode/
|
|
37
|
+
*.swp
|
|
38
|
+
*.swo
|
|
39
|
+
|
|
40
|
+
# OS
|
|
41
|
+
.DS_Store
|
|
42
|
+
Thumbs.db
|
|
43
|
+
|
|
44
|
+
# tar
|
|
45
|
+
*.tar
|
|
46
|
+
*.tar.gz
|