Skip to content

Instantly share code, notes, and snippets.

@lost-theory
Created July 24, 2015 21:04
Show Gist options
  • Select an option

  • Save lost-theory/c9d9b2e8275e803d75e3 to your computer and use it in GitHub Desktop.

Select an option

Save lost-theory/c9d9b2e8275e803d75e3 to your computer and use it in GitHub Desktop.

Revisions

  1. lost-theory created this gist Jul 24, 2015.
    50 changes: 50 additions & 0 deletions minimal.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    $ find . -type f -name "*.py"
    ./setup.py
    ./mypkg/__init__.py
    ./mypkg/config.py
    ./mypkg/shapes/__init__.py
    ./mypkg/shapes/square.py

    $ find . -type f -name "*.py" | xargs head -n999
    ==> ./setup.py <==
    from setuptools import setup, find_packages
    setup(
    name="mypkg",
    version="0.1",
    packages=find_packages(),
    )

    ==> ./mypkg/__init__.py <==

    ==> ./mypkg/config.py <==
    SIZE = 4

    ==> ./mypkg/shapes/__init__.py <==

    ==> ./mypkg/shapes/square.py <==
    from mypkg.config import SIZE

    def square(size=SIZE):
    edge = "*"*size
    inside = "*" + " " * (size-2) + "*"
    yield edge
    for i in range(size-2):
    yield inside
    yield edge

    if __name__ == "__main__":
    print "\n".join(square())

    $ virtualenv ~/foo-env
    New python executable in /Users/stevek/foo-env/bin/python
    Installing setuptools, pip...done.

    $ ~/foo-env/bin/python setup.py develop
    ...
    Finished processing dependencies for mypkg==0.1

    $ ~/foo-env/bin/python mypkg/shapes/square.py
    ****
    * *
    * *
    ****