GithubHelp home page GithubHelp logo

felixwolf / pylop Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 12 KB

Ever want to generate a single file python executable? What do you mean PyInstaller and cx_freeze exi--. Want to do it again?

Home Page: https://github.com/FelixWolf/pylop

License: The Unlicense

CMake 42.82% Python 33.02% C++ 24.16%
python executable-generator i-have-no-idea-what-im-doing reinventing-the-wheel

pylop's Introduction

Pylop

Single file python script executable maker thingermcbob.

Python version: 3.8

About

This is designed to do the following:

  1. Take your python script(s) as a module
  2. Put it in a "zip"
  3. Append it to a executable
  4. Now you have a single executable file that you can send to people without having them install python

Method

  1. Built "Pylop" template executable will search the end of it's binary for a 4 byte magic number.
  2. If magic number is found, seek back 4 bytes, this is the absolute position where the "zip" containing the files to load.
  3. Seek to said position and read 4 bytes, this is the length of the zip.
  4. Add a hook to the importlib to manage loading from this embedded zip.

Planned features

  • meta.info embedded in zip, allow for changing of various executable parameters(Hide or show console window, etc)

Requirements

Visual Studio 2013 (or newer) or Linux with GCC. MinGW is sadly not supported, and clang has not been tested.

Download

Don't forget to initialise and update the submodules! The cpython is +200MB so it may take some time to during git submodule update.

git clone https://github.com/FelixWolf/pylop
cd pylop
git submodule init
git submodule update --progress

Build using Visual Studio on Windows

Please note: that you have to explicitly specify CMAKE_BUILD_TYPE. If you specify Debug, then you must use Debug in your Visual Studio. You won't be able to change to Release using the dropdown list in the main menu. Python will be build using the CMAKE_BUILD_TYPE flag regarding the chosen configuration in Visual Studio. To change from Debug to Release, re-run the cmake and set the CMAKE_BUILD_TYPE to Release.

cd python-embedded-example-project 
mkdir build
cd build
cmake .. -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Debug

Then open the generated solution file "Pylop.sln" in the build folder. You should see the following projects:

  • ALL_BUILD - Building this will build all projects
  • CPYTHON - The embedded python project
  • PYBIND - The pybind11 library for binding
  • PythonEmbeddedExample - This is the example project

Build the Pylop and then use generateApp.py --binary=pylop --library=lib.zip --source=whatever from command line.

Build using GCC on Linux

cd pylop
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug

Then build the example by running:

make

The Pylop executable will be generated.

Changing python version

This project is using the latest stable version of python avaliable. At the time of writing, this is version 3.8. If you want to change python version, change the branch in .gitmodules to branch = 3.7 or any other version. See available branches at: https://github.com/python/cpython

Credits

(These are credits, this does not mean they endorse this project)

  • Matusnovak for the Python embedded example project which really helped me get a head start on embedding python when I had no idea what I was doing(I still don't know really what I am doing!).
  • Everyone at Python Software Foundation for their amazing work on the Python programming language.
  • God, Satan, Talos, or whatever deity or atoms that collided to create the universe.
  • Mankind for creating frustrations in coding.

pylop's People

Contributors

felixwolf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.