Pyarmor CLI Core
Pyarmor-cli-core is the foundational library for Pyarmor, providing the platform-specific extension modules (like `pytransform3`) necessary for obfuscating Python scripts and executing obfuscated code. It serves primarily as a dependency for the main `pyarmor` CLI tool. As of its latest PyPI release, the current version is 8.1.1. Releases for `pyarmor-cli-core` are tightly coupled with `pyarmor` releases, offering updated binaries for new Python versions and features.
Warnings
- breaking For Pyarmor 8.0+ (and thus `pyarmor-cli-core` 8.x onwards), the `pyarmor init` command has been removed, and the CLI interface has been streamlined to `gen`, `reg`, `cfg` commands only. Old scripts or automation relying on removed commands will fail.
- breaking Upgrading to Pyarmor 9.2+ (and its compatible `pyarmor-cli-core` backend) requires re-requesting or updating registration files for CI and Group Licenses due to changes in license binding mechanisms. Older registration files will not work with Pyarmor 9.2+.
- gotcha Configuration files and project rule files in Pyarmor 9.2.2+ (and compatible `pyarmor-cli-core`) now default to UTF-8 encoding. Scripts or tools relying on different default encodings for these files may encounter `UnicodeDecodeError` or other encoding-related issues.
- gotcha `pyarmor-cli-core` (as part of the Pyarmor ecosystem) can experience runtime crashes or unexpected behavior with specific Python versions (e.g., 3.12, 3.13) or advanced obfuscation modes (e.g., BCC, RTF) if not kept up-to-date. Many such compatibility and stability issues were fixed in newer `pyarmor` 9.x releases.
Install
-
pip install pyarmor-cli-core
Imports
- pytransform3
import pytransform3
Quickstart
import pytransform3
try:
# Verify the pytransform3 module is loaded and get its version
runtime_version = pytransform3.pyarmor_version()
print(f"Pytransform3 module loaded successfully. Version: {'.'.join(map(str, runtime_version))}")
# Note: pyarmor-cli-core itself does not expose obfuscation functions directly.
# It provides the runtime environment and core binaries used by the 'pyarmor' tool.
# To obfuscate scripts, you typically use the 'pyarmor' package/CLI:
# (Requires: pip install pyarmor)
# from pyarmor import pyarmor_build
# pyarmor_build.obfuscate('your_script.py')
except ImportError:
print("Error: pytransform3 module not found. Is pyarmor-cli-core installed correctly?")
except Exception as e:
print(f"An unexpected error occurred: {e}")