Skip to main content

Compress and encode files/folders into self-extracting Python scripts

Project description

encoder-hh8019

Compress folders and encode files/archives into self-extracting Python scripts.
Each encoded .py file contains the full archive as base64 — just run it on any machine with Python to extract.


Install

pip install encoder8019ab

Dependencies (tqdm, py7zr) are installed automatically.


Usage — Python

from encoder import encode, update_encoded_files

# Compress a folder → photos.py  (max 7z compression)
encode(r"C:/backups/photos")

# Encode an existing archive → data.py
encode(r"C:/backups/data.zip")

# Encode to a specific output folder, keep the original
encode(r"C:/backups/data.rar", output_folder=r"C:/out", delete_after=False)

# Batch encode all .zip files in a folder
encode(r"C:/backups/*.zip", output_folder=r"C:/out")

# Update decoder in all previously encoded .py files (keeps data intact)
update_encoded_files(r"C:/encoded_files")

Usage — CLI

# Encode a file or folder
encoder8019ab encode C:/backups/photos
encoder8019ab encode C:/backups/data.zip C:/out
encoder8019ab encode "C:/backups/*.rar" --keep   # keep originals

# Update decoder in encoded .py files
encoder8019ab update C:/encoded_files
encoder8019ab update C:/encoded_files --no-recurse

Or via python -m encoder:

python -m encoder encode C:/backups/photos
python -m encoder update C:/encoded_files

Running an encoded file

When you run a generated .py file, it will prompt you for the output format:

Output format (default=.bin):
  1=.zip  2=.rar  3=.7z  4=.tar  5=.tar.gz  6=.tar.bz2  7=.gz  8=.bz2
Enter number or extension (blank=.bin):

Press Enter for .bin, pick a number, or type any extension (e.g. .zip).
The file is always extracted next to the script, with the script's base name.


Updater

If you want to change how encoded files decode (e.g. new format options), just update the package and run:

from encoder import update_encoded_files
update_encoded_files(r"C:/my_encoded_files")

This patches the decoder logic in every .py while leaving the embedded data untouched.
Files already on the current decoder version are skipped automatically.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

encoder8019ab-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

encoder8019ab-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file encoder8019ab-1.0.0.tar.gz.

File metadata

  • Download URL: encoder8019ab-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for encoder8019ab-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a2b48ded9e73f2a537f3e242a62bb870c61ed143993035a747a6f1db222549a0
MD5 1acb8518ed0d20fc0a8b89b42900cac7
BLAKE2b-256 065dd2861dc1417c953719850bdd0c20b8bb239486811d755ae6921819a3e2f9

See more details on using hashes here.

File details

Details for the file encoder8019ab-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: encoder8019ab-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for encoder8019ab-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71a42e9e660e1faf8d3c57518c81f0672d38532a700bd1530b95ae4becd8f21d
MD5 e1ac3f55632c596bc73c468daea8b237
BLAKE2b-256 2c212cc7799b433326274af70b68e1743f506ac83b9fb5f1f494a13e05892dd7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page