|
2 | 2 | Installation & Packaging Tutorial |
3 | 3 | ================================= |
4 | 4 |
|
5 | | -:Page Status: Incomplete |
6 | | -:Last Reviewed: 2014-08-07 |
| 5 | +:Page Status: Complete |
| 6 | +:Last Reviewed: 2014-08-27 |
7 | 7 |
|
8 | 8 | .. contents:: |
9 | 9 |
|
@@ -276,7 +276,7 @@ Additionally, most projects will contain the following files: |
276 | 276 | that contains option defaults for ``setup.py`` commands. |
277 | 277 | * A `MANIFEST.in |
278 | 278 | <https://github.com/pypa/sampleproject/blob/master/MANIFEST.in>`_ that defines |
279 | | - the files that will be included in the project distribution when it's |
| 279 | + additional files to be included in the project distribution when it's |
280 | 280 | packaged. |
281 | 281 |
|
282 | 282 |
|
@@ -325,15 +325,79 @@ way is to keep the version in both ``setup.py`` and your code. If you'd rather |
325 | 325 | not duplicate the value, there are a few ways to manage this. See the |
326 | 326 | ":ref:`Single sourcing the version`" Advanced Topics section. |
327 | 327 |
|
328 | | -License |
329 | | -------- |
330 | 328 |
|
331 | 329 | Packages |
332 | 330 | -------- |
333 | 331 |
|
| 332 | +from `sampleproject/setup.py |
| 333 | +<https://github.com/pypa/sampleproject/blob/master/setup.py>`_ |
| 334 | + |
| 335 | +:: |
| 336 | + |
| 337 | + packages=find_packages(exclude=['contrib', 'docs', 'tests*']), |
| 338 | + |
| 339 | +It's required to list the :term:`packages <Package (Meaning #1)>` to be included |
| 340 | +in your project. Although they can be listed manually, |
| 341 | +``setuptools.find_packages`` finds them automatically. Use the ``exclude`` |
| 342 | +keyword argument to omit packages that are not intended to be released and |
| 343 | +installed. |
| 344 | + |
| 345 | + |
334 | 346 | Metadata |
335 | 347 | -------- |
336 | 348 |
|
| 349 | +It's important to include various metadata about your project. |
| 350 | + |
| 351 | +from `sampleproject/setup.py |
| 352 | +<https://github.com/pypa/sampleproject/blob/master/setup.py>`_ |
| 353 | + |
| 354 | +:: |
| 355 | + |
| 356 | + # A description of your project |
| 357 | + description='A sample Python project', |
| 358 | + long_description=long_description, |
| 359 | + |
| 360 | + # The project's main homepage |
| 361 | + url='https://github.com/pypa/sampleproject', |
| 362 | + |
| 363 | + # Author details |
| 364 | + author='The Python Packaging Authority', |
| 365 | + |
| 366 | + |
| 367 | + # Choose your license |
| 368 | + license='MIT', |
| 369 | + |
| 370 | + # See https://pypi.python.org/pypi?%3Aaction=list_classifiers |
| 371 | + classifiers=[ |
| 372 | + # How mature is this project? Common values are |
| 373 | + # 3 - Alpha |
| 374 | + # 4 - Beta |
| 375 | + # 5 - Production/Stable |
| 376 | + 'Development Status :: 3 - Alpha', |
| 377 | + |
| 378 | + # Indicate who your project is intended for |
| 379 | + 'Intended Audience :: Developers', |
| 380 | + 'Topic :: Software Development :: Build Tools', |
| 381 | + |
| 382 | + # Pick your license as you wish (should match "license" above) |
| 383 | + 'License :: OSI Approved :: MIT License', |
| 384 | + |
| 385 | + # Specify the Python versions you support here. In particular, ensure |
| 386 | + # that you indicate whether you support Python 2, Python 3 or both. |
| 387 | + 'Programming Language :: Python :: 2', |
| 388 | + 'Programming Language :: Python :: 2.6', |
| 389 | + 'Programming Language :: Python :: 2.7', |
| 390 | + 'Programming Language :: Python :: 3', |
| 391 | + 'Programming Language :: Python :: 3.2', |
| 392 | + 'Programming Language :: Python :: 3.3', |
| 393 | + 'Programming Language :: Python :: 3.4', |
| 394 | + ], |
| 395 | + |
| 396 | + # What does your project relate to? |
| 397 | + keywords='sample setuptools development', |
| 398 | + |
| 399 | + |
| 400 | + |
337 | 401 | Dependencies |
338 | 402 | ------------ |
339 | 403 |
|
@@ -414,8 +478,6 @@ For more information see the distutils section on `Installing Additional Files |
414 | 478 | installed relative to "site-packages". For discussion see `wheel Issue #92 |
415 | 479 | <https://bitbucket.org/pypa/wheel/issue/92>`_. |
416 | 480 |
|
417 | | -Manifest |
418 | | --------- |
419 | 481 |
|
420 | 482 | Scripts |
421 | 483 | ------- |
@@ -445,6 +507,23 @@ For more information, see `Automatic Script Creation |
445 | 507 | from the `setuptools docs <http://pythonhosted.org/setuptools/setuptools.html>`_. |
446 | 508 |
|
447 | 509 |
|
| 510 | +MANIFEST.in |
| 511 | +----------- |
| 512 | + |
| 513 | +A ``MANIFEST.in`` file is needed in certain cases where you need to package |
| 514 | +additional files that ``python setup.py sdist (or bdist_wheel)`` don't |
| 515 | +automatically include. |
| 516 | + |
| 517 | +To see a list of what's included by default, see the `Specifying the files to |
| 518 | +distribute |
| 519 | +<https://docs.python.org/3.4/distutils/sourcedist.html#specifying-the-files-to-distribute>`_ |
| 520 | +section from the :ref:`distutils` documentation. |
| 521 | + |
| 522 | +For details on writing a ``MANIFEST.in`` file, see the `The MANIFEST.in template |
| 523 | +<https://docs.python.org/2/distutils/sourcedist.html#the-manifest-in-template>`_ |
| 524 | +section from the :ref:`distutils` documentation. |
| 525 | + |
| 526 | + |
448 | 527 | Developing your project |
449 | 528 | ======================= |
450 | 529 |
|
|
0 commit comments