Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
d2a64aeb
Commit
d2a64aeb
authored
May 03, 2020
by
Jason R. Coombs
Committed by
GitHub
May 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply suggestions from code review
parent
19e45c14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
22 deletions
+22
-22
changelog.d/1698.doc.rst
changelog.d/1698.doc.rst
+1
-1
docs/build_meta.txt
docs/build_meta.txt
+21
-21
No files found.
changelog.d/1698.doc.rst
View file @
d2a64aeb
Added documentation for ``build_meta`` (a bare minimum, not completed)
Added documentation for ``build_meta`` (a bare minimum, not completed)
.
docs/build_meta.txt
View file @
d2a64aeb
=======================================
Documentation to setuptools.build_meta
Build System Support
=======================================
What is it?
...
...
@@ -7,16 +7,18 @@ What is it?
Python packaging has come `a long way <https://www.bernat.tech/pep-517-518/>`_.
The traditional ``setuptools``
's
way of packgaging Python modules
The traditional ``setuptools`` way of packgaging Python modules
uses a ``setup()`` function within the ``setup.py`` script. Commands such as
``python setup.py bdist`` or ``python setup.py bdist_wheel`` generate a
distribution bundle and ``python setup.py install`` installs the distribution.
This interface makes it difficult to choose other packaging tools without an
overhaul. Additionally, the ``setup.py`` scripts hasn't been the most user
friendly tool.
overhaul. Because ``setup.py`` scripts allowed for arbitrary execution, it
proved difficult to provide a reliable user experience across environments
and history.
PEP517 therefore came to rescue and specified a new standard to
package and distribute Python modules. Under PEP517:
`PEP 517 <https://www.python.org/dev/peps/pep-0517/>`_ therefore came to
rescue and specified a new standard to
package and distribute Python modules. Under PEP 517:
a ``pyproject.toml`` file is used to specify what program to use
for generating distribution.
...
...
@@ -35,8 +37,8 @@ package and distribute Python modules. Under PEP517:
With this standard, switching between packaging tools becomes a lot easier and
in the case of ``setuptools``, ``setup.py`` becomes optional.
``build_meta`` is ``setuptools``'s implementation of PEP517. It provides the
two functions, ``build_wheel`` and ``build_sdist``
, amongst others
and uses
``build_meta`` is ``setuptools``'s implementation of PEP
517. It provides the
two functions, ``build_wheel`` and ``build_sdist``
amongst others,
and uses
a ``setup.cfg`` to specify the information about the package.
How to use it?
...
...
@@ -58,7 +60,7 @@ setuptools, the content would be::
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
``setup.cfg`` is used
to specify your package information, specified
Use ``setup.cfg``
to specify your package information, specified
`here <https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring
-setup-using-setup-cfg-files>`_ ::
...
...
@@ -70,26 +72,24 @@ setuptools, the content would be::
[options]
packages = find:
Now it's time to actually generate the distribution. PEP517 specifies two
mandatory functions, ``build_wheel`` and ``build_sdist``, implemented in
this module. Currently, it has to be done in the interpreter::
Now generate the distribution. Although the PyPA is still working to
`provide a recommended tool <https://github.com/pypa/packaging-problems/issues/219>`_
to build packages, the `pep517 package <https://pypi.org/project/pep517`_
provides this functionality. To build the package::
>>> import setuptools.build_meta
>>> setuptools.build_meta.build_wheel('wheel_dist')
'meowpkg-0.0.1-py3-none-any.whl'
>>> setuptools.build_meta.build_sdist('sdist')
'meowpkg-0.0.1.tar.gz'
$ pip install -q pep517
$ mkdir dist
$ python -m pep517.build .
And now it's done! The ``.whl`` file and ``.tar.gz`` can then be distributed
and installed::
~/newcomputer
/
dist
/
meowpkg-0.0.1.whl
meowpkg-0.0.1.tar.gz
$ pip install meowpkg-0.0.1.whl
$ pip install
dist/
meowpkg-0.0.1.whl
or::
$ pip install meowpkg-0.0.1.tar.gz
$ pip install dist/meowpkg-0.0.1.tar.gz
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment