Defining Package Metadata
When you are preparing your Python project for distribution, you need to provide certain metadata so that tools and users can easily identify, install, and manage your package. This metadata is specified in the pyproject.toml file, which is now the standard for Python packaging. The key metadata fields you must include are as follows:
- Name: the unique identifier for your package on the Python Package Index (PyPI);
- Version: the current release version of your package;
- Author: the name of the main creator or maintainer of the package;
- License: the type of license under which your package is distributed;
- Description: a brief summary of what your package does;
- Readme: the path to your README file, which provides more detailed information about your package;
- Keywords: a list of terms to help users find your package;
- Classifiers: a list of standardized tags that describe your package’s audience, maturity, and compatibility.
Each of these fields plays a critical role in how your package is discovered, installed, and managed by both users and automated tools. For example, the name and version fields uniquely identify a specific release, while the license field informs users about how they can use your code. The author field gives credit and a point of contact for your package. Classifiers and keywords help categorize your package for searchability.
You should always ensure that this metadata is accurate and up to date, as it directly affects how your package is presented and consumed by the Python community. Below you will see what a typical pyproject.toml metadata section looks like.
[project]
name = "my-awesome-package"
version = "1.0.0"
description = "A Python package that does awesome things"
readme = "README.md"
authors = [
{ name="Jane Doe", email="jane@example.com" }
]
license = { file="LICENSE" }
keywords = ["awesome", "python", "package"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
]
Merci pour vos commentaires !
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Can you explain what each field in the pyproject.toml example means?
What are some best practices for writing package metadata?
How do I choose the right classifiers and keywords for my package?
Génial!
Completion taux amélioré à 7.14
Defining Package Metadata
Glissez pour afficher le menu
When you are preparing your Python project for distribution, you need to provide certain metadata so that tools and users can easily identify, install, and manage your package. This metadata is specified in the pyproject.toml file, which is now the standard for Python packaging. The key metadata fields you must include are as follows:
- Name: the unique identifier for your package on the Python Package Index (PyPI);
- Version: the current release version of your package;
- Author: the name of the main creator or maintainer of the package;
- License: the type of license under which your package is distributed;
- Description: a brief summary of what your package does;
- Readme: the path to your README file, which provides more detailed information about your package;
- Keywords: a list of terms to help users find your package;
- Classifiers: a list of standardized tags that describe your package’s audience, maturity, and compatibility.
Each of these fields plays a critical role in how your package is discovered, installed, and managed by both users and automated tools. For example, the name and version fields uniquely identify a specific release, while the license field informs users about how they can use your code. The author field gives credit and a point of contact for your package. Classifiers and keywords help categorize your package for searchability.
You should always ensure that this metadata is accurate and up to date, as it directly affects how your package is presented and consumed by the Python community. Below you will see what a typical pyproject.toml metadata section looks like.
[project]
name = "my-awesome-package"
version = "1.0.0"
description = "A Python package that does awesome things"
readme = "README.md"
authors = [
{ name="Jane Doe", email="jane@example.com" }
]
license = { file="LICENSE" }
keywords = ["awesome", "python", "package"]
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
]
Merci pour vos commentaires !