@@ -17,19 +17,21 @@ Installing setuptools
1717Lay out your project
1818====================
1919
20- The smallest python project is two files. A  :ref:`setup.py
20+ The smallest python project is two files: a  :ref:`setup.py
2121<setup_py_description>` file which describes the metadata about your project,
2222and a file containing Python code to implement the functionality of your
2323project.
2424
2525In this example project we are going to add a little more to the
26- project to provide the typical minimal layout of a project. We'll create
27- a full Python package, a directory with an `__init__.py` file, called
28- :ref:`towelstuff/ <towelstuff_description>`. This anticipates future growth
29- as our project's source code is likely to grow beyond a single module file.
26+ project to provide the typical minimal layout of a project. We will call our
27+ project TowelStuff and keep it in a directory with the same name.
28+ We'll create a full Python package called
29+ :ref:`towelstuff/ <towelstuff_description>` as a directory with an
30+ `__init__.py` file. This anticipates future growth as our project's source
31+ code is likely to grow beyond a single module file.
3032
3133We'll also create a :ref:`README.txt <readme_txt_description>`
32- file describing  an overview of your project, and
34+ file giving  an overview of your project, and
3335a :ref:`LICENSE.txt <license_txt_description>` file containing the
3436license of your project.
3537
@@ -55,23 +57,31 @@ project. It describes all of the metadata about your project. There a quite
5557a few fields you can add to a project to give it a rich set of
5658metadata describing the project. However, there are only three required
5759fields: `name`, `version`, and `packages`. The `name` field must be unique
58- if you wish to publish your package on the Python Package Index (PyPI).
59- The `version` field keeps track of different releases of the project. The
60- `packages` field describes where you've put the Python source code within
61- your project.
60+ if you wish to publish your package on the
61+ :ref:`Python Package Index (PyPI) <PyPI>`. The `version` field keeps track of
62+ different releases of the project. The `packages` field describes where you've
63+ put the Python source code within your project. The `classifiers` field lists
64+ various facts about your project, e.g. what versions of Python it is
65+ compatible with.
6266
6367Our initial `setup.py` will also include information about the license
6468and will re-use the `README.txt` file for the `long_description` field.
6569This will look like::
6670
6771    from distutils.core import setup
6872
73+     with open('README.txt') as file:
74+         long_description = file.read()
75+ 
6976    setup(
7077        name='TowelStuff',
7178        version='0.1.dev1',
7279        packages=['towelstuff',],
7380        license='Creative Commons Attribution-Noncommercial-Share Alike license',
74-         long_description=open('README.txt').read(),
81+         long_description=long_description,
82+         classifiers=[
83+             'Programming Language :: Python :: 3.3',
84+         ],
7585    )
7686
7787
@@ -90,11 +100,11 @@ Create your first release
90100In the `version` field, we specified `0.1.dev1`. This indicates that we
91101are *developing* towards the `0.1` version. Right now there isn't any code
92102in the project. After you've written enough code to make your first release
93- worthwhile, you will change the version field to just `0.1`, dropping the `.dev1` 
94- marker.
103+ worthwhile, you will change the version field to just `0.1`, dropping the
104+ `.dev1`  marker.
95105
96106To create a release, your source code needs to be packaged into a single
97- archive file. This can be done with the `sdist` command:
107+ archive file for distribution . This can be done with the `sdist` command:
98108
99109 $ python setup.py sdist
100110
@@ -110,15 +120,15 @@ and `.zip` files on Windows systems.
110120By default, Distutils does **not** include all files in your project's
111121directory. Only the following files will be included by default:
112122
113-  * all Python source files implied by the py_modules and packages options
123+  * all Python source files implied by the ` py_modules`  and ` packages`  options
114124
115-  * all C source files mentioned in the ext_modules or libraries options
125+  * all C source files mentioned in the ` ext_modules`  or ` libraries`  options
116126
117-  * scripts identified by the scripts option
127+  * scripts identified by the ` scripts`  option
118128
119129 * anything that looks like a test script: test/test*.py
120130
121-  * Top level files named: README.txt,  README,  setup.py, or setup.cfg
131+  * Top level files named: ` README.txt`, ` README`, ` setup.py` , or ` setup.cfg` 
122132
123133If you want to include additional files, then there are a couple options
124134for including those files:
@@ -127,11 +137,11 @@ for including those files:
127137   Setuptools allows you to include all files checked into
128138   your version control system.
129139
130-  * Write a top-level MANIFEST.in file. This is a template file which
140+  * Write a top-level ` MANIFEST.in`  file. This is a template file which
131141   specifies which files (and file patterns) should be included.
132142   (TO-DO: link to a MANIFEST.in document)
133143
134- When you run the **sdist** command, a file named MANIFEST will be
144+ When you run the **sdist** command, a file named ` MANIFEST`  will be
135145generated which contains a complete list of all files included. You can
136146view this file to double check that you've setup your project to include
137147all files correctly. Now your project is ready for a release. Before
@@ -179,7 +189,7 @@ it's time to upload the finished product to PyPI. We'll also create a
179189`bdist_wininst` distribution file of our project, which will create a Windows
180190installable file. There are a few different file formats that Python
181191distributions can be created for. Each format must be specified when
182- you run the upload command, or they won't be uploaded (even if you've
192+ you run the ** upload**  command, or they won't be uploaded (even if you've
183193previously built them previously). You should always upload a
184194source distribution file. The other formats are optional, and will depend upon
185195the needs of your anticipated user base::
0 commit comments