Skip to main content

🖨 Python CUPS print options generator from PPD

📥 Installation

📦 From pip:

python -m pip install -U pycups_po

🏗 From git:

git clone https://github.com/WhiteApfel/pycups_po.git
cd pycups_po
python setup.py install

🧑‍🏫 How to use

🐍 Example

import cups

from pycups_po import PrinterOptionsGenerator
from pycups_po.models import PrinterOption

conn = cups.Connection()

generator = PrinterOptionsGenerator(conn, "CT-S2000")

ops: list[PrinterOption] = generator.get_ppd_options()
for op in ops:
    print(op)

with open("tr4500.py", "w+") as f:
    f.write(generator.generate_options_dataclass(printer_name="TR-4500"))

You can specify name of printer when init PrinterOptionsGenerator, then it will be used by default. Or you can pass name to function.

📋 Dataclasses

@dataclass
class OptionValue:
    value: str
    pretty_value: str


@dataclass
class PrinterOption:
    name: str
    type: Literal["PickOne"]
    default_value: str
    values: list[OptionValue]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycups_po-0.0.1.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycups_po-0.0.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file pycups_po-0.0.1.tar.gz.

File metadata

  • Download URL: pycups_po-0.0.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pycups_po-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7541e882a15aa34fd01e1e807fcf95d4dfa30afdd9cb9c40defe603e500cc217
MD5 1c898fce711561830e878bec6a751ecb
BLAKE2b-256 fbc69018bcf36f6e05744d738e26a13ca24b31e2da9c4f6a0c1e7bdb8b059859

See more details on using hashes here.

File details

Details for the file pycups_po-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pycups_po-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for pycups_po-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad10b19b0d8fc6fa6d146c6f317abbb8d1e60d3f2f236534c824b5579a6793e
MD5 0585df761b862652046715680155b4ae
BLAKE2b-256 2ec5f4397cf5965bb9849ad224347a1a224e781728fe612a0d09dddd05d1ca30

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

0.1.0

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

This release

0.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page