Pyarmor is a command-line tool designed for obfuscating Python scripts, binding them to specific machines, and setting expiration dates. It focuses on protecting intellectual property by making Python source code difficult to reverse engineer while maintaining functionality. The library is actively maintained with frequent updates and new features, with its current version being 9.2.4.
pip install pyarmorVerified import paths — ran on the pinned version, not inferred.
Obfuscate a Python script named `foo.py` and then run the obfuscated version located in the `dist` directory. This command creates `dist/foo.py` and an essential `pyarmor_runtime` package (or `pytransform` in older versions) that must be distributed with the obfuscated script.
Review Pyarmor 9.0 upgrade notes on official documentation. For CI/CD, consider obtaining a Pyarmor CI license or updating existing license configurations (e.g., regfiles for Group License).
Always run obfuscated scripts with the exact Python version and platform (architecture, OS) that was used to obfuscate them. Use `--platform` option for cross-platform obfuscation if pre-built runtimes are available for the target.
Ensure that the entire `dist` directory content (including `pyarmor_runtime` and `license.lic`) is distributed. Verify that `pyarmor_runtime` is in Python's import path on the target system. When using tools like PyInstaller, ensure they correctly bundle these runtime files.
Manually ensure all existing configuration and project rule files are explicitly encoded as `utf-8` or convert them if issues arise. Review file content for non-UTF-8 characters if problems persist.
Thoroughly test obfuscated scripts across all target Python versions and platforms, especially when using advanced obfuscation modes. If crashes occur, try disabling the most aggressive modes or check for the latest Pyarmor patches that address specific Python version compatibility issues. Refer to `When Things Go Wrong` section in documentation for troubleshooting.