Python code protection
Project description
Industry-grade Python code protection.
For a comprehensive license management solution that is both developer- and user-friendly, check out the Stonefish License Manager.
Quickstart
Protecting Python Packages
To protect a Python project using the Stonefish Code Shield, ensure that it
includes a minimal
pyproject.toml
file. Then simple replace your build system (e.g., setuptools) with
stonefish_code_shield in the pyproject.toml file:
[build-system]
# requires = ["setuptools"]
# build-backend = "setuptools.build_meta"
requires = ["stonefish-code-shield"]
build-backend = "stonefish_code_shield.build_meta"
# ...
# additional project metadata as per PEP 621
# <https://peps.python.org/pep-0621/>
# (recommended)
# ...
Done! Your project is now protected with Stonefish Code Shield. Try it out by running
pip install .
or
(pip install build)
python -m build . --wheel
[!TIP]
In some situations, turning off code protection can be beneficial, for example when testing your software. To turn off Stonefish Code Shield, build with
python -m build . --wheel -Cstonefish=offWhen testing with tox, a possible config is
[tox] envlist = py3 [testenv:.pkg] passenv = * config_settings_build_wheel = stonefish-code-shield = off [testenv] passenv = * package = wheel deps = pytest commands = pytest
Protecting Standalone Python Scripts
For individual Python files, you can use the scs command-line utility:
scs /path/to/file.py
Guidelines
Here are some guidelines to keep in mind while working with Stonefish Code Shield:
-
Stonefish renames class and function names, so relying on the
__name__attribute in your code won't be possible. -
Stonefish cannot yet handle relative
*imports, e.g.,from .utils import *
In your code, make all imports explicit:
from .utils import div_to_mod, Extractor
This is recommended practice anyway.
-
Stonefish hides private (underscored) names from the API. If you want your users to use these variables or functions, you'll have to rename them.
-
Users must add
*.datfiles to their package data, e.g.,[tool.setuptools.package-data] "*" = ["*.dat"]
in
pyproject.toml. This is because the encrypted code must be shipped with the package. -
Local imports should be relative (
from . import x) instead of using absolute imports (import x) ifx/orx.pyis an internal folder or directory. -
Stonefish places all data files in a flat directory structure, so it cannot handle files that are read from two different Python paths.
./data.dat ./a.py Path(__file__).parent / "data.dat" ./b/b.py Path(__file__).parent / .. / "data.dat"
More info
For details on on Stonefish Code Shield protects your code, see here.
Contact support@mondaytech.com for more info.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stonefish_code_shield-0.3.71-py3-none-any.whl.
File metadata
- Download URL: stonefish_code_shield-0.3.71-py3-none-any.whl
- Upload date:
- Size: 76.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47aaf2f628c2f92741703da0ee5490693b6beb3f40353a8dcc281b4c71c3ef1d
|
|
| MD5 |
e71ace015be4fa9c362b5c076d8a5387
|
|
| BLAKE2b-256 |
19fa6e5137af0496ba04468ca8b26d851e73800affd8daa65ad23641bfe40935
|
Provenance
The following attestation bundles were made for stonefish_code_shield-0.3.71-py3-none-any.whl:
Publisher:
release.yml on stonefish-dev/code-shield-dev
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stonefish_code_shield-0.3.71-py3-none-any.whl -
Subject digest:
47aaf2f628c2f92741703da0ee5490693b6beb3f40353a8dcc281b4c71c3ef1d - Sigstore transparency entry: 158016554
- Sigstore integration time:
-
Permalink:
stonefish-dev/code-shield-dev@9f9cf216b07eb41254e26a635e198be5f982e74d -
Branch / Tag:
refs/tags/0.3.71 - Owner: https://github.com/stonefish-dev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9f9cf216b07eb41254e26a635e198be5f982e74d -
Trigger Event:
release
-
Statement type: