Skip to main content

Python API and CLI tool to read Parkitect's blueprints metadata.

Project description

Parkitect Blueprint Reader

Python API and CLI tool to read Parkitect's blueprints metadata.

Python versions Version License

PyPI - Documentation - Source code - Issue tracker - Changelog

Prerequisites

  • Python >= 3.10

Installation

From PyPi

pip install parkitect-blueprint-reader

Locally

After cloning/downloading the repo:

pip install .

Usage

API

The API consists of one load() method, which reads blueprint metadata from the given binary file-like object and returns the parsed data as a dictionary.

import parkitect_blueprint_reader
from pprint import pprint

try:
    with open('coaster.png', 'rb') as fp: # Note it's opened in binary mode
        pprint(
            parkitect_blueprint_reader.load(fp)
        )
except Exception as e:
    print(e)

CLI

The CLI reads metadata from the given blueprint filename, then writes the parsed data as a JSON to stdout.

parkitect-blueprint-reader coaster.png

The --pretty option may be used to pretty-print the outputted JSON.

Data format

Data is stored in blueprints as follows, using the least significant bits steganography technique (described in the reference documents below):

  • A three-bytes magic number: SM\x01 (Parkitect's main developer initials)
  • Size (little-endian unsigned int), in bytes, of the gzippped content to be read
  • A 16-bytes MD5 checksum
  • The actual gzippped data, which is Size bytes long

References

Development

Getting source code and installing the package with dev dependencies

  1. Clone the repository
  2. From the root directory, run: pip install -e ".[dev]"

Releasing the package

From the root directory, run python setup.py upload. This will build the package, create a git tag and publish on PyPI.

__version__ in parkitect_blueprint_reader/__version__.py must be updated beforehand. It should adhere to Semantic Versioning.

An associated GitHub release must be created following the Keep a Changelog format.

Project details


Download files

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

Source Distribution

parkitect_blueprint_reader-1.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

parkitect_blueprint_reader-1.1.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file parkitect_blueprint_reader-1.1.1.tar.gz.

File metadata

File hashes

Hashes for parkitect_blueprint_reader-1.1.1.tar.gz
Algorithm Hash digest
SHA256 55a467e26c7b33d3f1b8f3c73fec84f289364d3dc3bc6516849d2063d46bbe1c
MD5 30fcd995ae38e10c79dc5f7cf9405f46
BLAKE2b-256 8fa21593845c1039c080a5c24fe45bb573d1a21d5ec45c49acaf19c7922743b5

See more details on using hashes here.

File details

Details for the file parkitect_blueprint_reader-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for parkitect_blueprint_reader-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4440b5304daf765a079bbbf55ffb0ea4f4737a155c8611f6a79233fdad897feb
MD5 14a903445e405032e4475ecb10ac2685
BLAKE2b-256 54dc3359a82bce425f0aee64ebce236ba238881489ea76048e4ad68f212d4c0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page