The Pythonic Archive Kit
Project description
PAK: Picklable and Encrypted Recursive Namespace
PAK is a simple, recursive namespace that can be pickled and encrypted.
Usage
The PAK
class provides a way to create a recursive namespace that can be pickled and encrypted.
Classes
PAK
class PAK(SimpleNamespace):
"""This is the core of the PAK system. It is a recursive namespace that can be pickled and encrypted."""
# ...
Methods
save(data, path, password=None)
def save(data, path, password=None):
"""Save a PAK file to disk."""
# ...
load(path, password=None, create=True)
def load(path, password=None, create=True):
"""Load a PAK file from disk. If create is True, a new PAK file will be created if one does not exist."""
# ...
open_pak(path, password=None, create=True)
@contextlib.contextmanager
def open_pak(path, password=None, create=True):
"""Open a PAK file from disk. If create is True, a new PAK file will be created if one does not exist. Saves the PAK file on exit."""
# ...
Examples
RPG Save Data
Here's an example of using PAK to save and load player data for an RPG game:
# Save player data
with open_pak("player_data.pak") as player_data:
player_data.stats.level = 10
player_data.inventory.gold = 500
player_data.inventory.items = ["sword", "shield"]
# Load player data
with open_pak("player_data.pak") as player_data:
print(player_data.stats.level) # Output: 10
Project Management
PAK can also be used for managing project data:
# Save project data
with open_pak("project_data.pak") as project:
project.name = "My Awesome Project"
project.tasks = ["design", "implementation", "testing"]
# Load project data
with open_pak("project_data.pak") as project:
print(project.name) # Output: My Awesome Project
Personal Notes
Even for personal note-taking, PAK can be useful:
# Save personal notes
with open_pak("personal_notes.pak") as notes:
notes.journal.day1 = "Visited the park"
notes.reminders = ["Buy groceries", "Call mom"]
# Load personal notes
with open_pak("personal_notes.pak") as notes:
print(notes.journal.day1) # Output: Visited the park
Installation
pip install pythonic_archive_kit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pythonic_archive_kit-1.0.1.tar.gz
(15.0 kB
view hashes)
Built Distribution
Close
Hashes for pythonic_archive_kit-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e54e27edcaa1800fdd4406e03db48b2c10ed202775022ea119bcf506ac0bafe0 |
|
MD5 | 16a9cf217aa0de35c85837125aba9a97 |
|
BLAKE2b-256 | 13bb0312abb5dcb1a0985603124a44888c1b85533f0988622f8d6349f331ca29 |
Close
Hashes for pythonic_archive_kit-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f34ef551e0e2963301142ad008cc92a36ba1531a7dd56c53d311f90bdeb7245 |
|
MD5 | 46a46fbe4c9d1d3ca6896aab0e55d7c8 |
|
BLAKE2b-256 | 95e7ad5a5eaf841ebe74a03c67a603404205b672ca4b9e652c84ebf3d7662acb |