Code Monkey home page Code Monkey logo

pybreeder's Introduction

Breeder

This is a quick-and-dirty tool for combining multiple .py (or other text) files into a single script, making it easier to distribute/deploy Python scripts along with their dependencies.

Usage example:

breeder.py module1.py directory/ ... main.py >big-snake.py

All Python files (and directories) will be treated as modules, except the last one which will be treated as the 'main' body of the combined script. It is up to the caller to figure out which order to import files in, if there is are dependencies between modules.

To compress modules and embedded data, add the --compress flag.

To include a custom header at the top of the file, use --header FILENAME.

Breeder output scripts have been verified to be compatible as far back as Python 2.2.2 and should work with any Python 2.x release.

Note: If you know you are targetting Python 2.6 or newer, you should probably use Python's native .zip support instead of this hack!

Copyright

Breeder is (C) Copyright 2011, Bjarni R. Einarsson http://bre.klaki.net/.

TODO: GPLv3

pybreeder's People

Contributors

bjarnirunar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pybreeder's Issues

First line of of imported file throws "SyntaxError: invalid syntax"

I succesfully used the tool to merge some files together and run them. But when I use the flagg --compress (everything else remains the same) I get an error:

Traceback (most recent call last):
File "/tmp/jenkins5202313594849971078.sh", line 75, in
exec __FILES[".SELF/automation/core/time_utils.py"] in m.dict
File "", line 3
import datetime
^
SyntaxError: invalid syntax

I dont know what this could be. I tried modifying the import statement and even make the import locally in the functions but the error remains with whatever the first line is.

Traceback (most recent call last):
File "/tmp/jenkins2249252542286121082.sh", line 74, in
exec __FILES[".SELF/automation/core/time_utils.py"] in m.dict
File "", line 1
def string_now():
^
SyntaxError: invalid syntax

If I remove the flag --compress then it all works just fine.

Info: I´m using Python 2.6.6 and Linux

thanks in advance

Python3

This works great in python2 but fails in python3
exec __FILES SyntaxError: Missing parentheses in call to 'exec'.
Would be great if it is compatible

Test not working with python 3.8.2

Hi, Getting below error

$ python breeder.py test/testing/ test/__main__.py >big-snake.py
Traceback (most recent call last):
  File "breeder.py", line 258, in <module>
    print(breed(fn, (fn == args[-1]), gtk_images=gtk_images, compress=compress))
  File "breeder.py", line 210, in breed
    return breed_dir(fn, main,
  File "breeder.py", line 198, in breed_dir
    bred = breed(fn, ismain,
  File "breeder.py", line 217, in breed
    return breed_python(fn, main, gtk_images=gtk_images, compress=compress)
  File "breeder.py", line 108, in breed_python
    pre, lines, post = format_snake(fn, raw=main, compress=compress)
  File "breeder.py", line 99, in format_snake
    lines = [l.replace('\n', '')
  File "breeder.py", line 99, in <listcomp>
    lines = [l.replace('\n', '')
TypeError: a bytes-like object is required, not 'str'

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.