Pyproject.toml: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 43: Line 43:
Issues = "https://github.com/ovidiuf/ofddi/issues"
Issues = "https://github.com/ovidiuf/ofddi/issues"
</syntaxhighlight>
</syntaxhighlight>
==<tt>name</tt>==
<code>name</code> is the [[Python_Language_Modularization#Distribution_Name|distribution name of the package]]. For more details, see: {{Internal|Python_Language_Modularization#Distribution_Name|Python Language Modularization &#124; Distribution Packages}}

Revision as of 02:29, 6 April 2024

External

Internal

Overview

pyproject.toml is a file that specifies required packages, scripts, plugins and URLs.

Build Backend Configuration

pyproject.toml tells the build frontend tool which backend to use for the specific project it is part of.

The requires key is a list of packages that are needed to build the package. The frontend should install them automatically when building the package. What about the dependencies specified in requirements.txt? The build-backend key is the name of the Python object that frontends will use to perform the build.

Additional configuration of the build tool will either be in a tool section of the pyproject.toml, or in a special file defined by the build tool. For example, when using setuptools as build backend, additional configuration may be added to a setup.py or setup.cfg file.

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

Project Metadata

[project]
name = "ofddi"
version = "0.1.0"
authors = [
  { name="Ovidiu Feodorov", email="ovidiu@example.com" },
]
description = "DDI"
readme = "README.md"
requires-python = ">=3.12"
classifiers = [
    "Programming Language :: Python :: 3",
    "License :: OSI Approved :: MIT License",
    "Operating System :: OS Independent",
]

[project.urls]
Homepage = "https://github.com/ovidiuf/ofddi"
Issues = "https://github.com/ovidiuf/ofddi/issues"

name

name is the distribution name of the package. For more details, see:

Python Language Modularization | Distribution Packages