Nuitka | Python compiler written in Python. It's fully compatible | Compiler library
kandi X-RAY | Nuitka Summary
kandi X-RAY | Nuitka Summary
Nuitka is a Python compiler written in Python. It's fully compatible with Python 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11. You feed it your Python app, it does a lot of clever things, and spits out an executable or extension module.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Get import by full name .
- Builds a class node .
- Create a parser for the SCons option .
- Return a list of module names .
- Parse the arguments .
- Builds a class node .
- Matches a match call .
- Parse the command - line options .
- Compute a statement sequence .
- Builds assignment statements from a decoded value .
Nuitka Key Features
Nuitka Examples and Code Snippets
my_object = obj_reader.import_obj('../example_obj/utah_teapot.obj', ('x', 90))
# main.py
import PySimpleGUI as sg
import planar_projection
# Create Scene
cube = planar_projection.Object_3D(
verts = planar_projection.default_cube_verts,
ed
import PySimpleGUI as sg
def draw_points(points, connections, canvas: sg.Graph):
for p in points:
canvas.draw_circle(p, 2, 'black')
for c in connections:
canvas.draw_line(c[0], c[1], 'red')
def find_closest_point(xy, poin
nuitka --recurse-on socker.py
mv socker.exe socker
sudo chown 0:0 socker
sudo chmod +s socker
sudo vim socker-images
socker --help
NAME
socker - Secure runner for Docker containers
SYNOPSIS
socker run
OPTIONS
--version
show the version
from threading import Thread
def worker(a,b):
while True:
print(a+b)
a+=1
my_thread = Thread(target = worker, args = [10,20])
my_thread.start()
# Create a binary that unpacks into a temporary folder
python -m nuitka --onefile program.py
import base64
s = "your json file as string here".encode("utf-8")
encoded = base64.b64encode(s)
decoded = base64.b64decode(encoded)
python.exe -m nuitka --standalone --mingw64 your_main.py
# This alows for packages to be accessed from the **globally** installed Python (NOT the tox env).
sitepackages = True
# This alows for commands to be used available outside tox. Typically used for non-python callables.
whitelist_externa
python -m nuitka --module jsonpickle --include-package=jsonpickle
Community Discussions
Trending Discussions on Nuitka
QUESTION
When trying to compile a file, using the command conda -m nuitka -onefilestrict test.py
I get an error CommandNotFoundError: No command 'conda nuitka'.
Used conda config --add channels conda-forge
and conda config --set channel_priority strict
before installation (conda install nuitka
)
When I enter conda search nuitka
- I get a lot of packages starting from the 0.5.x to 0.7.7 version.
But when I use - conda list nuitka
. I get nothing
ANSWER
Answered 2022-Apr-07 at 15:08You seem to have never actually isntalled the package
QUESTION
So I have made this python file which I want to compile (it's called ElPatron) to a .exe file with Nuitka. I did it correctly and this is the dist folder that came with that (using the --standalone argument that Nuitka has)
This is the nuitka command I used:
...ANSWER
Answered 2021-Dec-16 at 22:18From looking at the Nuitka documentation, it says:
QUESTION
Turning a .py script into an .exe on Windows seems to always result in false-positive virus detection hits.
There are LOTS of discussion threads about this on stackoverflow and elsewhere. A real good summary is here.
pyinstaller from pip, pyinstaller with local-compiled bootloader, py2exe, and nuitka are the various .exe-builders I've tried so far. Various build tools result in various hit counts on virustotal.com but it seems there will always be some hits no matter what you do - this is the world we live in.
I understand that signing is an option, though the tool being distributed is free and open-source, so the signing option probably won't be pursued.
Chasing down the antivirus vendors to report false positives each time the script is edited and the .exe is rebuilt doesn't seem like a good use of time.
The question here: is it best to give up on the idea of distributing an .exe? Is a full python installation on the end user's machine, and then just distributing the .py file, the best way to go? That option seems pretty heavy-weight and overbearing and prone to more installation issues. But, if it's the only way to avoid the antivirus dance...? Or is there another middle option?
...ANSWER
Answered 2021-Nov-10 at 04:01This may be the best option: use the embeddable package as downloaded from python.org. The official docs spell it out in the second half of section 4.4.1 of 'Using Python on Windows'.
In their downloads pages, after selecting a version, you can get to a page like this (for python 3.10):
Download the 'Windows embeddable package' for 32 or 64 as needed. Let's say you extract the downloaded zip to $MYDIR. Then to run your python script, e.g. from a Windows batch file, you could just have a line like
call $MYDIR\python.exe myscript.py
Zero threats detected on virustotal.com for $MYDIR\python.exe, since it's known and signed and trusted and unmodified. Just to be sure, I did a Windows scan of the entire directory that contains the batch file, myscript.py, and $MYDIR - no threats detected.
This flow appears to work for this application so far. Will wait to accept this answer until it's been working for a few days.
The downloaded 32bit embeddable package is 7.1MB and unzips to 15.6MB - not huge, not tiny, but sufficiently small for this particular app.
Does anyone have experience with this embeddable package solution, and might know of any caveats or pitfalls?
QUESTION
I want to convert my python project to an Exe file using Nuitka/Pyinstaller, but unfortunately, all of the strings I wrote in the python file, can be found easily inside of the Exe file just by opening the Exe file with notepad.
How can I convert my project to Exe and fully hide the strings and passwords saved inside the py file?
...ANSWER
Answered 2021-Oct-30 at 22:52As the comments have mentioned if you want the user to know something only when you want to tell them, not by inspecting the binary, you should try to obfuscate it.
One way of achieving it is, as also suggested in the comments, by encryption. You can convert your .json file to a string and then encrypt it with a given password, which the binary will be aware of, of course.
You can also, which is probably more simple, just encode the string, for example in base 64 and then when calling it you would decode it back again. A small example is as follows:
QUESTION
here is the part of the files that are important for this question:
...ANSWER
Answered 2020-Jul-21 at 20:31My compliments on such an extensive report. Your issue lies probably in this weird setup you've got going on.
QUESTION
I'm using jsonpickle in my program, but found it to be a performance bottleneck. So I'm trying to see if I can compile it to C using Nuitka, then use the C version in my program (through some wrappers perhaps).
But to be honest, I'm new to Nuitka, so I don't even know if this is a legit use case. Can someone give me some hints?
Note: this question is not about how to make a program faster. I'm building a library, not an application, so certain approaches like Pypy won't work. I'm also aware of Cython and is investigating it too, but this question is not about Cython either.
...ANSWER
Answered 2020-Nov-17 at 05:45Figured it out myself. Just git clone the repo, go into the directory, and run
QUESTION
I use this command to build my program,it generate an exe file that work well.but it always starts with cmd console program when tk program is running.How to avoid that happen?
...ANSWER
Answered 2020-Oct-16 at 13:59Delete the linesys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8')
,and all program will be run correctly.This line of code only help show utf-8 character in emulator.
QUESTION
I'm trying to compile my Python project to a Windows executable (.exe) using Nuitka. I get no errors/warnings during the compilation process, but when I'm trying to run the resulting executable I get the "C:\Python34\test.exe is not a valid win32 application"
error on Windows XP and a similar one on Windows 10, too). The problem persists even when I compile a "Hello, World!" program. Interesting, that I can easily build and run C++ projects from the Visual Studio IDE on the same PC.
I'm using Windows XP (x32 bits), Python 3.4.0 and Microsoft Visual C++ 2008 Professional.
How can I solve this problem?
...ANSWER
Answered 2020-Apr-25 at 11:30I have installed Microsoft Visual Studio 2010 Express instead of Microsoft Visual Studio 2008 Professional, and the problem disappeared. It looks like Nuitka just can't work with the previous version of the compiler. They even say in the docs, that Nuitka is designed for Visual Studio 2017+ (but I can't install recent versions on Windows XP), and that other versions may not work correctly.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Nuitka
You can use Nuitka like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page