dan mackinlay avatar dan mackinlay committed 820981f

initial clone from example project

Comments (0)

Files changed (10)

+.. include globals.rst
+
+.. privateer documentation master file, created by
+   sphinx-quickstart on Thu Nov 05 22:55:49 2009.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to privateer's documentation!
+***************************************************
+
+Introduction: This Package is a Tutorial
+========================================
+
+This is just a demonstration vehicle used to take you through the process 
+-- start to finish -- of creating a Python project that can be:
+
+	1. Uploaded to
+	2. Distributed from 
+
+	and 
+
+	3. Documented on
+	
+the Python Package Index (aka pypi or the cheeseshop) at http://pypi.python.org/pypi. 
+This project uses setuptools, sphinx, and the Sphinx-PyPI-upload
+(http://pypi.python.org/pypi/Sphinx-PyPI-upload/0.2.1). 
+
+This demonstration is not meant to be complete nor authoritative. It's just a 
+recording of the steps I took to get some projects onto pypi and 
+hopefully it might save someone some time from googling around.  To be sure, 
+this is simply just *one* way to make a project, document it, and get it 
+on pypi. 
+
+NOTE: This was originally given as a talk to the Minnesota Python Users Group 
+http://groups.google.com/group/pymntos/ and was developed for a 
+spoken presentation format.  
+   
+# -*- Import: -*-
+from paver.easy import *
+from paver.setuputils import setup
+from setuptools import find_packages
+
+try:
+    # Optional tasks, only needed for development
+    # -*- Optional import: -*-
+    from github.tools.task import *
+    import paver.doctools
+    import paver.virtual
+    import paver.misctasks
+    ALL_TASKS_LOADED = True
+except ImportError, e:
+    info("some tasks could not not be imported.")
+    debug(str(e))
+    ALL_TASKS_LOADED = False
+
+
+
+version = '0.0'
+
+classifiers = [
+    # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+    "Development Status :: 1 - Planning",
+    ]
+
+install_requires = [
+    # -*- Install requires: -*-
+    'setuptools',
+    ]
+
+entry_points="""
+    # -*- Entry points: -*-
+    """
+
+# compatible with distutils of python 2.3+ or later
+setup(
+    name='a_pattern_language',
+    version=version,
+    description='pattern language for design, dan-style',
+    long_description=open('README.rst', 'r').read(),
+    classifiers=classifiers,
+    keywords='',
+    author='dan mackinlay',
+    author_email='fillmewithspam@email.possumpalace.org',
+    url='http://possumpalace.org/',
+    license='BSD',
+    packages = find_packages(exclude=['bootstrap', 'pavement',]),
+    include_package_data=True,
+    test_suite='nose.collector',
+    zip_safe=False,
+    install_requires=install_requires,
+    entry_points=entry_points,
+    )
+
+options(
+    # -*- Paver options: -*-
+    minilib=Bunch(
+        extra_files=[
+            # -*- Minilib extra files: -*-
+            ]
+        ),
+    sphinx=Bunch(
+        docroot='docs',
+        builddir="_build",
+        sourcedir=""
+        ),
+    virtualenv=Bunch(
+        packages_to_install=[
+            # -*- Virtualenv packages to install: -*-
+            'github-tools',
+            "nose",
+            "Sphinx>=0.6b1",
+            "pkginfo", 
+            "virtualenv"],
+        dest_dir='./virtual-env/',
+        install_paver=True,
+        script_name='bootstrap.py',
+        paver_command_line=None
+        ),
+    )
+
+options.setup.package_data = paver.setuputils.find_package_data(
+    'a_pattern_language', package='a_pattern_language', only_in_packages=False)
+
+if ALL_TASKS_LOADED:
+    @task
+    @needs('generate_setup', 'minilib', 'setuptools.command.sdist')
+    def sdist():
+        """Overrides sdist to make sure that our setup.py is generated."""

privateer_pyevolve/__init__.py

+"""A pypi demonstration vehicle.
+
+.. moduleauthor:: Andrew Carter <andrew@invalid.com>
+
+"""
+
+import useful_1
+import useful_2
+
+
+def start():
+    "This starts this module running ..."

privateer_pyevolve/useful_1.py

+"""
+
+.. module:: useful_1
+   :platform: Unix, Windows
+   :synopsis: A useful module indeed.
+
+.. moduleauthor:: Andrew Carter <andrew@invalid.com>
+
+
+"""
+
+def public_fn_with_googley_docstring(name, state=None):
+    """This function does something.
+    
+    Args:
+       name (str):  The name to use. 
+       
+    Kwargs:
+       state (bool): Current state to be in. 
+
+    Returns: 
+       int.  The return code::
+       
+          0 -- Success!
+          1 -- No good. 
+          2 -- Try again. 
+    
+    Raises:
+       AttributeError, KeyError
+
+    A really great idea.  A way you might use me is
+    
+    >>> print public_fn_with_googley_docstring(name='foo', state=None)
+    0
+    
+    BTW, this always returns 0.  **NEVER** use with :class:`MyPublicClass`.
+    
+    """
+    return 0
+
+def public_fn_with_sphinxy_docstring(name, state=None):
+    """This function does something.
+    
+    :param name: The name to use.
+    :type name: str.
+    :param state: Current state to be in.    
+    :type state: bool.
+    :returns:  int -- the return code.      
+    :raises: AttributeError, KeyError
+
+    """
+    return 0
+
+def public_fn_without_docstring():
+    return True 
+
+def _private_fn_with_docstring(foo, bar='baz', foobarbas=None):
+    """I have a docstring, but won't be imported if you just use ``:members:``.
+    """   
+    return None
+
+
+class MyPublicClass(object):
+    """We use this as a public class example class.
+
+    You never call this class before calling :func:`public_fn_with_sphinxy_docstring`.
+    
+    .. note:: 
+      
+       An example of intersphinx is this: you **cannot** use :mod:`pickle` on this class. 
+    
+    """
+    
+    def __init__(self, foo, bar='baz'):
+        """A really simple class.
+        
+        Args:
+           foo (str): We all know what foo does. 
+           
+        Kwargs:
+           bar (str): Really, same as foo.  
+    
+        """
+        self._foo = foo
+        self._bar = bar
+
+    def get_foobar(self, foo, bar=True):
+        """This gets the foobar
+        
+        This really should have a full function definition, but I am too lazy. 
+
+        >>> print get_foobar(10, 20)
+        30
+        >>> print get_foobar('a', 'b')
+        ab
+        
+        Isn't that what you want?
+        
+        """
+        return foo + bar
+
+    def _get_baz(self, baz=None):
+        """A private function to get baz.
+        
+        This really should have a full function definition, but I am too lazy. 
+        
+        """
+        return baz
+    

privateer_pyevolve/useful_2.py

+"""A very useful module indeed. 
+
+"""
+
+def public_fn_with_googley_docstring(name, state=None):
+    """This function does something.
+    
+    Args:
+       name (str):  The name to use. 
+       
+    Kwargs:
+       state (bool): Current state to be in. 
+
+    Returns: 
+       int.  The return code::
+       
+          0 -- Success!
+          1 -- No good. 
+          2 -- Try again. 
+    
+    Raises:
+       AttributeError, KeyError
+
+    A really great idea.  A way you might use me is
+    
+    >>> print public_fn_with_googley_docstring(name='foo', state=None)
+    0
+    
+    BTW, this always returns 0.  **NEVER** use with :class:`MyPublicClass`.
+    
+    """
+    return 0
+
+def public_fn_with_sphinxy_docstring(name, state=None):
+    """This function does something.
+    
+    :param name: The name to use.
+    :type name: str.
+    :param state: Current state to be in.    
+    :type state: bool.
+    :returns:  int -- the return code.      
+    :raises: AttributeError, KeyError
+
+    """
+    return 0
+
+def public_fn_without_docstring():
+    return True 
+
+def _private_fn_with_docstring(foo, bar='baz', foobarbas=None):
+    """I have a docstring, but won't be imported if you just use ``:members:``.
+    """   
+    return None
+
+
+class MyPublicClass(object):
+    """We use this as a public class example class.
+
+    You never call this class before calling :func:`public_fn_with_sphinxy_docstring`.
+    
+    .. note:: 
+      
+       An example of intersphinx is this: you **cannot** use :mod:`pickle` on this class. 
+    
+    """
+    
+    def __init__(self, foo, bar='baz'):
+        """A really simple class.
+        
+        Args:
+           foo (str): We all know what foo does. 
+           
+        Kwargs:
+           bar (str): Really, same as foo.  
+    
+        """
+        self._foo = foo
+        self._bar = bar
+
+    def get_foobar(self, foo, bar=True):
+        """This gets the foobar
+        
+        This really should have a full function definition, but I am too lazy. 
+
+        >>> print get_foobar(10, 20)
+        30
+        >>> print get_foobar('a', 'b')
+        ab
+        
+        Isn't that what you want?
+        
+        """
+        return foo + bar
+
+    def _get_baz(self, baz=None):
+        """A private function to get baz.
+        
+        This really should have a full function definition, but I am too lazy. 
+        
+        """
+        return baz
+    
+[build_sphinx]
+all_files = 1
+build-dir = doc/build
+source-dir = doc/source
+
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
+[upload_sphinx]
+upload-dir = doc/build/html
+
+import os
+from setuptools import setup
+
+# Utility function to read the README file.  
+# Used for the long_description.  It's nice, because now 1) we have a top level
+# README file and 2) it's easier to type in the README file than to put a raw
+# string in below ...
+def read(fname):
+    return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+setup(
+    name = "privateer",
+    version = "0.0.5",
+    author = "Dan MacKinlay",
+    author_email = "fillmewithspam@email.possumpalace.org",
+    description = ("evolve ecologically rational traders"),
+    license = "BSD",
+    keywords = "example documentation tutorial",
+    url = "http://packages.python.org/privateer",
+    packages=['privateer_pyevolve', 'tests'],
+    long_description=read('README'),
+    classifiers=[
+        "Development Status :: 3 - Alpha",
+        "Topic :: Utilities",
+        "License :: OSI Approved :: BSD License",
+    ],
+)

Empty file added.

+
+import doctest
+import test0
+doctest.testmod(test0, optionflags=doctest.NORMALIZE_WHITESPACE |
+                                   doctest.ELLIPSIS |
+                                   doctest.REPORT_ONLY_FIRST_FAILURE
+                                   )
+

Empty file added.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.