@@ -5,11 +5,13 @@ This file lives next to the module or package.
55
66.. note ::
77
8- Older version of Flit (up to 0.11) used a :doc: `flit.ini file <flit_ini >` for
9- similar information. These files no longer work with Flit 3 and above.
8+ Flit 3.x supported an alternative, older way of specifying project metadata
9+ in a ``[tool.flit.metadata] `` table. This was superseded by the ``[project] ``
10+ table described below.
1011
11- Run ``python3 -m flit.tomlify `` to convert a ``flit.ini `` file to
12- ``pyproject.toml ``.
12+ If you need to build a package that used ``[tool.flit.metadata] ``, you will
13+ need ``flit_core <4 ``. Hopefully most packages specify this constraint and
14+ will automatically be built with the right version.
1315
1416Build system section
1517--------------------
@@ -20,18 +22,18 @@ defined by PEP 517. For any new project using Flit, it will look like this:
2022.. code-block :: toml
2123
2224 [build-system]
23- requires = ["flit_core >=3.11,<4 "]
25+ requires = ["flit_core >=3.11,<5 "]
2426 build-backend = "flit_core.buildapi"
2527
2628 Version constraints:
2729
28- - For now, all packages should specify ``<4 ``, so they won't be impacted by
30+ - For now, all packages should specify ``<5 ``, so they won't be impacted by
2931 changes in the next major version.
3032- ``license-files `` and license expressions in the ``license `` field require
3133 ``flit_core >=3.11 ``.
32- - :ref: `pyproject_toml_project ` requires ``flit_core >=3.2 ``
33- - :ref: ` pyproject_old_metadata ` requires ``flit_core >=2,<4 ``
34- - The older :doc: ` flit.ini file < flit_ini >` requires ``flit_core <3 ``.
34+ - :ref: `pyproject_toml_project ` requires ``flit_core >=3.2 ``.
35+ - The older `` [tool.flit.metadata] `` metadata table requires ``flit_core >=2,<4 ``.
36+ - The very old `` flit.ini `` file requires ``flit_core <3 ``.
3537- TOML features new in version 1.0 require ``flit_core >=3.4 ``.
3638- ``flit_core `` 3.3 is the last version supporting Python 3.4 & 3.5. Packages
3739 supporting these Python versions can only use `TOML v0.5
@@ -41,16 +43,10 @@ Version constraints:
4143
4244.. _pyproject_toml_project :
4345
44- New style metadata
45- ------------------
46-
47- .. versionadded :: 3.2
48-
49- The new standard way to specify project metadata is in a ``[project] `` table,
50- as defined by :pep: `621 `. Flit works for now with either this or the older
51- ``[tool.flit.metadata] `` table (:ref: `described below <pyproject_old_metadata >`),
52- but it won't allow you to mix them.
46+ Project metadata
47+ ----------------
5348
49+ Project metadata is specified in the standard ``[project] `` table.
5450A simple ``[project] `` table might look like this:
5551
5652.. code-block :: toml
@@ -65,6 +61,10 @@ A simple ``[project]`` table might look like this:
6561 requires-python = ">=3.5"
6662 dynamic = ["version", "description"]
6763
64+ .. seealso ::
65+
66+ `The pyproject.toml specification <https://packaging.python.org/en/latest/specifications/pyproject-toml/ >`_
67+
6868The allowed fields are:
6969
7070name
@@ -246,164 +246,11 @@ Flit looks for the source of the package by its import name. The source may be
246246located either in the directory that holds the ``pyproject.toml `` file, or in a
247247``src/ `` subdirectory.
248248
249- .. _pyproject_old_metadata :
250-
251- Old style metadata
252- ------------------
253-
254- Flit's older way to specify metadata is in a ``[tool.flit.metadata] `` table,
255- along with ``[tool.flit.scripts] `` and ``[tool.flit.entrypoints] ``, described
256- below. This is still recognised for now, but you can't mix it with
257- :ref: `pyproject_toml_project `.
258-
259- There are three required fields:
260-
261- module
262- The name of the module/package, as you'd use in an import statement.
263- author
264- Your name
265- author-email
266- Your email address
267-
268- e.g. for flit itself
269-
270- .. code-block :: toml
271-
272- [tool.flit.metadata]
273- module = "flit"
274- author = "Thomas Kluyver"
275- author-email = "[email protected] " 276-
277- .. versionchanged :: 1.1
278-
279- ``home-page `` was previously required.
280-
281- The remaining fields are optional:
282-
283- home-page
284- A URL for the project, such as its Github repository.
285- requires
286- A list of other packages from PyPI that this package needs. Each package may
287- be followed by a version specifier like ``(>=4.1) `` or ``>=4.1 ``, and/or an
288- `environment marker `_
289- after a semicolon. For example:
290-
291- .. code-block :: toml
292-
293- requires = [
294- "requests >=2.6",
295- "configparser; python_version == '2.7'",
296- ]
297-
298- requires-extra
299- Lists of packages needed for every optional feature. The requirements
300- are specified in the same format as for ``requires ``. The requirements of
301- the two reserved extras ``test `` and ``doc `` as well as the extra ``dev ``
302- are installed by ``flit install ``. For example:
303-
304- .. code-block :: toml
305-
306- [tool.flit.metadata.requires-extra]
307- test = [
308- "pytest >=2.7.3",
309- "pytest-cov",
310- ]
311- doc = ["sphinx"]
312-
313- .. versionadded :: 1.1
314-
315- description-file
316- A path (relative to the .toml file) to a file containing a longer description
317- of your package to show on PyPI. This should be written in `reStructuredText
318- <http://docutils.sourceforge.net/docs/user/rst/quickref.html> `_, Markdown or
319- plain text, and the filename should have the appropriate extension
320- (``.rst ``, ``.md `` or ``.txt ``).
321- classifiers
322- A list of `Trove classifiers <https://pypi.python.org/pypi?%3Aaction=list_classifiers >`_.
323- Add ``Private :: Do Not Upload `` into the list to prevent a private package
324- from uploading on PyPI by accident.
325- requires-python
326- A version specifier for the versions of Python this requires, e.g. ``~=3.3 `` or
327- ``>=3.3,<4 `` which are equivalents.
328- dist-name
329- If you want your package's name on PyPI to be different from the importable
330- module name, set this to the PyPI name.
331- keywords
332- Comma separated list of words to help with searching for your package.
333- license
334- The name of a license, if you're using one for which there isn't a Trove
335- classifier. It's recommended to use Trove classifiers instead of this in
336- most cases.
337- maintainer, maintainer-email
338- Like author, for if you've taken over a project from someone else.
339-
340- Here was the metadata section from flit using the older style:
341-
342- .. code-block :: toml
343-
344- [tool.flit.metadata]
345- module="flit"
346- author="Thomas Kluyver"
347- 348- home-page="https://github.com/pypa/flit"
349- requires=[
350- "flit_core >=2.2.0",
351- "requests",
352- "docutils",
353- "tomli",
354- "tomli-w",
355- ]
356- requires-python=">=3.6"
357- description-file="README.rst"
358- classifiers=[
359- "Intended Audience :: Developers",
360- "License :: OSI Approved :: BSD License",
361- "Programming Language :: Python :: 3",
362- "Topic :: Software Development :: Libraries :: Python Modules",
363- ]
364-
365- .. _pyproject_toml_urls :
366-
367- URLs subsection
368- ~~~~~~~~~~~~~~~
369-
370- Your project's page on `pypi.org <https://pypi.org/ >`_ can show a number of
371- links, in addition to the ``home-page `` URL described above. You can
372- point people to documentation or a bug tracker, for example.
373-
374- This section is called ``[tool.flit.metadata.urls] `` in the file. You can use
375- any names inside it. Here it is for flit:
376-
377- .. code-block :: toml
378-
379- [tool.flit.metadata.urls]
380- Documentation = "https://flit.pypa.io"
381-
382- .. versionadded :: 1.0
383-
384- .. _pyproject_toml_scripts :
385-
386- Scripts section
387- ~~~~~~~~~~~~~~~
388-
389- A ``[tool.flit.scripts] `` table can be used along with ``[tool.flit.metadata] ``.
390- It is in the same format as the newer ``[project.scripts] `` table
391- :ref: `described above <pyproject_project_scripts >`.
392-
393- Entry points sections
394- ~~~~~~~~~~~~~~~~~~~~~
395-
396- ``[tool.flit.entrypoints] `` tables can be used along with ``[tool.flit.metadata] ``.
397- They are in the same format as the newer ``[project.entry-points] `` tables
398- :ref: `described above <pyproject_project_entrypoints >`.
399-
400249.. _pyproject_toml_sdist :
401250
402251Contents of distribution files
403252------------------------------
404253
405- .. versionadded :: 2.0
406-
407254When building a wheel, Flit includes the package contents (including non-Python
408255data files, but not ``.pyc `` bytecode files) along with the normal wheel
409256metadata.
0 commit comments