Skip to content

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

License

Notifications You must be signed in to change notification settings

EpocDotFr/parkitect-blueprint-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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.