Skip to content

Commit 927eca1

Browse files
authored
Create new, simpler packaging tutorial (#498)
Move the existing tutorial into guides/distributing-packages-using-setuptools to be cleaned up later.
1 parent 48f829d commit 927eca1

8 files changed

Lines changed: 363 additions & 8 deletions

File tree

‎nox.py‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,23 @@
88

99

1010
@nox.session
11-
def build(session):
11+
def build(session, autobuild=False):
1212
session.interpreter = 'python3.6'
1313
session.install('-r', 'requirements.txt')
1414
# Treat warnings as errors.
1515
session.env['SPHINXOPTS'] = '-W'
1616
session.run(shutil.rmtree, 'build', ignore_errors=True)
17-
session.run('sphinx-build', '-W', '-b', 'html', 'source', 'build')
17+
18+
if autobuild:
19+
command = 'sphinx-autobuild'
20+
else:
21+
command = 'sphinx-build'
22+
23+
session.run(command, '-W', '-b', 'html', 'source', 'build')
1824

1925

2026
@nox.session
2127
def preview(session):
2228
session.reuse_existing_virtualenv = True
23-
build(session)
24-
session.chdir('build')
25-
session.run('python', '-m', 'http.server')
29+
session.install("sphinx-autobuild")
30+
build(session, autobuild=True)

‎requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
sphinx==1.7.4
2+
sphinx-autobuild==0.7.1
23
git+https://github.com/python/python-docs-theme.git#egg=python-docs-theme
34
git+https://github.com/pypa/pypa-docs-theme.git#egg=pypa-docs-theme

source/tutorials/distributing-packages.rst renamed to source/guides/distributing-packages-using-setuptools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Packaging and distributing projects
66

77
This section covers the basics of how to configure, package and distribute your
88
own Python projects. It assumes that you are already familiar with the contents
9-
of the :doc:`installing-packages` page.
9+
of the :doc:`/tutorials/installing-packages` page.
1010

1111
The section does *not* aim to cover best practices for Python project
1212
development as a whole. For example, it does not provide guidance or tool

‎source/guides/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ introduction to packaging, see :doc:`/tutorials/index`.
1313
installing-using-linux-tools
1414
installing-scientific-packages
1515
multi-version-installs
16+
distributing-packages-using-setuptools
1617
single-sourcing-package-version
1718
supporting-multiple-python-versions
1819
dropping-older-python-versions

‎source/index.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ covered in our :doc:`tutorials/index` section:
4040
* to learn how to manage dependencies in a version controlled project, see the
4141
:doc:`tutorial on managing application dependencies <tutorials/managing-dependencies>`.
4242
* to learn how to package and distribute your projects, see the
43-
:doc:`tutorial on packaging and distributing <tutorials/distributing-packages>`
43+
:doc:`tutorial on packaging and distributing <tutorials/packaging-projects>`
4444

4545
Learn more
4646
==========

‎source/key_projects.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ a complimentary command line tool to drive packaging, testing and release
280280
activities with Python.
281281

282282

283+
.. _flit:
284+
283285
flit
284286
====
285287

‎source/tutorials/index.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ topics, see :doc:`/guides/index`.
1010

1111
installing-packages
1212
managing-dependencies
13-
distributing-packages
13+
packaging-projects

0 commit comments

Comments
 (0)