Code Monkey home page Code Monkey logo

py2bin's Introduction

Image description

py2bin

py2bin is a hassle-free, command-line-tool that allows you to easily convert a Python file into a binary file with a single line of code.

py2bin is a streamlined version of and built from: PyInstaller.

py2bin vs PyInstaller?

  • minimal command-line-interface
  • easier resource integration
  • cleaner output and file handling
  • constrained functionality

Compatibility

  • Mac OSX
  • Python >= 3.6

Dependencies

Installation and Usage

Installation Usage
Homebrew $ brew install dante-biase/x2x/py2bin $ py2bin PY_FILE [OPTIONS]
Manual $ git clone https://github.com/dante-biase/py2bin.git
$ cd py2bin
$ pip3 install -r requirements.txt
$ chmod +x py2bin.py
$ ./py2bin.py PY_FILE [OPTIONS]

PY_FILE

specifies the py file to be converted into a binary, required

[OPTIONS]

  -r, --resources_directory     TEXT    directory that contains binary resources
  -d, --destination_directory   TEXT    directory to create the binary in
  -o, --optimize                TEXT    compile with optimizations
  --help                                print this message and exit

Notes

Resources

  1. If your binary requires any resources, you must consolidate these files into a single directory - resources_directory

  2. Install py2x

    $ pip3 install py2x
    
  3. Add this import statement to any script that references resources you might need:

    from py2x import Resources
    
  4. Update references:

    EXAMPLE: suppose you need to read a text file located within your resources_directory:

    change:

    text_file = open("path/to/resources/file.txt", "r")
    

    to:

    text_file = open(Resources.get("file.txt"), "r")`
    
  5. Execute py2bin while making sure to pass the path to your resources_directory to the -r flag:

    py2bin main.py -r path/to/resources [OTHER OPTIONS]
    

Output

  1. The output binary will be named with the stem of PY_FILE
  2. If destination_directory is not specified, the binary will be placed in the same directory as PY_FILE

py2bin's People

Contributors

dante-biase avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

betoben2kx4

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.