Skip to main content

PAK: Pythonic Archive Kit

PyPI version PyPI - Python Version [PyPI - License](

Picklable and Encrypted Recursive Namespace

PAK is a Python library that provides a simple, recursive namespace that can be pickled and encrypted. It allows you to manage structured data with ease.

Features

  • Simple Interface: PAK provides a simple interface for managing data. It can be used like a dictionary or an object. It automatically handles the creation of nested namespaces, this allows for structured data management.

  • Recursive Namespace: PAK offers a recursive namespace that can be used like a dictionary or an object. This allows for flexible and structured data management.

  • Context Manager: PAK provides a context manager that automatically saves and loads PAK objects. This makes it easy to manage your data.

  • Pickling: PAK objects can be easily serialized, it utilizes pickle, or optionally dill, to serialize data. This allows you to save and load your PAK objects. This process is block hashed to help protect against data corruption and tampering.

  • Compression: PAK supports compression of data using the `lzma' or 'gzip' packages. This reduces the size of your PAK files.

  • Encryption (Optional): PAK supports optional encryption of data using the cryptography package. This ensures the security of your PAK files.

Installation

You can install PAK using pip:

pip install pythonic_archive_kit

This will provide the basic implementation of PAK. If you want to use encryption, you will need to install the cryptography package:

pip install cryptography
# or
pip install pythonic_archive_kit[encryption]

And to include the more advanced serialization provided by dill:

pip install dill
# or
pip install pythonic_archive_kit[serialization]

Usage

Basic Usage

from pythonic_archive_kit import load_pak, PAK, save_pak

# Create a PAK object
pak = PAK()
pak.foo = "bar"
pak["baz"] = "qux"

# Save and load PAK objects
save_pak(pak, "example.pak")
loaded_pak = load_pak("example.pak")

You can also make use of the paks context manager to automatically save and load PAK objects:

from pythonic_archive_kit import open_pak

with open_pak("gamedata") as gamedata:
    ...

Encryption (Optional)

To use encryption, ensure you have the cryptography package installed. You can encrypt PAK data by providing a password:

from pythonic_archive_kit import save_pak, load_pak, PAK

pak = PAK()
# Save an encrypted PAK file
save_pak(pak, "encrypted.pak", password = "mypassword")

# Load the encrypted PAK file
loaded_pak = load_pak("encrypted.pak", password = "mypassword")

A password can also be passed to the context manager:

from pythonic_archive_kit import open_pak

with open_pak("gamedata", password = "mypassword") as gamedata:
    ...

Examples

Here are some examples of how PAK can be used in different scenarios, including game development, project management, and personal note-taking.

RPG Save Data

# Save player data
from pythonic_archive_kit import open_pak

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

# Save project data
from pythonic_archive_kit import open_pak

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

from pythonic_archive_kit import open_pak

# 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

Contributing

Feel free to contribute to PAK by opening an issue or pull request. If you have any questions, feel free to contact me at via GitHub.

License

GNU General Public License v3.0

PAK is licensed under the GNU General Public License v3.0. See the LICENSE file for more information.

Release files for pythonic_archive_kit 2.0.1

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

Source distribution (sdist)

Source distribution for pythonic_archive_kit 2.0.1
File Size Uploaded
pythonic_archive_kit-2.0.1.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pythonic_archive_kit 2.0.1
File Interpreter ABI Platform
pythonic_archive_kit-2.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 38.9 kB

Release files / pythonic_archive_kit-2.0.1.tar.gz

Download URL pythonic_archive_kit-2.0.1.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0de425991d26de4d08c45238e459dbec8a47bbc847eefa718ed70d427d19963c
BLAKE2b-256 checksum
How to use checksums
ac2af7095db16548077927f0a7d3680f5e3e135e04b8faf337a0fdf614581aca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / pythonic_archive_kit-2.0.1-py2.py3-none-any.whl

Download URL pythonic_archive_kit-2.0.1-py2.py3-none-any.whl
Size 19.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
45434b2ac5b3c082e47f61cdb90fdb94fd351dffa3a27859be33419d1212b44a
BLAKE2b-256 checksum
How to use checksums
b6663c942c5caa4acf6e2941d243cdf303252384c2624d548d502d05665da70c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

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