setuptools
setuptools copied to clipboard
[FR] Replace `entry-points` keyword with `scripts` in a `dynamic` table`
What's the problem this feature will solve?
As of setuptools 69.0.0, it looks like you need to include scripts in a dynamic definition if you were previously using entry-points.
As an example:
# Pre 69
dynamic = ["entry-points"]
[tool.setuptools.dynamic]
entry-points = {file = "entrypoints.txt"}
Then post-69
dynamic = ["scripts"]
[tool.setuptools.dynamic]
entry-points = {file = "entrypoints.txt"}
Note that if you do this:
[tool.setuptools.dynamic]
scripts = {file = "scripts.txt"}
setuptools will fail, since scripts is not currently defined as a valid key in the dynamic table
Describe the solution you'd like
Simply replace entry-points as a dynamic table entry with scripts, and deprecate the usage of entry-points entirely.
Alternative Solutions
Re-instate the usage of entry-points without using scripts
Additional context
This is the error received if you continue to use entrypoints without using scripts instead (pre setuptools 69 example):
setuptools.errors.InvalidConfigError:
The following seems to be defined outside of `pyproject.toml`:
`scripts = <a table of scripts>`
According to the spec (see the link below), however, setuptools CANNOT
consider this value unless `scripts` is listed as `dynamic`.
https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
This is the error if you define scripts in the dynamic table:
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [275 lines of output]
configuration error: `tool.setuptools.dynamic` must not contain {'scripts'} properties
DESCRIPTION:
Instructions for loading :pep:`621`-related metadata dynamically
GIVEN VALUE:
{
"version": {
"attr": "w.__version__"
},
"scripts": {
"file": "scripts.txt"
}
}
OFFENDING RULE: 'additionalProperties'
DEFINITION:
{
"type": "object",
"additionalProperties": false,
"properties": {
"version": {
"$$description": [
"A version dynamically loaded via either the ``attr:`` or ``file:``",
"directives. Please make sure the given file or attribute respects :pep:`4[40](https://github.com/<url>)`."
],
"oneOf": [
{
"title": "'attr:' directive",
"$id": "#/definitions/attr-directive",
"$$description": [
"Value is read from a module attribute. Supports callables and iterables;",
"unsupported types are cast via ``str()``"
],
"type": "object",
"additionalProperties": false,
"properties": {
"attr": {
"type": "string"
}
},
"required": [
"attr"
]
},
{
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
"description": "Value is read from a file (or list of files and then concatenated)",
"type": "object",
"additionalProperties": false,
"properties": {
"file": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"file"
]
}
]
},
"classifiers": {
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
"description": "Value is read from a file (or list of files and then concatenated)",
"type": "object",
"additionalProperties": false,
"properties": {
"file": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"file"
]
},
"description": {
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
"description": "Value is read from a file (or list of files and then concatenated)",
"type": "object",
"additionalProperties": false,
"properties": {
"file": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"file"
]
},
"dependencies": {
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
"description": "Value is read from a file (or list of files and then concatenated)",
"type": "object",
"additionalProperties": false,
"properties": {
"file": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"file"
]
},
"entry-points": {
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
"description": "Value is read from a file (or list of files and then concatenated)",
"type": "object",
"additionalProperties": false,
"properties": {
"file": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"file"
]
},
"optional-dependencies": {
"type": "object",
"propertyNames": {
"format": "python-identifier"
},
"additionalProperties": false,
"patternProperties": {
".+": {
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
"description": "Value is read from a file (or list of files and then concatenated)",
"type": "object",
"additionalProperties": false,
"properties": {
"file": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"file"
]
}
}
},
"readme": {
"anyOf": [
{
"$id": "#/definitions/file-directive",
"title": "'file:' directive",
"description": "Value is read from a file (or list of files and then concatenated)",
"type": "object",
"additionalProperties": false,
"properties": {
"file": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"file"
]
},
{
"properties": {
"content-type": {
"type": "string"
}
}
}
],
"required": [
"file"
]
}
}
}
Code of Conduct
- [X] I agree to follow the PSF Code of Conduct