🖨 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
content: str
@dataclass
class PrinterOption:
name: str
pretty_name: Optional[str]
type: Literal["PickOne"]
default_value: str
values: List[OptionValue]
💻 CLI
Show list of printers
pycups_po printers
# or
pycups_po printers --host 192.168.1.12
# or
pycups_po printers --host 192.168.1.12 --port 6631
🖨 Printers
├── CT-S2000
│ ├── Info: CITIZEN CT-S2000
│ └── State: ⏳ idle
└── TR4540
├── Info: Canon TR4540
└── State: ⏳ idle
Show options
pycups_po options TR4540
# You can set the --host and --port in the same way
⚙️ Options
├── MediaType (Media Type)
│ ├── Type: PickOne
│ ├── Default: matte
│ └── Values:
│ ├── 'plain' (Plain Paper): <</MediaType(plain)>>setpagedevice
│ ├── 'glossygold' (Photo Paper Plus Glossy II): <</MediaType(glossygold)>>setpagedevice
...
├── Duplex (Duplex Printing)
│ ├── Type: PickOne
│ ├── Default: None
│ └── Values:
│ ├── 'None' (Off):
│ ├── 'DuplexNoTumble' (Long-side stapling):
│ └── 'DuplexTumble' (Short-side stapling):
└── ColorModel (Color Model)
├── Type: PickOne
├── Default: rgb
└── Values:
└── 'rgb' (RGB):
Generate dataclass file
pycups_po generate -o ./tr4540.py TR4540
# or
pycups_po generate --output-file ~/printer.py TR4540
# You can set the --host and --port in the same way
Metadata
Release files for pycups-po 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pycups_po-0.1.1.tar.gz | 11.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycups_po-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.7 kB
Release files / pycups_po-0.1.1.tar.gz
| Download URL | pycups_po-0.1.1.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5db37479f402cb6467b94c28dc746caf1b791fc94122fdd98c30fb47d168a9d7
|
|
BLAKE2b-256 checksum How to use checksums |
cc1b925c83fea9e3030d98c02bb475748746cec0434d5194e559961f60e13cac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / pycups_po-0.1.1-py3-none-any.whl
| Download URL | pycups_po-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d66b86beca70f92362647302e9603aaa16710cfffc899d39ab91e30c88e92238
|
|
BLAKE2b-256 checksum How to use checksums |
282143acb8378a30b3208b2fe7401c0b88cca8a761d6827ee6644fbd5839ff4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for pycups-po 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.