labeljetty 0.1.0b1__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.
- labeljetty-0.1.0b1/.dockerignore +20 -0
- labeljetty-0.1.0b1/.github/workflows/docker-dev.yml +46 -0
- labeljetty-0.1.0b1/.github/workflows/docker.yml +67 -0
- labeljetty-0.1.0b1/.github/workflows/pypi.yml +28 -0
- labeljetty-0.1.0b1/.github/workflows/tests.yml +38 -0
- labeljetty-0.1.0b1/.gitignore +214 -0
- labeljetty-0.1.0b1/.python-version +1 -0
- labeljetty-0.1.0b1/Dockerfile +54 -0
- labeljetty-0.1.0b1/LICENSE +21 -0
- labeljetty-0.1.0b1/PKG-INFO +64 -0
- labeljetty-0.1.0b1/README.md +143 -0
- labeljetty-0.1.0b1/build-container.sh +33 -0
- labeljetty-0.1.0b1/docs/BUILD.md +149 -0
- labeljetty-0.1.0b1/docs/README.docker.md +53 -0
- labeljetty-0.1.0b1/docs/README.pypi.md +40 -0
- labeljetty-0.1.0b1/docs/TESTING.md +198 -0
- labeljetty-0.1.0b1/docs/advanced-usage.md +282 -0
- labeljetty-0.1.0b1/docs/configuration.md +168 -0
- labeljetty-0.1.0b1/docs/design.md +194 -0
- labeljetty-0.1.0b1/docs/developing.md +213 -0
- labeljetty-0.1.0b1/docs/hardware.md +45 -0
- labeljetty-0.1.0b1/docs/labejetti_screenshot.png +0 -0
- labeljetty-0.1.0b1/docs/roadmap.md +43 -0
- labeljetty-0.1.0b1/pyproject.toml +67 -0
- labeljetty-0.1.0b1/sample.env +107 -0
- labeljetty-0.1.0b1/src/labeljetty/__init__.py +3 -0
- labeljetty-0.1.0b1/src/labeljetty/__main__.py +3 -0
- labeljetty-0.1.0b1/src/labeljetty/_version.py +24 -0
- labeljetty-0.1.0b1/src/labeljetty/app.py +64 -0
- labeljetty-0.1.0b1/src/labeljetty/config.py +245 -0
- labeljetty-0.1.0b1/src/labeljetty/core/__init__.py +0 -0
- labeljetty-0.1.0b1/src/labeljetty/core/db.py +121 -0
- labeljetty-0.1.0b1/src/labeljetty/core/logging.py +177 -0
- labeljetty-0.1.0b1/src/labeljetty/core/sqltypes.py +25 -0
- labeljetty-0.1.0b1/src/labeljetty/integrations/__init__.py +0 -0
- labeljetty-0.1.0b1/src/labeljetty/integrations/homebox.py +142 -0
- labeljetty-0.1.0b1/src/labeljetty/printer/__init__.py +15 -0
- labeljetty-0.1.0b1/src/labeljetty/printer/connection.py +405 -0
- labeljetty-0.1.0b1/src/labeljetty/printer/render.py +121 -0
- labeljetty-0.1.0b1/src/labeljetty/printer/tspl.py +1141 -0
- labeljetty-0.1.0b1/src/labeljetty/service/__init__.py +0 -0
- labeljetty-0.1.0b1/src/labeljetty/service/worker.py +338 -0
- labeljetty-0.1.0b1/src/labeljetty/testbench.py +281 -0
- labeljetty-0.1.0b1/src/labeljetty/version.py +41 -0
- labeljetty-0.1.0b1/src/labeljetty/web/__init__.py +0 -0
- labeljetty-0.1.0b1/src/labeljetty/web/api.py +394 -0
- labeljetty-0.1.0b1/src/labeljetty/web/app.py +153 -0
- labeljetty-0.1.0b1/src/labeljetty/web/auth.py +202 -0
- labeljetty-0.1.0b1/src/labeljetty/web/password.py +84 -0
- labeljetty-0.1.0b1/src/labeljetty/web/static/htmx.min.js +1 -0
- labeljetty-0.1.0b1/src/labeljetty/web/static/style.css +155 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/_homebox.html +23 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/_homebox_results.html +32 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/_jobs.html +20 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/_preview.html +14 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/_print_result.html +5 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/_status.html +42 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/base.html +29 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/homebox_setup.html +67 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/index.html +190 -0
- labeljetty-0.1.0b1/src/labeljetty/web/templates/login.html +23 -0
- labeljetty-0.1.0b1/src/labeljetty/web/ui.py +524 -0
- labeljetty-0.1.0b1/tests/conftest.py +209 -0
- labeljetty-0.1.0b1/tests/fixtures/label_test.png +0 -0
- labeljetty-0.1.0b1/tests/fixtures/label_test2.png +0 -0
- labeljetty-0.1.0b1/tests/fixtures/label_test3.png +0 -0
- labeljetty-0.1.0b1/tests/fixtures/label_test4.png +0 -0
- labeljetty-0.1.0b1/tests/test_api.py +195 -0
- labeljetty-0.1.0b1/tests/test_auth.py +166 -0
- labeljetty-0.1.0b1/tests/test_config.py +124 -0
- labeljetty-0.1.0b1/tests/test_connection.py +124 -0
- labeljetty-0.1.0b1/tests/test_db.py +91 -0
- labeljetty-0.1.0b1/tests/test_homebox.py +150 -0
- labeljetty-0.1.0b1/tests/test_render.py +90 -0
- labeljetty-0.1.0b1/tests/test_status_message.py +49 -0
- labeljetty-0.1.0b1/tests/test_tspl.py +145 -0
- labeljetty-0.1.0b1/tests/test_ui.py +199 -0
- labeljetty-0.1.0b1/tests/test_worker.py +158 -0
- labeljetty-0.1.0b1/uv.lock +1013 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Keep the build context small and reproducible.
|
|
2
|
+
.git
|
|
3
|
+
.github
|
|
4
|
+
.venv
|
|
5
|
+
.pytest_cache
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.pyc
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
.coverage
|
|
12
|
+
htmlcov/
|
|
13
|
+
tests/
|
|
14
|
+
scratchpad_code/
|
|
15
|
+
docs/*
|
|
16
|
+
!docs/README.pypi.md
|
|
17
|
+
images/
|
|
18
|
+
*.sqlite
|
|
19
|
+
.env
|
|
20
|
+
src/labeljetty/_version.py
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: docker-dev
|
|
2
|
+
|
|
3
|
+
# Bleeding-edge channel: rebuilds the :dev image on every push to main.
|
|
4
|
+
# x86-only (linux/amd64) — no QEMU, so it's fast; the released images
|
|
5
|
+
# (docker.yml) are the multi-arch ones. Not for production.
|
|
6
|
+
#
|
|
7
|
+
# Required repository secrets (same as docker.yml):
|
|
8
|
+
# DOCKERHUB_USERNAME Docker Hub login (needs push access to motey/labeljetty)
|
|
9
|
+
# DOCKERHUB_TOKEN Docker Hub access token
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [main]
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
docker-dev:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
|
+
|
|
20
|
+
- name: Compute dev version
|
|
21
|
+
id: meta
|
|
22
|
+
env:
|
|
23
|
+
SHA: ${{ github.sha }}
|
|
24
|
+
run: |
|
|
25
|
+
# PEP440-valid local version stamped into the image (LABELJETTY_VERSION).
|
|
26
|
+
echo "version=0.0.0+dev.${SHA::7}" >> "$GITHUB_OUTPUT"
|
|
27
|
+
|
|
28
|
+
- uses: docker/setup-buildx-action@v4
|
|
29
|
+
|
|
30
|
+
- name: Log in to Docker Hub
|
|
31
|
+
uses: docker/login-action@v4
|
|
32
|
+
with:
|
|
33
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
34
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
35
|
+
|
|
36
|
+
- name: Build and push
|
|
37
|
+
uses: docker/build-push-action@v7
|
|
38
|
+
with:
|
|
39
|
+
context: .
|
|
40
|
+
push: true
|
|
41
|
+
platforms: linux/amd64
|
|
42
|
+
build-args: |
|
|
43
|
+
VERSION=${{ steps.meta.outputs.version }}
|
|
44
|
+
tags: motey/labeljetty:dev
|
|
45
|
+
cache-from: type=gha
|
|
46
|
+
cache-to: type=gha,mode=max
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: docker
|
|
2
|
+
|
|
3
|
+
# Builds and pushes the Docker image on a GitHub Release.
|
|
4
|
+
# - every release -> :<version> (e.g. :0.1.0)
|
|
5
|
+
# - normal release -> :latest
|
|
6
|
+
# - pre-release -> :beta
|
|
7
|
+
#
|
|
8
|
+
# Required repository secrets:
|
|
9
|
+
# DOCKERHUB_USERNAME Docker Hub login (needs push access to motey/labeljetty)
|
|
10
|
+
# DOCKERHUB_TOKEN Docker Hub access token (Account Settings -> Security)
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
docker:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v6
|
|
20
|
+
|
|
21
|
+
- name: Compute version and tags
|
|
22
|
+
id: meta
|
|
23
|
+
env:
|
|
24
|
+
TAG_NAME: ${{ github.event.release.tag_name }}
|
|
25
|
+
PRERELEASE: ${{ github.event.release.prerelease }}
|
|
26
|
+
IMAGE: motey/labeljetty
|
|
27
|
+
run: |
|
|
28
|
+
VERSION="${TAG_NAME#v}"
|
|
29
|
+
TAGS="${IMAGE}:${VERSION}"
|
|
30
|
+
if [ "${PRERELEASE}" = "true" ]; then
|
|
31
|
+
TAGS="${TAGS},${IMAGE}:beta"
|
|
32
|
+
else
|
|
33
|
+
TAGS="${TAGS},${IMAGE}:latest"
|
|
34
|
+
fi
|
|
35
|
+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
36
|
+
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
|
|
37
|
+
|
|
38
|
+
- uses: docker/setup-qemu-action@v4
|
|
39
|
+
- uses: docker/setup-buildx-action@v4
|
|
40
|
+
|
|
41
|
+
- name: Log in to Docker Hub
|
|
42
|
+
uses: docker/login-action@v4
|
|
43
|
+
with:
|
|
44
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
45
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
46
|
+
|
|
47
|
+
- name: Build and push
|
|
48
|
+
uses: docker/build-push-action@v7
|
|
49
|
+
with:
|
|
50
|
+
context: .
|
|
51
|
+
push: true
|
|
52
|
+
platforms: linux/amd64,linux/arm64
|
|
53
|
+
build-args: |
|
|
54
|
+
VERSION=${{ steps.meta.outputs.version }}
|
|
55
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
56
|
+
cache-from: type=gha
|
|
57
|
+
cache-to: type=gha,mode=max
|
|
58
|
+
|
|
59
|
+
# Push the slim Docker Hub overview/README (links back to GitHub for full docs).
|
|
60
|
+
- name: Update Docker Hub description
|
|
61
|
+
uses: peter-evans/dockerhub-description@v4
|
|
62
|
+
with:
|
|
63
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
64
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
65
|
+
repository: motey/labeljetty
|
|
66
|
+
short-description: "Network-accessible printing for USB TSPL thermal label printers (web UI + REST API)."
|
|
67
|
+
readme-filepath: ./docs/README.docker.md
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: pypi
|
|
2
|
+
|
|
3
|
+
# Builds and publishes the Python package to PyPI on a GitHub Release.
|
|
4
|
+
# The version is derived from the git tag by hatch-vcs, so the tag (e.g. 0.1.0)
|
|
5
|
+
# IS the published version — fetch full history so the tag is visible.
|
|
6
|
+
#
|
|
7
|
+
# Required repository secret:
|
|
8
|
+
# PYPI_API_TOKEN PyPI API token (https://pypi.org/manage/account/token/)
|
|
9
|
+
on:
|
|
10
|
+
release:
|
|
11
|
+
types: [published]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
pypi:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Install uv
|
|
22
|
+
uses: astral-sh/setup-uv@v5
|
|
23
|
+
|
|
24
|
+
- name: Build sdist + wheel
|
|
25
|
+
run: uv build
|
|
26
|
+
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
run: uv publish --token "${{ secrets.PYPI_API_TOKEN }}"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["**"]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pytest:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
|
+
|
|
19
|
+
# Text/markdown rendering uses DejaVu Sans (DEFAULT_FONT_PATH); the runner
|
|
20
|
+
# does not ship it by default.
|
|
21
|
+
- name: Install DejaVu fonts
|
|
22
|
+
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends fonts-dejavu-core
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v5
|
|
26
|
+
with:
|
|
27
|
+
enable-cache: true
|
|
28
|
+
|
|
29
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
30
|
+
run: uv python install ${{ matrix.python-version }}
|
|
31
|
+
|
|
32
|
+
- name: Install project + dev dependencies
|
|
33
|
+
run: uv sync --group dev --python ${{ matrix.python-version }}
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
# The suite is fully isolated (no .env, no USB, no network) — nothing
|
|
37
|
+
# extra to configure. "hardware"-marked tests are deselected by default.
|
|
38
|
+
run: uv run --no-sync python -m pytest --cov=labeljetty --cov-report=term-missing
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
# hatch-vcs writes this at build time from the git tag (see pyproject.toml).
|
|
12
|
+
src/labeljetty/_version.py
|
|
13
|
+
build/
|
|
14
|
+
develop-eggs/
|
|
15
|
+
dist/
|
|
16
|
+
downloads/
|
|
17
|
+
eggs/
|
|
18
|
+
.eggs/
|
|
19
|
+
lib/
|
|
20
|
+
lib64/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py.cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
# .python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
#Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# UV
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
#uv.lock
|
|
104
|
+
|
|
105
|
+
# poetry
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
107
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
+
# commonly ignored for libraries.
|
|
109
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
110
|
+
#poetry.lock
|
|
111
|
+
#poetry.toml
|
|
112
|
+
|
|
113
|
+
# pdm
|
|
114
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
115
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
116
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
117
|
+
#pdm.lock
|
|
118
|
+
#pdm.toml
|
|
119
|
+
.pdm-python
|
|
120
|
+
.pdm-build/
|
|
121
|
+
|
|
122
|
+
# pixi
|
|
123
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
124
|
+
#pixi.lock
|
|
125
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
126
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
127
|
+
.pixi
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# SageMath parsed files
|
|
137
|
+
*.sage.py
|
|
138
|
+
|
|
139
|
+
# Environments
|
|
140
|
+
.env
|
|
141
|
+
.envrc
|
|
142
|
+
.venv
|
|
143
|
+
env/
|
|
144
|
+
venv/
|
|
145
|
+
ENV/
|
|
146
|
+
env.bak/
|
|
147
|
+
venv.bak/
|
|
148
|
+
|
|
149
|
+
# Spyder project settings
|
|
150
|
+
.spyderproject
|
|
151
|
+
.spyproject
|
|
152
|
+
|
|
153
|
+
# Rope project settings
|
|
154
|
+
.ropeproject
|
|
155
|
+
|
|
156
|
+
# mkdocs documentation
|
|
157
|
+
/site
|
|
158
|
+
|
|
159
|
+
# mypy
|
|
160
|
+
.mypy_cache/
|
|
161
|
+
.dmypy.json
|
|
162
|
+
dmypy.json
|
|
163
|
+
|
|
164
|
+
# Pyre type checker
|
|
165
|
+
.pyre/
|
|
166
|
+
|
|
167
|
+
# pytype static type analyzer
|
|
168
|
+
.pytype/
|
|
169
|
+
|
|
170
|
+
# Cython debug symbols
|
|
171
|
+
cython_debug/
|
|
172
|
+
|
|
173
|
+
# PyCharm
|
|
174
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
175
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
176
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
177
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
178
|
+
#.idea/
|
|
179
|
+
|
|
180
|
+
# Abstra
|
|
181
|
+
# Abstra is an AI-powered process automation framework.
|
|
182
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
183
|
+
# Learn more at https://abstra.io/docs
|
|
184
|
+
.abstra/
|
|
185
|
+
|
|
186
|
+
# Visual Studio Code
|
|
187
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
188
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
189
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
190
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
191
|
+
# .vscode/
|
|
192
|
+
|
|
193
|
+
# Ruff stuff:
|
|
194
|
+
.ruff_cache/
|
|
195
|
+
|
|
196
|
+
# PyPI configuration file
|
|
197
|
+
.pypirc
|
|
198
|
+
|
|
199
|
+
# Cursor
|
|
200
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
201
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
202
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
203
|
+
.cursorignore
|
|
204
|
+
.cursorindexingignore
|
|
205
|
+
|
|
206
|
+
# Marimo
|
|
207
|
+
marimo/_static/
|
|
208
|
+
marimo/_lsp/
|
|
209
|
+
__marimo__/
|
|
210
|
+
|
|
211
|
+
# labeljetty runtime artifacts
|
|
212
|
+
printjobs.sqlite
|
|
213
|
+
*.sqlite
|
|
214
|
+
/images/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# syntax=docker/dockerfile:1
|
|
2
|
+
|
|
3
|
+
FROM python:3.11-slim
|
|
4
|
+
|
|
5
|
+
# VERSION is the release being built (the git tag, e.g. "0.1.0"). It is:
|
|
6
|
+
# - given to setuptools_scm so the package builds without a .git checkout, and
|
|
7
|
+
# - exposed at runtime as LABELJETTY_VERSION so the app/API/UI report the release
|
|
8
|
+
# (see labeljetty/version.py).
|
|
9
|
+
ARG VERSION=0.0.0
|
|
10
|
+
ENV SETUPTOOLS_SCM_PRETEND_VERSION=${VERSION} \
|
|
11
|
+
LABELJETTY_VERSION=${VERSION} \
|
|
12
|
+
PYTHONUNBUFFERED=1 \
|
|
13
|
+
UV_COMPILE_BYTECODE=1 \
|
|
14
|
+
UV_LINK_MODE=copy
|
|
15
|
+
|
|
16
|
+
# Runtime system deps:
|
|
17
|
+
# - libusb-1.0-0: required by pyusb to talk to the USB printer
|
|
18
|
+
# - fonts-dejavu-core: text/markdown rendering uses DejaVu Sans (DEFAULT_FONT_PATH)
|
|
19
|
+
RUN apt-get update \
|
|
20
|
+
&& apt-get install -y --no-install-recommends \
|
|
21
|
+
libusb-1.0-0 \
|
|
22
|
+
fonts-dejavu-core \
|
|
23
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
24
|
+
|
|
25
|
+
# uv: the official static binary from Astral's image.
|
|
26
|
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
27
|
+
|
|
28
|
+
WORKDIR /app
|
|
29
|
+
|
|
30
|
+
# Install into a project venv from the frozen lockfile. The source is needed
|
|
31
|
+
# because the project itself is installed (and version-stamped) — copy it all.
|
|
32
|
+
# pyproject's `readme` points at docs/README.pypi.md, so that file must be present
|
|
33
|
+
# at its original path for the build to succeed.
|
|
34
|
+
COPY pyproject.toml uv.lock ./
|
|
35
|
+
COPY docs/README.pypi.md ./docs/README.pypi.md
|
|
36
|
+
COPY src ./src
|
|
37
|
+
RUN uv sync --frozen --no-dev --no-editable
|
|
38
|
+
|
|
39
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
40
|
+
|
|
41
|
+
# Container-friendly defaults (override via env/-e). Data lives under /data so it
|
|
42
|
+
# can be a mounted volume; bind to all interfaces inside the container.
|
|
43
|
+
ENV SERVER_LISTENING_HOST=0.0.0.0 \
|
|
44
|
+
SERVER_LISTENING_PORT=8888 \
|
|
45
|
+
SQLITE_PATH=/data/printjobs.sqlite \
|
|
46
|
+
IMAGE_STORAGE_DIRECTORY=/data/images
|
|
47
|
+
|
|
48
|
+
RUN mkdir -p /data
|
|
49
|
+
VOLUME ["/data"]
|
|
50
|
+
EXPOSE 8888
|
|
51
|
+
|
|
52
|
+
# PRINTER_USB has no default and must be provided at run time, e.g.:
|
|
53
|
+
# docker run --device=/dev/bus/usb -e PRINTER_USB=vid:2d37:pid:62de ...
|
|
54
|
+
ENTRYPOINT ["labeljetty"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Tim
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: labeljetty
|
|
3
|
+
Version: 0.1.0b1
|
|
4
|
+
Summary: Network-accessible printing for USB TSPL thermal label printers (library + REST API + web UI).
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: fastapi>=0.124.0
|
|
8
|
+
Requires-Dist: getenv>=0.2.0
|
|
9
|
+
Requires-Dist: getversion>=1.0.2
|
|
10
|
+
Requires-Dist: itsdangerous>=2.2.0
|
|
11
|
+
Requires-Dist: jinja2>=3.1.0
|
|
12
|
+
Requires-Dist: pillow>=11.3.0
|
|
13
|
+
Requires-Dist: psutil>=7.1.3
|
|
14
|
+
Requires-Dist: pydantic-settings>=2.12.0
|
|
15
|
+
Requires-Dist: pypdfium2>=4.30.0
|
|
16
|
+
Requires-Dist: pyserial>=3.5
|
|
17
|
+
Requires-Dist: python-barcode>=0.15.1
|
|
18
|
+
Requires-Dist: python-multipart>=0.0.20
|
|
19
|
+
Requires-Dist: pyusb>=1.3.1
|
|
20
|
+
Requires-Dist: segno>=1.6.0
|
|
21
|
+
Requires-Dist: sqlmodel>=0.0.27
|
|
22
|
+
Requires-Dist: uvicorn>=0.38.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# 🏷️ LabelJetty
|
|
26
|
+
|
|
27
|
+
**Turn a cheap, USB-only TSPL thermal label printer into a smart, network-accessible label
|
|
28
|
+
printer** - drive it from your phone, desktop, or another machine over your LAN. It talks to the
|
|
29
|
+
printer **directly over USB** (no CUPS, no vendor driver) and gives you a mobile-first web UI, a
|
|
30
|
+
REST API, and a Python library for printing PNGs, PDFs, text, markdown, barcodes and QR codes.
|
|
31
|
+
Optional, self-contained [Homebox](https://github.com/sysadminsmedia/homebox) integration is
|
|
32
|
+
built in.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pip install labeljetty
|
|
38
|
+
# or, with uv:
|
|
39
|
+
uv tool install labeljetty
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This gives you three commands:
|
|
43
|
+
|
|
44
|
+
- `labeljetty` - runs the service (REST API + web UI + background print worker)
|
|
45
|
+
- `labeljetty-testbench` - drives the printer library directly (real device or dry-run)
|
|
46
|
+
- `labeljetty-hash-password` - generates a password hash for a login user
|
|
47
|
+
|
|
48
|
+
You need **Python 3.11+**, **libusb**, and a USB **TSPL** printer. Set at least `PRINTER_USB`
|
|
49
|
+
(e.g. `PRINTER_USB=vid:2d37:pid:62de`, found via `lsusb`) in a `.env` or the environment, then
|
|
50
|
+
run `labeljetty` and open **http://localhost:8888/**.
|
|
51
|
+
|
|
52
|
+
> Prefer Docker? The image is [`motey/labeljetty`](https://hub.docker.com/r/motey/labeljetty).
|
|
53
|
+
|
|
54
|
+
## Heads-up
|
|
55
|
+
|
|
56
|
+
- **No authentication by default** - fine on a trusted home LAN, but turn on `AUTH_MODE=protected`
|
|
57
|
+
before exposing it to an untrusted network.
|
|
58
|
+
- **Reference hardware is a Vretti 420B** (Poskey-class TSPL, ~203 dpi). It should work with any
|
|
59
|
+
USB TSPL printer; feedback/PRs for other models are welcome.
|
|
60
|
+
|
|
61
|
+
## More information
|
|
62
|
+
|
|
63
|
+
Full docs, the configuration reference, authentication, the REST API, printer/udev setup, and
|
|
64
|
+
Homebox integration live on **GitHub: https://github.com/motey/LabelJetty**
|