#python #resources #memory #path #module #bytecode #relative

python-packed-resources

Manage data structures containing Python resources

11 breaking releases

0.12.0 Dec 29, 2022
0.11.0 Nov 8, 2022
0.10.0 Jun 5, 2022
0.8.0 Oct 25, 2021
0.1.0 Apr 10, 2020

#626 in Filesystem

Download history 1023/week @ 2023-10-20 1245/week @ 2023-10-27 991/week @ 2023-11-03 1010/week @ 2023-11-10 1218/week @ 2023-11-17 1276/week @ 2023-11-24 1077/week @ 2023-12-01 1164/week @ 2023-12-08 1171/week @ 2023-12-15 811/week @ 2023-12-22 674/week @ 2023-12-29 1207/week @ 2024-01-05 1019/week @ 2024-01-12 912/week @ 2024-01-19 1046/week @ 2024-01-26 820/week @ 2024-02-02

4,169 downloads per month
Used in 5 crates (4 directly)

MIT/Apache

130KB
3K SLoC

About

This crate defines and implements a data format for storing resources useful to the execution of a Python interpreter. We call this data format Python packed resources. See the crate's documentation for more.

This crate is developed primarily for PyOxidizer. But it can be used outside the PyOxidizer project.

Getting Started

This crate defines a Rust library. There's nothing special about the library and it can be operated on like a typical Rust crate:

$ cargo build
$ cargo test
$ cargo doc

lib.rs:

Python Packed Resources

This crate defines and implements a data format for storing resources useful to the execution of a Python interpreter. We call this data format Python packed resources.

The idea is that a producer collects Python resources required by a Python interpreter - Python module source and bytecode, non-module resource files, extension modules, shared libraries, etc - attaches metadata to those resources (e.g. whether a Python module is also a package), and then serializes all of this out to a binary data structure.

Later, this data structure is parsed back into composite parts. e.g. to a mapping of Python module names and their respective data. This data structure is then consulted by a Python interpreter to e.g. power the module import mechanism.

This crate is developed primarily for PyOxidizer. But it can be used outside the PyOxidizer project. See the aforementioned docs for the canonical specification of this format.

Dependencies

~245KB