Skip to main content

# PyBaked

What is it?

This library allows you to "bake" your(or not) packages into a single file that can be imported as a normal package

But IDEs will not support this, only, if someone create an extension

Usage

There are two command-line tools: baked-make and baked-read

baked-read

Created for reading "baked" python packages. Reads metadata, creation date, packages and modules in it.

Usage:

baked-read backed_package_name

backed_package_name it is a file with extension .py.baked

Note: you can pass name without extension(tool will add it)

Or, to read module source from it:

baked-read backed_package_name -m module_name

module_name can be get from parentheses from first example run


baked-make

Created for "baking" packages into a single file.

Usage:

baked-make package_name -o baked_package_name

package_name is the name of the source package

baked_package_name is the name of the output "baked" package (this is optional argument)

All optional parameters and description:
-H / --hash - Hash modules in the package (if the hash not match in the package - loader will not load this package)
-m / --metadata - JSON formated metadata that will be serialized and baked into a file
-M / --metadata-file - path to a metadata JSON formatted file
-o / --output - "baked" package name


Importing

To import "baked" package you need to init loader first:

import pybaked


pybaked.loader.init()

And then, you can import "baked" packages as normal python packages:

import baked_package_name

BakedMaker

Class created for creating baked packages (used by baked-make tool)

Usage:

import pybaked

# Make baked package from real existent package
pybaked.BakedMaker.from_package(
    "pybaked",
    hash_content=True,
    metadata={"a": "b"}
).file("baked_package_name.py.baked")

This code will "bake" package pybaked into a single file named "baked_package_name.py.baked"

Example, without real existent package:

import pybaked

pybaked.BakedMaker(
    hash_content=True,
    metadata={"a": "b"}
).include_module(b"module_name", b"print(\"Source code\")").file(
    "baked_package_name"
)

Note: BakedMaker.include_module first parameter is a module name in an import format (example: subpackage.module_name)

For example, if you pass some.py into BakedMaker.include_module it will be added as py module in the some subpackage of the "baked" package


BakedReader

Class created for reading "baked" packages (used by baked-read tool)

Usage:

import pybaked

reader = pybaked.BakedReader("baked_package_name.py.baked")

# Package creation date
print("Package created at:", reader.created)

# Package metadata
print("Package metadata:", reader.metadata)

# Package modules (module_name, source_offset)
print("Package modules:", reader.modules)

# Package modules as dict {module_name: source_offset}
print("Package modules as dict:", reader.modules_dict)

# Package subpackages
print("Package subpackages:", reader.packages)

Note: reader combines package_name and module_name separating by dot

For example, when module_name is a "__init__" and package_name is a "baked_package". Then reader will return it as baked_package.__init__.

Metadata

Release files for pybaked 0.0.17

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

Source distribution (sdist)

Source distribution for pybaked 0.0.17
File Size Uploaded Provenance
pybaked-0.0.17.tar.gz 12.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pybaked 0.0.17
File Interpreter ABI Platform
pybaked-0.0.17-py3-none-any.whl Python 3 none any Details

Total release size: 26.2 kB

Release files / pybaked-0.0.17.tar.gz

Download URL pybaked-0.0.17.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fa34b8a5edda4d5c8c85b3b887bb2adf0c0a26b1a84572a6680372211c142a17
BLAKE2b-256 checksum
How to use checksums
5c4c5093d5c7ce4580f820a2da811bd61dc4a27a0066e39ba371576b0fb1c46a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.2 Linux/6.1.0-30-amd64

Release files / pybaked-0.0.17-py3-none-any.whl

Download URL pybaked-0.0.17-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65198b39448a1373a8ddac3a949b5bb181cf0b4eee9f54911f153fb3e77623ab
BLAKE2b-256 checksum
How to use checksums
e421b90e19b62827655d8bb0c1029df21d3ca0517cc57cc893bbe5c76d3edeb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.2 Linux/6.1.0-30-amd64

Security for pybaked 0.0.17

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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