Skip to content

Make pysvglabel an installable package, add generate and printer executable modules#15

Merged
ducky64 merged 6 commits into
mainfrom
packaging
Feb 12, 2026
Merged

Make pysvglabel an installable package, add generate and printer executable modules#15
ducky64 merged 6 commits into
mainfrom
packaging

Conversation

@ducky64

@ducky64 ducky64 commented Feb 12, 2026

Copy link
Copy Markdown
Owner

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/test.yml Outdated
- name: Type check with mypy
run: |
mypy .
- name: Test with pytest

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
- name: Test with pytest
- name: Test with unittest

Copilot uses AI. Check for mistakes.
Comment thread pyproject.toml Outdated
]

[tool.setuptools]
packages = ["pysvglabel.labelcore", "pysvglabel.labelfrontend", "pysvglabel.generate", "pysvglabel.printer"]

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Suggested change
packages = ["pysvglabel.labelcore", "pysvglabel.labelfrontend", "pysvglabel.generate", "pysvglabel.printer"]
packages = ["pysvglabel", "pysvglabel.labelcore", "pysvglabel.labelfrontend", "pysvglabel.labelfrontend.external", "pysvglabel.generate", "pysvglabel.printer"]

Copilot uses AI. Check for mistakes.
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
uses: actions/setup-python@v3
uses: actions/setup-python@v5

Copilot uses AI. Check for mistakes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pyproject.toml
"Topic :: Printing",
"Typing :: Typed",
]
license = "BSD-3-Clause"

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
license = "BSD-3-Clause"
license = { text = "BSD-3-Clause" }

Copilot uses AI. Check for mistakes.
@ducky64 ducky64 merged commit 375d6a6 into main Feb 12, 2026
7 checks passed
@ducky64 ducky64 deleted the packaging branch February 12, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants