Encrypt your Python project
Use Cython to compile Python code to binary and support git-diff to get changed files conveniently.
Installation
$ pip install encryptpy
Basic Usage
Usage: encryptpy [OPTIONS] COMMAND [ARGS]...
Encrypt your Python code
Options:
--config TEXT The config file, ignore if given is invalid [default:
.encryptpy.cfg]
--help Show this message and exit.
Commands:
clean Simply clean `build` and `__pycache__` directory in DIRS
git-diff Compile files between two COMMITS, see `git-diff`: `--name-only`
init Copy src to build-dir and do compile, usually used for the...
run Compile given Python code files
For the subcommand info, use encryptpy <subcommand> --help.
Examples
For example, there is a package named package_a (notice the work directory):
$ tree -a .
.
├── .encryptpy.cfg
└── package_a
├── __init__.py
├── main.py
├── README.md
├── setup.py
└── utils.py
1 directory, 6 files
The .encryptpy.cfg's contents are as follow:
[encryptpy]
; Files will be compiled
paths =
package_a
; Files will be ignored when compiling, support Regex
ignores =
setup.py
; For command `init`, files will be ignored when copying, Glob-style
copy_ignores =
*.pyc
*.md
; The build directory
build_dir = build
; For commands `run` and `git-diff`, whether the source .py will be removed
clean_py = 0
1. Use in the first time
$ encryptpy init .
Look the build directory:
$ tree -a build
build
├── .encryptpy.cfg
└── package_a
├── __init__.cpython-38-x86_64-linux-gnu.so
├── main.cpython-38-x86_64-linux-gnu.so
├── setup.py
└── utils.cpython-38-x86_64-linux-gnu.so
1 directory, 5 files
2. Use normally by run
$ encryptpy run package_a/main.py
The package_a/main.py will be recompiled to package_amain.cpython-38-x86_64-linux-gnu.so
3. Use normally by git-diff
$ encryptpy git-diff 0.1 0.2
The changed files between tag(or commit, or branch) 0.1 and 0.2 will be compiled.
Defect
The defects mainly come from Cython - some Python code can not be compiled correctly. Here are known issues:
-
Assignment Expressions:=: Implement PEP 572: Assignment Expressions #2636 -
@dataclass: Implement @dataclass for cdef classes #2903 -
Class method decorators combination: Combining @staticmethod with other decorators is broken #1434
e.g.
class C: @staticmethod @some_decorator def f(): pass
but this can be rewrite to
f = staticmethod(some_decorator(f)), it's ok.
If you have some code like the above, you can refactor or just ignore them, it is safe enough for most projects.
2022.08.10 UPDATE: It seems that the first two defects have been resolved.
Metadata
Release files for encryptpy 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| encryptpy-1.0.6.tar.gz | 9.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| encryptpy-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.1 kB
Release files / encryptpy-1.0.6.tar.gz
| Download URL | encryptpy-1.0.6.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88b5e34896762e44f9192639e8a153d1e1191004d6bbbdf0b817bbca3882dd3e
|
|
BLAKE2b-256 checksum How to use checksums |
bf80b68c7b1ff9e5d3a670ab547cb72e2e98ebe54a4d0f9eeec5ab0ae7297dc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / encryptpy-1.0.6-py3-none-any.whl
| Download URL | encryptpy-1.0.6-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a114fb6950832cbc7fe2e104839622bb91552dc4d6641ac498e8208e5e533d5
|
|
BLAKE2b-256 checksum How to use checksums |
4604ab1af711e364047f7577bd320f11cd66524261392ca63908e55dcd67526d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Security for encryptpy 1.0.6
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.