Skip to main content

SAMARTH ENC 0.4.0

SAMARTH ENC is a modular Python source-protection toolkit. It is designed to raise the cost of casual source inspection while remaining honest about the limits of Python protection.

Profiles

  • STANDARD: constant transformation + compilation.
  • ADVANCED: STANDARD + conservative identifier renaming.
  • MAXIMUM: ADVANCED + Python optimize=2.
  • NATIVE: currently uses the same safe internal transformation as MAXIMUM; a native compiler is not claimed unless an external backend is selected.
  • HYBRID: internal transformation plus optional external backend selection. The CLI delegates to an installed PyArmor or Nuitka backend.

These profiles are deliberately documented rather than pretending to provide different cryptographic strength.

Internal format

Source is parsed with ast, transformed, compiled to Python code objects, marshalled, compressed with zlib, wrapped with build metadata, and protected by a SHA-256 integrity digest. The runtime validates the digest before loading.

This is not encryption and is not tamper-proof. Python bytecode/code objects and the runtime needed to execute them can ultimately be inspected by a determined analyst. Compatibility is conservative around reflection, decorators, dynamic exec/eval, metaprogramming, and special identifiers.

CLI

samarth --version
samarth inspect app.py
samarth protect app.py
samarth protect app.py --profile maximum
samarth protect app.py --backend pyarmor
samarth protect app.py --backend nuitka
samarth protect app.py --backend hybrid

Runtime

.sme files are payload containers, not directly executable Python scripts. Applications can load them with samarth.runtime.execute_payload().

Testing

Run:

python -m unittest discover -s tests -v
python -m build

External PyArmor/Nuitka integrations are only tested when those tools are installed in the environment. No claim is made for environments not tested.

Publishing

Build with python -m build, then upload with your preferred PyPI publisher such as twine upload dist/*.

Multi-version CPython payloads (0.5.0)

SAMARTH 0.5.0 can build four version-specific .sme payloads for CPython 3.11, 3.12, 3.13 and 3.14:

samarth protect-multi app.py -o dist_multi

The four target CPython interpreters must be installed and discoverable, or can be supplied explicitly:

samarth protect-multi app.py -o dist_multi \
  --python311 /path/to/python3.11 \
  --python312 /path/to/python3.12 \
  --python313 /path/to/python3.13 \
  --python314 /path/to/python3.14

Output:

dist_multi/
  app_py311.sme
  app_py312.sme
  app_py313.sme
  app_py314.sme
  manifest.json

The matching payload can be selected automatically at runtime:

samarth run-bundle dist_multi --name app

This loader selects by the running CPython major/minor version and performs the existing SAMARTH integrity verification before execution. A .sme remains Python-version-specific; the four payloads are not interchangeable. Windows, Linux, Termux and Pydroid can use the matching payload when they provide a compatible CPython runtime and the application's dependencies.

Build requirement: SAMARTH does not fake a target version. Each payload is compiled by the actual target CPython interpreter. If a target interpreter is missing, the multi-version command fails clearly instead of producing a mislabeled payload.

Metadata

Release files for samarth 0.5.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 samarth 0.5.1
File Size Uploaded Provenance Actions
samarth-0.5.1.tar.gz 13.8 kB Without provenance Details for samarth-0.5.1.tar.gz

Built distribution (wheel)

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

Total release size: 28.7 kB

Release files / samarth-0.5.1.tar.gz

Download URL samarth-0.5.1.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f4e6783935dcde98231c29c253c3a233d2913c6672700f7873efff71673a81ea
BLAKE2b-256 checksum
How to use checksums
716bff681da446f328568369423b5c5a42c23149ef5630bac2381edc503a1234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / samarth-0.5.1-py3-none-any.whl

Download URL samarth-0.5.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f75633cf9a24cd7ef55983d4701286a7648fec59a8f79840a6289d68c426c9a8
BLAKE2b-256 checksum
How to use checksums
d0df9ebcb09fb8f23a08ea3352eddeacd38f90d09d3f65c7651ba9bd14c9f442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for samarth 0.5.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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