Merge pull request #1795 from cgoldberg/update-docs-setuptools
Before adoption: this commit came in with the history the project adopted, so no landing records it.
update docs and refer to setuptools
authored by Markus Unterwaditzer · committed by Markus Unterwaditzer · parents e45e17c, 28b36f6 · Browse files · 1 file·+20 added−21 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+20 added−21 removed
- other:+20 added−21 removed
Provenance
- Commit
e8bd2c9- Tree
b93269a- Author
Markus Unterwaditzer <markus@unterwaditzer.net>- Committer
Markus Unterwaditzer <markus@unterwaditzer.net>- Parent 1
e45e17c- Parent 2
28b36f6
1 file changed+20 added−21 removed
modified:docs/patterns/distribute.rst+20 added-21 removed
2 unmodified lines3 Deploying with Setuptools4 =========================5 6 `Setuptools`_, is an extension library that is commonly used to7-(like the name says) distribute Python libraries and8-extensions. It extends distutils, a basic module installation system9-shipped with Python to also support various more complex constructs that10-make larger applications easier to distribute:7+distribute Python libraries and extensions. It extends distutils, a basic8+module installation system shipped with Python to also support various more9+complex constructs that make larger applications easier to distribute:10 11 - **support for dependencies**: a library or application can declare a12 list of other libraries it depends on which will be installed13 automatically for you.14 - **package registry**: setuptools registers your package with your15 Python installation. This makes it possible to query information16 provided by one package from another package. The best known feature of17 this system is the entry point support which allows one package to19- declare an "entry point" another package can hook into to extend the18+ declare an "entry point" that another package can hook into to extend the19 other package.21-- **installation manager**: :command:`easy_install`, which comes with distribute22- can install other libraries for you. You can also use `pip`_ which23- sooner or later will replace :command:`easy_install` which does more than just24- installing packages for you.20+- **installation manager**: :command:`pip` can install other libraries for you.21 26-Flask itself, and all the libraries you can find on the cheeseshop27-are distributed with either distribute, the older setuptools or distutils.22+If you have Python 2 (>=2.7.9) or Python 3 (>=3.4) installed from python.org,23+you will already have pip and setuptools on your system. Otherwise, you24+will need to install them yourself.25 26+Flask itself, and all the libraries you can find on PyPI are distributed with27+either setuptools or distutils.28+29 In this case we assume your application is called30 :file:`yourapplication.py` and you are not using a module, but a :ref:`package31 <larger-applications>`. If you have not yet converted your application into32 a package, head over to the :ref:`larger-applications` pattern to see33 how this can be done.34 35-A working deployment with distribute is the first step into more complex35+A working deployment with setuptools is the first step into more complex36 and more automated deployment scenarios. If you want to fully automate37 the process, also read the :ref:`fabric-deployment` chapter.38 39 Basic Setup Script25 unmodified lines65 install_requires=['Flask']66 )67 68 Please keep in mind that you have to list subpackages explicitly. If you69-want distribute to lookup the packages for you automatically, you can use69+want setuptools to lookup the packages for you automatically, you can use70 the `find_packages` function::71 72 from setuptools import setup, find_packages73 3 unmodified lines77 )78 79 Most parameters to the `setup` function should be self explanatory,80 `include_package_data` and `zip_safe` might not be.81-`include_package_data` tells distribute to look for a :file:`MANIFEST.in` file81+`include_package_data` tells setuptools to look for a :file:`MANIFEST.in` file82 and install all the entries that match as package data. We will use this83 to distribute the static files and templates along with the Python module84 (see :ref:`distributing-resources`). The `zip_safe` flag can be used to85 force or prevent zip Archive creation. In general you probably don't want7 unmodified lines93 ----------------------94 95 If you try to install the package you just created, you will notice that96 folders like :file:`static` or :file:`templates` are not installed for you. The97-reason for this is that distribute does not know which files to add for97+reason for this is that setuptools does not know which files to add for98 you. What you should do, is to create a :file:`MANIFEST.in` file next to your99 :file:`setup.py` file. This file lists all the files that should be added to100 your tarball::101 7 unmodified lines109 110 Declaring Dependencies111 ----------------------112 113-Dependencies are declared in the `install_requires` parameter as list.113+Dependencies are declared in the `install_requires` parameter as a list.114 Each item in that list is the name of a package that should be pulled from115 PyPI on installation. By default it will always use the most recent116 version, but you can also provide minimum and maximum version117 requirements. Here some examples::6 unmodified lines124 125 As mentioned earlier, dependencies are pulled from PyPI. What if you126 want to depend on a package that cannot be found on PyPI and won't be127 because it is an internal package you don't want to share with anyone?128-Just still do as if there was a PyPI entry for it and provide a list of129-alternative locations where distribute should look for tarballs::128+Just do it as if there was a PyPI entry and provide a list of129+alternative locations where setuptools should look for tarballs::130 131 dependency_links=['http://example.com/yourfiles']132 133 Make sure that page has a directory listing and the links on the page are134 pointing to the actual tarballs with their correct filenames as this is135-how distribute will find the files. If you have an internal company136-server that contains the packages, provide the URL to that server there.135+how setuptools will find the files. If you have an internal company136+server that contains the packages, provide the URL to that server.137 138 139 Installing / Developing140 -----------------------15 unmodified lines156 the code without having to run `install` again after each change.157 158 159 .. _pip: https://pypi.python.org/pypi/pip160-.. _ez_setup.py: https://bootstrap.pypa.io/ez_setup.py160 .. _Setuptools: https://pythonhosted.org/setuptools