setuptools
和 wheels
使用 nuitka你也可以使用 lib-not-dr 来帮助你使用 Nuitka
If you have a setup.py
, setup.cfg
or pyproject.toml
driven creation of wheels for your software in place, putting Nuitka to use is extremely easy.
如果你有一个 setup.py
, setup.cfg
或 pyproject.toml
驱动的软件创建的 wheels
, 使用 Nuitka 非常简单的。
Lets start with the most common setuptools
approach, you can - having Nuitka installed of course, simply execute the target bdist_nuitka
rather than the bdist_wheel
. It takes all the options and allows you to specify some more, that are specific to Nuitka.
让我们用最常见的 setuptools
的方式来说,你可以 - Nuitka 已经安装,只需执行 bdist_nuitka
目标,而不是 bdist_wheel
,。它接受所有的选项,并允许你为 Nuitka 添加更多的选项。
If for some reason, you cannot or do not want to change the target, you can add this to your setup.py
.
To temporarily disable the compilation, you could remove above line, or edit the value to False
by or take its value from an environment variable if you so choose, e.g. bool(os.environ.get("USE_NUITKA",<span> "True"))
. This is up to you.
Or you could put it in your setup.cfg
And last, but not least, Nuitka also supports the new build
meta, so when you have a pyproject.toml
already, simple replace or add this value:
For the nuitka
requirement above absolute paths like C:\Users\...\Nuitka
will also work on Linux, use an absolute path with two leading slashes, e.g. //home/.../Nuitka
.
Whatever approach you take, data files in these wheels are not handled by Nuitka at all, but by setuptools. You can however use the data file embedding of Nuitka commercial. In that case you actually would embed the files inside the extension module itself, and not as a file in the wheel.