Skip to main content

Overview

This is a simple API wrapper that allows interaction with a PackaideServer instance.

The API allows for passing multiple SVG files to the server, which are then nested into one or more SVG files. The resulting SVG files are then returned to the client.

Installation

pip install packaide_client

Usage

The main class is a PackaideClient which exposes a single method pack. This method takes a list of SVG strings, height and width (in inches) and returns a list of SVG strings. The resulting SVG strings will have the nested shapes.

As a side note, the original size (ie: viewBox) of the input SVG files has no influence on the size of the output SVG files. The output SVG will always conform to the height and width parameters. However, if any shape or path in the input SVG files is too large to fit in the output SVG, a ValueError will be always be raised.

Example

from packaide_client import PackaideClient

# URL is the address of the server instance, usually operating on port 8000
URL = "http://localhost:8000"

client = PackaideClient(URL)

svg1 = "<svg>...</svg>"
svg2 = "<svg>...</svg>"

results = client.pack([svg1, svg2], height=60, width=40,
                      tolerance=.1,
                      offset=5,
                      rotations=4)  # Returns a list of SVGs

# results can be passed to other functions
for sheet in results:
    print(sheet)

# Or written to a files
for i, sheet in enumerate(results):
    with open(f"sheet_{i}.svg", "w") as f:
        f.write(sheet)

Parameters

The pack method takes the following parameters:

  • svgs: A list of SVG strings to be nested
  • height: The height of the output SVG in inches
  • width: The width of the output SVG in inches
  • tolerance: The tolerance used when quantizing curves (Discretization tolerance)
  • offset: The offset distance around each shape (dilation)
  • rotations: The number of rotations to attempt when nesting shapes.

Release files for packaide-client 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for packaide-client 1.0.2
File Size Uploaded
packaide_client-1.0.2.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for packaide-client 1.0.2
File Interpreter ABI Platform
packaide_client-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / packaide_client-1.0.2.tar.gz

Download URL packaide_client-1.0.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f3559ed19033a4b2de3a5db75b3104752a650387bc2b644ced9419eaef7ff180
BLAKE2b-256 checksum
How to use checksums
8d6f222ababe1f3285ffb521b4ef9aa59430e0fb58a1d98586bfd0c99e2c8fdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / packaide_client-1.0.2-py3-none-any.whl

Download URL packaide_client-1.0.2-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e103fce5fe11a71d8bd905da48c1ac85ae88a38c070713d7480eff84d102726
BLAKE2b-256 checksum
How to use checksums
1d7ca190be97c153fe10db8c819c12032fc2a8e53343b67cec8ee028b1defaa7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release 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