Skip to content

docs(examples): migrate to uv and PEP 723 inline script metadata - #705

Open
hasansezertasan wants to merge 15 commits into
python-escpos:masterfrom
hasansezertasan:migrate/uv/examples
Open

docs(examples): migrate to uv and PEP 723 inline script metadata#705
hasansezertasan wants to merge 15 commits into
python-escpos:masterfrom
hasansezertasan:migrate/uv/examples

Conversation

@hasansezertasan

@hasansezertasan hasansezertasan commented Sep 7, 2025

Copy link
Copy Markdown
Contributor

Related to #704

What

Migrate the runnable examples in examples/ to uv with PEP 723 inline script metadata, so each example can be run directly with uv run <example>.py without a manual virtualenv or dependency install.

Changes

  • Add PEP 723 # /// script metadata blocks to the standalone examples (barcodes.py, codepage_tables.py, qr_code.py, software_barcode.py, software_columns.py, weather.py), declaring requires-python, dependencies, and a local editable python-escpos source.
  • Tidy the example scripts (wrap top-level code in a main() entry point, minor cleanups) to fit the single-file script model.
  • Replace the examples/docker-flask/ example with examples/flask-example/, now managed by uv via pyproject.toml and uv.lock, with a uv-based Dockerfile.

Notes

  • No library/source changes — this only touches examples/.

- Changed base image to use UV with Python 3.11.
- Updated working directory and file copying to align with UV requirements.
- Removed requirements.txt and replaced it with uv.lock and pyproject.toml for dependency management.
- Modified README to reflect new build and run commands.
- Set default command to run the application using UV.
… ESC/POS integration

- Added a new Flask application example in the `flask-example` directory.
- Implemented a simple printing functionality using `CupsPrinter`.
- Created a Dockerfile for building and running the application.
- Included `pyproject.toml` and `uv.lock` for dependency management.
- Updated README with build and run instructions.
Comment thread examples/barcodes.py Outdated
Comment thread examples/codepage_tables.py Outdated
Comment thread examples/qr_code.py Outdated
Comment thread examples/software_barcode.py Outdated
Comment thread examples/software_columns.py Outdated
Comment thread examples/weather.py Outdated
hasansezertasan and others added 9 commits February 10, 2026 01:45
Co-authored-by: Benito López <belono@users.noreply.github.com>
Co-authored-by: Benito López <belono@users.noreply.github.com>
Co-authored-by: Benito López <belono@users.noreply.github.com>
Co-authored-by: Benito López <belono@users.noreply.github.com>
Co-authored-by: Benito López <belono@users.noreply.github.com>
Co-authored-by: Benito López <belono@users.noreply.github.com>
Resolve modify/delete conflicts in examples/docker-flask/ by keeping the
deletion: the example was migrated to examples/flask-example/ using uv and
a pyproject.toml/uv.lock, superseding the old Dockerfile and requirements.txt.
@hasansezertasan hasansezertasan changed the title migrate(uv): migrate examples to use uv and PEP 723 Python Scripts docs(examples): migrate to uv and PEP 723 inline script metadata Jul 27, 2026
Bump Flask 2.3.2->3.1.3, Pillow 10.3.0->12.3.0, python-barcode 0.14.0->0.16.1,
qrcode 7.4.2->8.2.0, Werkzeug 3.0.6->3.1.6 to match master. Flask 3.1.3 pulls
in blinker>=1.9.0 and itsdangerous>=2.2.0, and Pillow 12.3.0 requires Python
>=3.10, so requires-python is raised accordingly. Regenerate uv.lock.
Adding type annotations made mypy check the function bodies, surfacing
latent str-to-_raw calls (_raw requires bytes, and Dummy.output joins with
b"", so str would fail at runtime). Encode the string arguments to bytes.
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.07%. Comparing base (6e8029f) to head (0d980b4).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #705   +/-   ##
=======================================
  Coverage   79.07%   79.07%           
=======================================
  Files          21       21           
  Lines        1754     1754           
  Branches      243      243           
=======================================
  Hits         1387     1387           
  Misses        286      286           
  Partials       81       81           
Flag Coverage Δ
unittests 79.07% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hasansezertasan
hasansezertasan requested a review from belono July 30, 2026 23:06
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.

3 participants