Created
July 24, 2015 21:04
-
-
Save lost-theory/c9d9b2e8275e803d75e3 to your computer and use it in GitHub Desktop.
minimal python package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 | |
**** | |
* * | |
* * | |
**** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment