Conversation
There was a problem hiding this comment.
Pull request overview
Restructures the repository into an installable Python package (pysvglabel), updates imports accordingly, and adds executable modules plus CI workflows to support testing and PyPI publishing.
Changes:
- Convert project to a package with
pyproject.toml, package modules, and updated internal/consumer imports. - Add/organize label frontend/core modules (units, alignment/scaling, barcode helpers, Inkscape subprocess integration).
- Add GitHub Actions workflows for unit tests/type-checking and publishing on release.
Reviewed changes
Copilot reviewed 27 out of 40 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_validate.py | Update imports to new pysvglabel package layout. |
| tests/test_units.py | Update imports to new pysvglabel package layout. |
| tests/test_subsvg.py | Update imports to new pysvglabel package layout. |
| tests/test_subarray.py | Update imports to new pysvglabel package layout. |
| tests/test_simple.py | Update imports to new pysvglabel package layout. |
| tests/test_color.py | Update imports to new pysvglabel package layout. |
| tests/test_barcode.py | Update imports to new pysvglabel package layout. |
| tests/LabelTestCase.py | Update imports to new pysvglabel package layout. |
| requirements.txt | Remove legacy requirements file (dependencies now in pyproject.toml). |
| pysvglabel/printer/main.py | Adjust imports for packaged printer entry module. |
| pysvglabel/printer/init.py | Add printer package marker. |
| pysvglabel/labelfrontend/units.py | Introduce typed unit/length dimension utilities. |
| pysvglabel/labelfrontend/external/init.py | Add external subpackage marker. |
| pysvglabel/labelfrontend/external/Code128.py | Add embedded Code128 encoding implementation. |
| pysvglabel/labelfrontend/init.py | Define implicit frontend exports (via __all__) for templates. |
| pysvglabel/labelfrontend/Svg.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/SubtemplateArray.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/Subtemplate.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/StyleModifier.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/Scaling.py | Add scaling mode enum and transform helper. |
| pysvglabel/labelfrontend/QrCode.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/LabelSheet.py | Add label sheet/page layout helper. |
| pysvglabel/labelfrontend/Hide.py | Update imports and typing cleanup. |
| pysvglabel/labelfrontend/DimensionModifier.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/DataMatrix.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/Compose.py | Update imports for packaged core/frontend integration. |
| pysvglabel/labelfrontend/Code128.py | Update imports and route to bundled external Code128 encoder. |
| pysvglabel/labelfrontend/Align.py | Add alignment enum and translation helper. |
| pysvglabel/labelcore/common.py | Add shared exceptions/constants/namespaces. |
| pysvglabel/labelcore/init.py | Export core internals for internal package use. |
| pysvglabel/labelcore/SvgTemplate.py | Update env bootstrapping to import packaged frontend and improve typing. |
| pysvglabel/labelcore/InkscapeSubprocess.py | Add helper to drive Inkscape shell mode conversions. |
| pysvglabel/labelcore/GroupReplacer.py | Add core group replacement abstractions. |
| pysvglabel/generate/main.py | Adjust imports for packaged generator entry module. |
| pysvglabel/generate/init.py | Add generate package marker. |
| pysvglabel/init.py | Expose SvgTemplate as the public package API. |
| pyproject.toml | Define build metadata, dependencies, mypy/black config, and setuptools packaging. |
| examples/screws.py | Update example imports to new package layout. |
| .github/workflows/workflow.yml | Add release build + trusted PyPI publish workflow. |
| .github/workflows/test.yml | Add CI for mypy + unit tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Type check with mypy | ||
| run: | | ||
| mypy . | ||
| - name: Test with pytest |
There was a problem hiding this comment.
The workflow step name says "Test with pytest" but it runs python -m unittest. Rename the step for accuracy (or switch to pytest if that’s intended).
| - name: Test with pytest | |
| - name: Test with unittest |
| ] | ||
|
|
||
| [tool.setuptools] | ||
| packages = ["pysvglabel.labelcore", "pysvglabel.labelfrontend", "pysvglabel.generate", "pysvglabel.printer"] |
There was a problem hiding this comment.
[tool.setuptools].packages is missing required packages (e.g. the top-level pysvglabel package itself and the nested pysvglabel.labelfrontend.external). As written, installing the distribution will likely omit these modules and break imports like pysvglabel.labelfrontend.external.Code128 at runtime. Consider switching to automatic discovery (e.g. setuptools find_packages) or explicitly add the missing package entries.
| packages = ["pysvglabel.labelcore", "pysvglabel.labelfrontend", "pysvglabel.generate", "pysvglabel.printer"] | |
| packages = ["pysvglabel", "pysvglabel.labelcore", "pysvglabel.labelfrontend", "pysvglabel.labelfrontend.external", "pysvglabel.generate", "pysvglabel.printer"] |
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python 3.10 | ||
| uses: actions/setup-python@v3 |
There was a problem hiding this comment.
This workflow uses actions/setup-python@v3 while other workflows already use @v5. Consider updating to @v5 for consistency and to avoid running on a deprecated major version.
| uses: actions/setup-python@v3 | |
| uses: actions/setup-python@v5 |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 40 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "Topic :: Printing", | ||
| "Typing :: Typed", | ||
| ] | ||
| license = "BSD-3-Clause" |
There was a problem hiding this comment.
license = "BSD-3-Clause" is not valid PEP 621 syntax for many build backends (they expect license = { text = "..." } or license = { file = "..." }). Consider switching to the table form to avoid packaging/build failures.
| license = "BSD-3-Clause" | |
| license = { text = "BSD-3-Clause" } |
Restructures the repo to be a Python package, instead of a top-level script and module. Moves the pysvglabel top-level script into an executable module
pysvglabel.generate.Adds SvgTemplate as the sole package API.
Also adds unit testing and publishing (to PyPI) workflows. Fixes typing and changes to relative imports.
Improved readme to come in a separate PR.