Skip to content

Conversation

@henryiii
Copy link
Collaborator

@henryiii henryiii commented Oct 20, 2025

Adding support for PEP 794. (Inspired by pypa/packaging#948)

Also in SchemaStore/schemastore#5077 and pypa/pyproject-metadata#260.

Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
@henryiii henryiii force-pushed the henryiii/feat/pep794 branch from 097518f to 2f7c82d Compare October 27, 2025 21:45
Signed-off-by: Henry Schreiner <[email protected]>
@henryiii henryiii marked this pull request as ready for review October 28, 2025 02:56
Copy link
Owner

@abravalheri abravalheri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much Henry

Comment on lines +113 to +125
duplicated = [k for k, v in (import_names + import_namespaces).items() if v > 1]

if duplicated:
raise ImportNameCollision(
message="Duplicated names are not allowed in import-names/import-namespaces",
value=duplicated,
name="data.project.importnames(paces)",
definition={
"description": cleandoc(ImportNameCollision._DESC),
"see": ImportNameCollision._URL,
},
rule="PEP 794",
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the duplication check can be added to the JSONSchema itself, by leveraging uniqueItems.

There is variability around \s*;\s*private, so the check would not be 100% perfect (so the extra validation may still be needed), but it would make the JSON schema more useful on its own.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do quite a bit more with the schema itself, and that's done in the SchemaStore version of the project table. For example, "dynamic" checking can be done via the schema. For this PR, the regex can be implemented too, so that the "format" only would add keyword checking. But I'd assume if you want these, you could use the SchemaStore versions, instead of pulling these out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there's not a way to makes sure it's unique across multiple arrays?

@henryiii henryiii merged commit 7598ddb into abravalheri:main Nov 6, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants