Protect your python source code with one command.
Project description
Goldenmask: Protect your python source code
Goldenmask is a tool to protect your python source code easily. It has two methods at the moment: using Compileall or using Cython. It has a corresponding option named --layer/-l
, you can choose your favorite method by yourself. Meanwhile, it can protect different file types: python files end with .py
, wheel packages end with .whl
and source package end with .tar.gz
.
Goldenmask is a name derived from a Chinese kungfu named "JinZhongZhao". Because it is not a qualified phrase in a sense, this name is so unique that can be used as a temporary compilation directory named __goldenmask__
and a compilation information file named .goldenmask
which contains the detailed python version string and the platform string.
Let's try to goldenmask now!
Quick Start
$ pip install goldenmask
# the default method is Compileall
$ goldenmask yourpythonfile.py
$ tree -a .
.
├── __goldenmask__
│ ├── .goldenmask
│ └── yourpythonfile.pyc
└── yourpythonfile.py
1 directory, 3 files
# repalce your python file
$ goldenmask -i yourpythonfile.py
$ tree -a .
.
├── .goldenmask
└── yourpythonfile.pyc
0 directories, 2 files
# protect python files under directory
$ goldenmask yourpythonmoduledir
# protect the wheel package
$ goldenmask goldenmask-0.1.2-py3-none-any.whl
# protect the source packege
$ goldenmask goldenmask-0.1.2.tar.gz
Installation
Goldenmask is distributed on PyPI and supports Python 3.6+. You can simply install goldenmask as below:
$ pip install -U goldenmask
However, it's a better choice to use a virtual environment:
$ python -m venv env
# On Windows:
$ .\venv\Scripts\activate
# On Linux:
$ source env/bin/activate
$ pip install goldenmask --upgrade
Because goldenmask depends on Cython, you should make sure that there is an appropriate C compiler on your machine. You can see the detailed guide on Cython's documentation. By the way, if you works on a Linux system, you can easily fetch everything you need with one command sudo apt-get install build-essential
on Ubuntu and yum groupinstall "Development Tools"
on Centos. However, If you are using Mac OS X or Windows, you may spend quite some time installing this compilers.
Usage
You can get everything using option --help
:
$ goldenmask --help
Usage: goldenmask [OPTIONS] [FILES_OR_DIRS]...
Goldenmask is a tool to protect your python source code easily.
FILES_OR_DIRS can be python files, wheel packages,source packages or dirs
contain python files.
Options:
-l, --layer <int> Level of protection: 1 - compileall; 2 - cython.
-i, --inplace Whether compile python files in place.
--no_smart This will copy and compile everything you specified.
--help Show this message and exit.
Credits
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
Built Distribution
Hashes for goldenmask-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c42bb1d8b007081ce6d97cee2d731849eb84657f5aa32c78a4b2a4bd44ca86cf |
|
MD5 | d921547f0cea96ca22ab5b674f25becc |
|
BLAKE2b-256 | d6c05e558ae1daf3cc0b1bf988dfdcc043805df66e8def4c6d9025c1683895f3 |