py2native 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py2native-0.1.3/PKG-INFO +209 -0
- py2native-0.1.3/README.md +201 -0
- {py2native-0.1.1 → py2native-0.1.3}/pyproject.toml +3 -3
- py2native-0.1.3/src/py2native.egg-info/PKG-INFO +209 -0
- py2native-0.1.1/PKG-INFO +0 -13
- py2native-0.1.1/README.md +0 -5
- py2native-0.1.1/src/py2native.egg-info/PKG-INFO +0 -13
- {py2native-0.1.1 → py2native-0.1.3}/setup.cfg +0 -0
- {py2native-0.1.1 → py2native-0.1.3}/src/py2native.egg-info/SOURCES.txt +0 -0
- {py2native-0.1.1 → py2native-0.1.3}/src/py2native.egg-info/dependency_links.txt +0 -0
- {py2native-0.1.1 → py2native-0.1.3}/src/py2native.egg-info/top_level.txt +0 -0
py2native-0.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py2native
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Python to native compiler.
|
|
5
|
+
Author-email: RSJ Software GmbH <ruediger.jungbeck@rsj.de>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# Py2Native
|
|
10
|
+
|
|
11
|
+
More information on [https://py2native.dev](https://py2native.dev)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
````
|
|
15
|
+
uv add --dev Py2Native
|
|
16
|
+
````
|
|
17
|
+
Installs Py2Native in the current project
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
````
|
|
21
|
+
uv run py2native build [--embed <targetDir>] <mainModule> [<module>...]
|
|
22
|
+
````
|
|
23
|
+
Compiles and links the given modules.
|
|
24
|
+
|
|
25
|
+
### Environment on Windows
|
|
26
|
+
* P2N_MINGW32 path to unpacked [https://github.com/mstorsjo/llvm-mingw/releases/download/20260602/llvm-mingw-20260602-ucrt-i686.zip](https://github.com/mstorsjo/llvm-mingw/releases/download/20260602/llvm-mingw-20260602-ucrt-i686.zip)
|
|
27
|
+
|
|
28
|
+
## Restrictions
|
|
29
|
+
* No modules with identical names
|
|
30
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
* C-Python 3.10, 3.11, 3.12, 3.13, , 3.14, 3.14 freethreaded, 3.15, 3.15 freethreaded
|
|
33
|
+
* Python supported C Compiler / Linker for your platform
|
|
34
|
+
* * Visual Studio or llvm-mingw32 on Windows
|
|
35
|
+
* Windows 8, Windows 10, Windows 11, ManyLinux 2014 or ManiMusl compatible Linux, or MacOS
|
|
36
|
+
* X64 CPU or ARM64 CPU
|
|
37
|
+
* Internet Access for downloading the used libraries and Python Distributions
|
|
38
|
+
|
|
39
|
+
## What we do
|
|
40
|
+
* Compile your software with Cython to .c and than into the native executables
|
|
41
|
+
* Link the object files together into a single executable (that can be a main executablemor a shared library)
|
|
42
|
+
* Support importing from within that single executable
|
|
43
|
+
* Embed some of the libraries with your executable
|
|
44
|
+
* Provide an embedded installation
|
|
45
|
+
|
|
46
|
+
## Protection
|
|
47
|
+
You no longer distribute your source code. 100% of **your** code is compiled to c and then to native executable format so recovering it is pretty difficult.
|
|
48
|
+
Reverse engineering is, while still possible, not easy.
|
|
49
|
+
|
|
50
|
+
Monkey patching is still possible (because big parts of the used libraries are still available in Python source.
|
|
51
|
+
|
|
52
|
+
### Legal Considerations
|
|
53
|
+
* All libraries remain as they are. So copyright messages remain in distribution.
|
|
54
|
+
* LGPL restrictions are still met. The user can replace the library with a different version.
|
|
55
|
+
|
|
56
|
+
## Deployment Recipes
|
|
57
|
+
|
|
58
|
+
### Windows
|
|
59
|
+
You will usually need an installer to distribute the created embed directory. This directory holds all the used libraries and might contain thousands of files.
|
|
60
|
+
It is recommended to use a tool like NSIS or Inno Setup to create an installer.
|
|
61
|
+
|
|
62
|
+
#### InnoSetup
|
|
63
|
+
````
|
|
64
|
+
[Setup]
|
|
65
|
+
AppId="Test Application"
|
|
66
|
+
AppName="Test Application"
|
|
67
|
+
AppVerName=Test Application
|
|
68
|
+
AppPublisher=RSJ Software GmbH
|
|
69
|
+
AppPublisherURL=https://www.rsj.de
|
|
70
|
+
AppSupportURL=https://www.rsj.de
|
|
71
|
+
AppUpdatesURL=https://www.rsj.de
|
|
72
|
+
DefaultDirName={commonpf}\TestApplication
|
|
73
|
+
DefaultGroupName=Test Application
|
|
74
|
+
OutputBaseFilename={#outputName}
|
|
75
|
+
Compression=lzma
|
|
76
|
+
SolidCompression=yes
|
|
77
|
+
InternalCompressLevel=ultra
|
|
78
|
+
VersionInfoCompany=RSJ Software GmbH
|
|
79
|
+
VersionInfoCopyright=Copyright (C) 2026 by RSJ Software GmbH Germering. All rights reserved.
|
|
80
|
+
VersionInfoDescription=Test Application
|
|
81
|
+
VersionInfoProductName="Test Application"
|
|
82
|
+
VersionInfoVersion={#version}
|
|
83
|
+
VersionInfoProductVersion={#version}
|
|
84
|
+
VersionInfoTextVersion={#version}
|
|
85
|
+
VersionInfoProductTextVersion={#version}
|
|
86
|
+
ShowLanguageDialog=no
|
|
87
|
+
WizardImageStretch=no
|
|
88
|
+
MinVersion=10.0.10240
|
|
89
|
+
ArchitecturesInstallIn64BitMode=x64
|
|
90
|
+
|
|
91
|
+
[Files]
|
|
92
|
+
Source: ..\embed\*; DestDir: {app}; Excludes: config.json; Flags: ignoreversion overwritereadonly uninsrestartdelete recursesubdirs setntfscompression;
|
|
93
|
+
|
|
94
|
+
[Dirs]
|
|
95
|
+
Name: {app}/data; Permissions: everyone-full;
|
|
96
|
+
|
|
97
|
+
[Run]
|
|
98
|
+
Filename: "{app}\testApplication.exe"; Flags: postinstall
|
|
99
|
+
|
|
100
|
+
[Icons]
|
|
101
|
+
Name: "{group}\TestApplication"; Filename: "{app}\testApplication.exe"
|
|
102
|
+
````
|
|
103
|
+
### Linux
|
|
104
|
+
You could either do:
|
|
105
|
+
* distribute a .zip file with the embed directory
|
|
106
|
+
* distribute a .tar.gz file with the embed directory
|
|
107
|
+
* create a docker image
|
|
108
|
+
|
|
109
|
+
### Docker
|
|
110
|
+
We recommend multistage docker builds.
|
|
111
|
+
|
|
112
|
+
#### Ubuntu
|
|
113
|
+
We recommend using the official Python image as base image.
|
|
114
|
+
|
|
115
|
+
````
|
|
116
|
+
FROM python:3.14-slim as pyBuilder
|
|
117
|
+
|
|
118
|
+
RUN apt-get update
|
|
119
|
+
RUN apt-get install -y git build-essential zlib1g-dev
|
|
120
|
+
|
|
121
|
+
RUN ln -s /usr/local/lib/libpython3.14.so /usr/lib/libpython3.14.so && \
|
|
122
|
+
mkdir -p /usr/lib/python3.14/config-3.14-x86_64-linux-gnu && \
|
|
123
|
+
ln -s /usr/local/lib/libpython3.14.so /usr/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14-pic.a
|
|
124
|
+
|
|
125
|
+
RUN python -m pip install uv
|
|
126
|
+
|
|
127
|
+
WORKDIR /builder
|
|
128
|
+
|
|
129
|
+
COPY . .
|
|
130
|
+
|
|
131
|
+
ENV PYTHONUNBUFFERED = 1
|
|
132
|
+
|
|
133
|
+
RUN uv run py2native build --embed ./embed main.py *.py
|
|
134
|
+
|
|
135
|
+
FROM python:3.14-slim AS runtime
|
|
136
|
+
|
|
137
|
+
RUN apt-get install openssl
|
|
138
|
+
|
|
139
|
+
WORKDIR /app
|
|
140
|
+
COPY --from=pyBuilder /builder/embed .
|
|
141
|
+
|
|
142
|
+
CMD ["./bin/main"]
|
|
143
|
+
````
|
|
144
|
+
|
|
145
|
+
#### Alpine
|
|
146
|
+
We recommend using the official Python image as base image.
|
|
147
|
+
|
|
148
|
+
````
|
|
149
|
+
FROM python:3.14-alpine as pyBuilder
|
|
150
|
+
WORKDIR /builder
|
|
151
|
+
|
|
152
|
+
RUN apk update && \
|
|
153
|
+
UN apk add uv build-base git zlib-dev
|
|
154
|
+
|
|
155
|
+
RUN ln -s /usr/local/lib/libpython3.14.so /usr/lib/libpython3.14.so && \
|
|
156
|
+
mkdir -p /usr/lib/python3.14/config-3.14-x86_64-linux-gnu && \
|
|
157
|
+
ln -s /usr/local/lib/libpython3.14.so /usr/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14-pic.a
|
|
158
|
+
|
|
159
|
+
ENV PYTHONUNBUFFERED = 1
|
|
160
|
+
RUN uv run py2native build --embed ./embed main.py *.py
|
|
161
|
+
|
|
162
|
+
FROM python:3.14-alpine
|
|
163
|
+
WORKDIR /app
|
|
164
|
+
COPY --from=pyBuilder /builder/embed .
|
|
165
|
+
CMD ["./bin/main"]
|
|
166
|
+
````
|
|
167
|
+
|
|
168
|
+
# Pro Edition
|
|
169
|
+
## Features
|
|
170
|
+
* JWT based license management: JWT decoder with elliptic curve signature verification
|
|
171
|
+
* String compression: Many strings are no longer easily accessible with a simple hex editolr
|
|
172
|
+
|
|
173
|
+
### License Management
|
|
174
|
+
py2native includes a specially protected license management:
|
|
175
|
+
* You create an elliptic curve keypair (P256)
|
|
176
|
+
````
|
|
177
|
+
uv run py2native keygen private.pem public.pem
|
|
178
|
+
````
|
|
179
|
+
* You build your executable with your public key.
|
|
180
|
+
````
|
|
181
|
+
uv run py2native build --embed ./embed --public-key public.pem main.py *.py
|
|
182
|
+
````
|
|
183
|
+
* You create license file (a text file with a JWT structure))
|
|
184
|
+
````
|
|
185
|
+
uv run py2native sign private.pem template.json license.dat
|
|
186
|
+
````
|
|
187
|
+
* You can verify the license in your software
|
|
188
|
+
````
|
|
189
|
+
from py2native_runtime import verify_license
|
|
190
|
+
|
|
191
|
+
license = verify_license("token", expected_issuer="xxxx", expected_autionece="My program")
|
|
192
|
+
````
|
|
193
|
+
* Your code can verify the license end adapt is operation accordingly
|
|
194
|
+
|
|
195
|
+
## Notes:
|
|
196
|
+
* Only the public key is stored in the executable
|
|
197
|
+
* The elliptic key verification is handled with compiled code in our software
|
|
198
|
+
(ie no 3rd party libraries)
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
The Pro Edition requires a special license. You receive a license file from us that you can either
|
|
202
|
+
* specify on the command line (--license)
|
|
203
|
+
* in the environment (PY2NATIVE_LICENSE)
|
|
204
|
+
* NB: You store the content of the license file in the environment, not the path
|
|
205
|
+
to the file. This is especially useful for Docker or for CI/CD pipelines (eg Github Actions).
|
|
206
|
+
* store in your home directory (~/.py2native/license.dat)
|
|
207
|
+
|
|
208
|
+
You need the license just for the build process.
|
|
209
|
+
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Py2Native
|
|
2
|
+
|
|
3
|
+
More information on [https://py2native.dev](https://py2native.dev)
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
````
|
|
7
|
+
uv add --dev Py2Native
|
|
8
|
+
````
|
|
9
|
+
Installs Py2Native in the current project
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
````
|
|
13
|
+
uv run py2native build [--embed <targetDir>] <mainModule> [<module>...]
|
|
14
|
+
````
|
|
15
|
+
Compiles and links the given modules.
|
|
16
|
+
|
|
17
|
+
### Environment on Windows
|
|
18
|
+
* P2N_MINGW32 path to unpacked [https://github.com/mstorsjo/llvm-mingw/releases/download/20260602/llvm-mingw-20260602-ucrt-i686.zip](https://github.com/mstorsjo/llvm-mingw/releases/download/20260602/llvm-mingw-20260602-ucrt-i686.zip)
|
|
19
|
+
|
|
20
|
+
## Restrictions
|
|
21
|
+
* No modules with identical names
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
* C-Python 3.10, 3.11, 3.12, 3.13, , 3.14, 3.14 freethreaded, 3.15, 3.15 freethreaded
|
|
25
|
+
* Python supported C Compiler / Linker for your platform
|
|
26
|
+
* * Visual Studio or llvm-mingw32 on Windows
|
|
27
|
+
* Windows 8, Windows 10, Windows 11, ManyLinux 2014 or ManiMusl compatible Linux, or MacOS
|
|
28
|
+
* X64 CPU or ARM64 CPU
|
|
29
|
+
* Internet Access for downloading the used libraries and Python Distributions
|
|
30
|
+
|
|
31
|
+
## What we do
|
|
32
|
+
* Compile your software with Cython to .c and than into the native executables
|
|
33
|
+
* Link the object files together into a single executable (that can be a main executablemor a shared library)
|
|
34
|
+
* Support importing from within that single executable
|
|
35
|
+
* Embed some of the libraries with your executable
|
|
36
|
+
* Provide an embedded installation
|
|
37
|
+
|
|
38
|
+
## Protection
|
|
39
|
+
You no longer distribute your source code. 100% of **your** code is compiled to c and then to native executable format so recovering it is pretty difficult.
|
|
40
|
+
Reverse engineering is, while still possible, not easy.
|
|
41
|
+
|
|
42
|
+
Monkey patching is still possible (because big parts of the used libraries are still available in Python source.
|
|
43
|
+
|
|
44
|
+
### Legal Considerations
|
|
45
|
+
* All libraries remain as they are. So copyright messages remain in distribution.
|
|
46
|
+
* LGPL restrictions are still met. The user can replace the library with a different version.
|
|
47
|
+
|
|
48
|
+
## Deployment Recipes
|
|
49
|
+
|
|
50
|
+
### Windows
|
|
51
|
+
You will usually need an installer to distribute the created embed directory. This directory holds all the used libraries and might contain thousands of files.
|
|
52
|
+
It is recommended to use a tool like NSIS or Inno Setup to create an installer.
|
|
53
|
+
|
|
54
|
+
#### InnoSetup
|
|
55
|
+
````
|
|
56
|
+
[Setup]
|
|
57
|
+
AppId="Test Application"
|
|
58
|
+
AppName="Test Application"
|
|
59
|
+
AppVerName=Test Application
|
|
60
|
+
AppPublisher=RSJ Software GmbH
|
|
61
|
+
AppPublisherURL=https://www.rsj.de
|
|
62
|
+
AppSupportURL=https://www.rsj.de
|
|
63
|
+
AppUpdatesURL=https://www.rsj.de
|
|
64
|
+
DefaultDirName={commonpf}\TestApplication
|
|
65
|
+
DefaultGroupName=Test Application
|
|
66
|
+
OutputBaseFilename={#outputName}
|
|
67
|
+
Compression=lzma
|
|
68
|
+
SolidCompression=yes
|
|
69
|
+
InternalCompressLevel=ultra
|
|
70
|
+
VersionInfoCompany=RSJ Software GmbH
|
|
71
|
+
VersionInfoCopyright=Copyright (C) 2026 by RSJ Software GmbH Germering. All rights reserved.
|
|
72
|
+
VersionInfoDescription=Test Application
|
|
73
|
+
VersionInfoProductName="Test Application"
|
|
74
|
+
VersionInfoVersion={#version}
|
|
75
|
+
VersionInfoProductVersion={#version}
|
|
76
|
+
VersionInfoTextVersion={#version}
|
|
77
|
+
VersionInfoProductTextVersion={#version}
|
|
78
|
+
ShowLanguageDialog=no
|
|
79
|
+
WizardImageStretch=no
|
|
80
|
+
MinVersion=10.0.10240
|
|
81
|
+
ArchitecturesInstallIn64BitMode=x64
|
|
82
|
+
|
|
83
|
+
[Files]
|
|
84
|
+
Source: ..\embed\*; DestDir: {app}; Excludes: config.json; Flags: ignoreversion overwritereadonly uninsrestartdelete recursesubdirs setntfscompression;
|
|
85
|
+
|
|
86
|
+
[Dirs]
|
|
87
|
+
Name: {app}/data; Permissions: everyone-full;
|
|
88
|
+
|
|
89
|
+
[Run]
|
|
90
|
+
Filename: "{app}\testApplication.exe"; Flags: postinstall
|
|
91
|
+
|
|
92
|
+
[Icons]
|
|
93
|
+
Name: "{group}\TestApplication"; Filename: "{app}\testApplication.exe"
|
|
94
|
+
````
|
|
95
|
+
### Linux
|
|
96
|
+
You could either do:
|
|
97
|
+
* distribute a .zip file with the embed directory
|
|
98
|
+
* distribute a .tar.gz file with the embed directory
|
|
99
|
+
* create a docker image
|
|
100
|
+
|
|
101
|
+
### Docker
|
|
102
|
+
We recommend multistage docker builds.
|
|
103
|
+
|
|
104
|
+
#### Ubuntu
|
|
105
|
+
We recommend using the official Python image as base image.
|
|
106
|
+
|
|
107
|
+
````
|
|
108
|
+
FROM python:3.14-slim as pyBuilder
|
|
109
|
+
|
|
110
|
+
RUN apt-get update
|
|
111
|
+
RUN apt-get install -y git build-essential zlib1g-dev
|
|
112
|
+
|
|
113
|
+
RUN ln -s /usr/local/lib/libpython3.14.so /usr/lib/libpython3.14.so && \
|
|
114
|
+
mkdir -p /usr/lib/python3.14/config-3.14-x86_64-linux-gnu && \
|
|
115
|
+
ln -s /usr/local/lib/libpython3.14.so /usr/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14-pic.a
|
|
116
|
+
|
|
117
|
+
RUN python -m pip install uv
|
|
118
|
+
|
|
119
|
+
WORKDIR /builder
|
|
120
|
+
|
|
121
|
+
COPY . .
|
|
122
|
+
|
|
123
|
+
ENV PYTHONUNBUFFERED = 1
|
|
124
|
+
|
|
125
|
+
RUN uv run py2native build --embed ./embed main.py *.py
|
|
126
|
+
|
|
127
|
+
FROM python:3.14-slim AS runtime
|
|
128
|
+
|
|
129
|
+
RUN apt-get install openssl
|
|
130
|
+
|
|
131
|
+
WORKDIR /app
|
|
132
|
+
COPY --from=pyBuilder /builder/embed .
|
|
133
|
+
|
|
134
|
+
CMD ["./bin/main"]
|
|
135
|
+
````
|
|
136
|
+
|
|
137
|
+
#### Alpine
|
|
138
|
+
We recommend using the official Python image as base image.
|
|
139
|
+
|
|
140
|
+
````
|
|
141
|
+
FROM python:3.14-alpine as pyBuilder
|
|
142
|
+
WORKDIR /builder
|
|
143
|
+
|
|
144
|
+
RUN apk update && \
|
|
145
|
+
UN apk add uv build-base git zlib-dev
|
|
146
|
+
|
|
147
|
+
RUN ln -s /usr/local/lib/libpython3.14.so /usr/lib/libpython3.14.so && \
|
|
148
|
+
mkdir -p /usr/lib/python3.14/config-3.14-x86_64-linux-gnu && \
|
|
149
|
+
ln -s /usr/local/lib/libpython3.14.so /usr/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14-pic.a
|
|
150
|
+
|
|
151
|
+
ENV PYTHONUNBUFFERED = 1
|
|
152
|
+
RUN uv run py2native build --embed ./embed main.py *.py
|
|
153
|
+
|
|
154
|
+
FROM python:3.14-alpine
|
|
155
|
+
WORKDIR /app
|
|
156
|
+
COPY --from=pyBuilder /builder/embed .
|
|
157
|
+
CMD ["./bin/main"]
|
|
158
|
+
````
|
|
159
|
+
|
|
160
|
+
# Pro Edition
|
|
161
|
+
## Features
|
|
162
|
+
* JWT based license management: JWT decoder with elliptic curve signature verification
|
|
163
|
+
* String compression: Many strings are no longer easily accessible with a simple hex editolr
|
|
164
|
+
|
|
165
|
+
### License Management
|
|
166
|
+
py2native includes a specially protected license management:
|
|
167
|
+
* You create an elliptic curve keypair (P256)
|
|
168
|
+
````
|
|
169
|
+
uv run py2native keygen private.pem public.pem
|
|
170
|
+
````
|
|
171
|
+
* You build your executable with your public key.
|
|
172
|
+
````
|
|
173
|
+
uv run py2native build --embed ./embed --public-key public.pem main.py *.py
|
|
174
|
+
````
|
|
175
|
+
* You create license file (a text file with a JWT structure))
|
|
176
|
+
````
|
|
177
|
+
uv run py2native sign private.pem template.json license.dat
|
|
178
|
+
````
|
|
179
|
+
* You can verify the license in your software
|
|
180
|
+
````
|
|
181
|
+
from py2native_runtime import verify_license
|
|
182
|
+
|
|
183
|
+
license = verify_license("token", expected_issuer="xxxx", expected_autionece="My program")
|
|
184
|
+
````
|
|
185
|
+
* Your code can verify the license end adapt is operation accordingly
|
|
186
|
+
|
|
187
|
+
## Notes:
|
|
188
|
+
* Only the public key is stored in the executable
|
|
189
|
+
* The elliptic key verification is handled with compiled code in our software
|
|
190
|
+
(ie no 3rd party libraries)
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
The Pro Edition requires a special license. You receive a license file from us that you can either
|
|
194
|
+
* specify on the command line (--license)
|
|
195
|
+
* in the environment (PY2NATIVE_LICENSE)
|
|
196
|
+
* NB: You store the content of the license file in the environment, not the path
|
|
197
|
+
to the file. This is especially useful for Docker or for CI/CD pipelines (eg Github Actions).
|
|
198
|
+
* store in your home directory (~/.py2native/license.dat)
|
|
199
|
+
|
|
200
|
+
You need the license just for the build process.
|
|
201
|
+
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "py2native"
|
|
3
|
-
version = "0.1.
|
|
4
|
-
description = "Python to native compiler.
|
|
3
|
+
version = "0.1.3"
|
|
4
|
+
description = "Python to native compiler. "
|
|
5
5
|
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
7
|
authors = [
|
|
8
8
|
{name="RSJ Software GmbH", email="ruediger.jungbeck@rsj.de"}
|
|
9
9
|
]
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py2native
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Python to native compiler.
|
|
5
|
+
Author-email: RSJ Software GmbH <ruediger.jungbeck@rsj.de>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# Py2Native
|
|
10
|
+
|
|
11
|
+
More information on [https://py2native.dev](https://py2native.dev)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
````
|
|
15
|
+
uv add --dev Py2Native
|
|
16
|
+
````
|
|
17
|
+
Installs Py2Native in the current project
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
````
|
|
21
|
+
uv run py2native build [--embed <targetDir>] <mainModule> [<module>...]
|
|
22
|
+
````
|
|
23
|
+
Compiles and links the given modules.
|
|
24
|
+
|
|
25
|
+
### Environment on Windows
|
|
26
|
+
* P2N_MINGW32 path to unpacked [https://github.com/mstorsjo/llvm-mingw/releases/download/20260602/llvm-mingw-20260602-ucrt-i686.zip](https://github.com/mstorsjo/llvm-mingw/releases/download/20260602/llvm-mingw-20260602-ucrt-i686.zip)
|
|
27
|
+
|
|
28
|
+
## Restrictions
|
|
29
|
+
* No modules with identical names
|
|
30
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
* C-Python 3.10, 3.11, 3.12, 3.13, , 3.14, 3.14 freethreaded, 3.15, 3.15 freethreaded
|
|
33
|
+
* Python supported C Compiler / Linker for your platform
|
|
34
|
+
* * Visual Studio or llvm-mingw32 on Windows
|
|
35
|
+
* Windows 8, Windows 10, Windows 11, ManyLinux 2014 or ManiMusl compatible Linux, or MacOS
|
|
36
|
+
* X64 CPU or ARM64 CPU
|
|
37
|
+
* Internet Access for downloading the used libraries and Python Distributions
|
|
38
|
+
|
|
39
|
+
## What we do
|
|
40
|
+
* Compile your software with Cython to .c and than into the native executables
|
|
41
|
+
* Link the object files together into a single executable (that can be a main executablemor a shared library)
|
|
42
|
+
* Support importing from within that single executable
|
|
43
|
+
* Embed some of the libraries with your executable
|
|
44
|
+
* Provide an embedded installation
|
|
45
|
+
|
|
46
|
+
## Protection
|
|
47
|
+
You no longer distribute your source code. 100% of **your** code is compiled to c and then to native executable format so recovering it is pretty difficult.
|
|
48
|
+
Reverse engineering is, while still possible, not easy.
|
|
49
|
+
|
|
50
|
+
Monkey patching is still possible (because big parts of the used libraries are still available in Python source.
|
|
51
|
+
|
|
52
|
+
### Legal Considerations
|
|
53
|
+
* All libraries remain as they are. So copyright messages remain in distribution.
|
|
54
|
+
* LGPL restrictions are still met. The user can replace the library with a different version.
|
|
55
|
+
|
|
56
|
+
## Deployment Recipes
|
|
57
|
+
|
|
58
|
+
### Windows
|
|
59
|
+
You will usually need an installer to distribute the created embed directory. This directory holds all the used libraries and might contain thousands of files.
|
|
60
|
+
It is recommended to use a tool like NSIS or Inno Setup to create an installer.
|
|
61
|
+
|
|
62
|
+
#### InnoSetup
|
|
63
|
+
````
|
|
64
|
+
[Setup]
|
|
65
|
+
AppId="Test Application"
|
|
66
|
+
AppName="Test Application"
|
|
67
|
+
AppVerName=Test Application
|
|
68
|
+
AppPublisher=RSJ Software GmbH
|
|
69
|
+
AppPublisherURL=https://www.rsj.de
|
|
70
|
+
AppSupportURL=https://www.rsj.de
|
|
71
|
+
AppUpdatesURL=https://www.rsj.de
|
|
72
|
+
DefaultDirName={commonpf}\TestApplication
|
|
73
|
+
DefaultGroupName=Test Application
|
|
74
|
+
OutputBaseFilename={#outputName}
|
|
75
|
+
Compression=lzma
|
|
76
|
+
SolidCompression=yes
|
|
77
|
+
InternalCompressLevel=ultra
|
|
78
|
+
VersionInfoCompany=RSJ Software GmbH
|
|
79
|
+
VersionInfoCopyright=Copyright (C) 2026 by RSJ Software GmbH Germering. All rights reserved.
|
|
80
|
+
VersionInfoDescription=Test Application
|
|
81
|
+
VersionInfoProductName="Test Application"
|
|
82
|
+
VersionInfoVersion={#version}
|
|
83
|
+
VersionInfoProductVersion={#version}
|
|
84
|
+
VersionInfoTextVersion={#version}
|
|
85
|
+
VersionInfoProductTextVersion={#version}
|
|
86
|
+
ShowLanguageDialog=no
|
|
87
|
+
WizardImageStretch=no
|
|
88
|
+
MinVersion=10.0.10240
|
|
89
|
+
ArchitecturesInstallIn64BitMode=x64
|
|
90
|
+
|
|
91
|
+
[Files]
|
|
92
|
+
Source: ..\embed\*; DestDir: {app}; Excludes: config.json; Flags: ignoreversion overwritereadonly uninsrestartdelete recursesubdirs setntfscompression;
|
|
93
|
+
|
|
94
|
+
[Dirs]
|
|
95
|
+
Name: {app}/data; Permissions: everyone-full;
|
|
96
|
+
|
|
97
|
+
[Run]
|
|
98
|
+
Filename: "{app}\testApplication.exe"; Flags: postinstall
|
|
99
|
+
|
|
100
|
+
[Icons]
|
|
101
|
+
Name: "{group}\TestApplication"; Filename: "{app}\testApplication.exe"
|
|
102
|
+
````
|
|
103
|
+
### Linux
|
|
104
|
+
You could either do:
|
|
105
|
+
* distribute a .zip file with the embed directory
|
|
106
|
+
* distribute a .tar.gz file with the embed directory
|
|
107
|
+
* create a docker image
|
|
108
|
+
|
|
109
|
+
### Docker
|
|
110
|
+
We recommend multistage docker builds.
|
|
111
|
+
|
|
112
|
+
#### Ubuntu
|
|
113
|
+
We recommend using the official Python image as base image.
|
|
114
|
+
|
|
115
|
+
````
|
|
116
|
+
FROM python:3.14-slim as pyBuilder
|
|
117
|
+
|
|
118
|
+
RUN apt-get update
|
|
119
|
+
RUN apt-get install -y git build-essential zlib1g-dev
|
|
120
|
+
|
|
121
|
+
RUN ln -s /usr/local/lib/libpython3.14.so /usr/lib/libpython3.14.so && \
|
|
122
|
+
mkdir -p /usr/lib/python3.14/config-3.14-x86_64-linux-gnu && \
|
|
123
|
+
ln -s /usr/local/lib/libpython3.14.so /usr/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14-pic.a
|
|
124
|
+
|
|
125
|
+
RUN python -m pip install uv
|
|
126
|
+
|
|
127
|
+
WORKDIR /builder
|
|
128
|
+
|
|
129
|
+
COPY . .
|
|
130
|
+
|
|
131
|
+
ENV PYTHONUNBUFFERED = 1
|
|
132
|
+
|
|
133
|
+
RUN uv run py2native build --embed ./embed main.py *.py
|
|
134
|
+
|
|
135
|
+
FROM python:3.14-slim AS runtime
|
|
136
|
+
|
|
137
|
+
RUN apt-get install openssl
|
|
138
|
+
|
|
139
|
+
WORKDIR /app
|
|
140
|
+
COPY --from=pyBuilder /builder/embed .
|
|
141
|
+
|
|
142
|
+
CMD ["./bin/main"]
|
|
143
|
+
````
|
|
144
|
+
|
|
145
|
+
#### Alpine
|
|
146
|
+
We recommend using the official Python image as base image.
|
|
147
|
+
|
|
148
|
+
````
|
|
149
|
+
FROM python:3.14-alpine as pyBuilder
|
|
150
|
+
WORKDIR /builder
|
|
151
|
+
|
|
152
|
+
RUN apk update && \
|
|
153
|
+
UN apk add uv build-base git zlib-dev
|
|
154
|
+
|
|
155
|
+
RUN ln -s /usr/local/lib/libpython3.14.so /usr/lib/libpython3.14.so && \
|
|
156
|
+
mkdir -p /usr/lib/python3.14/config-3.14-x86_64-linux-gnu && \
|
|
157
|
+
ln -s /usr/local/lib/libpython3.14.so /usr/lib/python3.14/config-3.14-x86_64-linux-gnu/libpython3.14-pic.a
|
|
158
|
+
|
|
159
|
+
ENV PYTHONUNBUFFERED = 1
|
|
160
|
+
RUN uv run py2native build --embed ./embed main.py *.py
|
|
161
|
+
|
|
162
|
+
FROM python:3.14-alpine
|
|
163
|
+
WORKDIR /app
|
|
164
|
+
COPY --from=pyBuilder /builder/embed .
|
|
165
|
+
CMD ["./bin/main"]
|
|
166
|
+
````
|
|
167
|
+
|
|
168
|
+
# Pro Edition
|
|
169
|
+
## Features
|
|
170
|
+
* JWT based license management: JWT decoder with elliptic curve signature verification
|
|
171
|
+
* String compression: Many strings are no longer easily accessible with a simple hex editolr
|
|
172
|
+
|
|
173
|
+
### License Management
|
|
174
|
+
py2native includes a specially protected license management:
|
|
175
|
+
* You create an elliptic curve keypair (P256)
|
|
176
|
+
````
|
|
177
|
+
uv run py2native keygen private.pem public.pem
|
|
178
|
+
````
|
|
179
|
+
* You build your executable with your public key.
|
|
180
|
+
````
|
|
181
|
+
uv run py2native build --embed ./embed --public-key public.pem main.py *.py
|
|
182
|
+
````
|
|
183
|
+
* You create license file (a text file with a JWT structure))
|
|
184
|
+
````
|
|
185
|
+
uv run py2native sign private.pem template.json license.dat
|
|
186
|
+
````
|
|
187
|
+
* You can verify the license in your software
|
|
188
|
+
````
|
|
189
|
+
from py2native_runtime import verify_license
|
|
190
|
+
|
|
191
|
+
license = verify_license("token", expected_issuer="xxxx", expected_autionece="My program")
|
|
192
|
+
````
|
|
193
|
+
* Your code can verify the license end adapt is operation accordingly
|
|
194
|
+
|
|
195
|
+
## Notes:
|
|
196
|
+
* Only the public key is stored in the executable
|
|
197
|
+
* The elliptic key verification is handled with compiled code in our software
|
|
198
|
+
(ie no 3rd party libraries)
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
The Pro Edition requires a special license. You receive a license file from us that you can either
|
|
202
|
+
* specify on the command line (--license)
|
|
203
|
+
* in the environment (PY2NATIVE_LICENSE)
|
|
204
|
+
* NB: You store the content of the license file in the environment, not the path
|
|
205
|
+
to the file. This is especially useful for Docker or for CI/CD pipelines (eg Github Actions).
|
|
206
|
+
* store in your home directory (~/.py2native/license.dat)
|
|
207
|
+
|
|
208
|
+
You need the license just for the build process.
|
|
209
|
+
|
py2native-0.1.1/PKG-INFO
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: py2native
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: Python to native compiler. Comming soon.
|
|
5
|
-
Author-email: RSJ Software GmbH <ruediger.jungbeck@rsj.de>
|
|
6
|
-
Requires-Python: >=3.14
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
|
|
9
|
-
# Python to Native
|
|
10
|
-
|
|
11
|
-
Upcoming Python Compiler to Native compiler.
|
|
12
|
-
|
|
13
|
-
More information on [https://www.py2native.dev](https://www.py2native.dev)
|
py2native-0.1.1/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: py2native
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: Python to native compiler. Comming soon.
|
|
5
|
-
Author-email: RSJ Software GmbH <ruediger.jungbeck@rsj.de>
|
|
6
|
-
Requires-Python: >=3.14
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
|
|
9
|
-
# Python to Native
|
|
10
|
-
|
|
11
|
-
Upcoming Python Compiler to Native compiler.
|
|
12
|
-
|
|
13
|
-
More information on [https://www.py2native.dev](https://www.py2native.dev)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|