-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update packaging guide and repo-review to match spec13 #438
Conversation
f662ecd
to
9e16f26
Compare
@@ -241,5 +241,65 @@ def check(pyproject: dict[str, Any]) -> bool: | |||
return "filterwarnings" in options | |||
|
|||
|
|||
class PP310(PyProject): | |||
"Tests target is test not test (spec13)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Tests target is test not test (spec13)" | |
"Tests extra is `tests` not `test` (spec13)" |
?
|
||
|
||
class PP311(PyProject): | ||
"Tests target is `docs not` `doc` (spec13)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Tests target is `docs not` `doc` (spec13)" | |
"Tests target is `docs` not `doc` (SPEC13)" |
def check(pyproject: dict[str, Any]) -> bool | None: | ||
""" | ||
|
||
docs target should be `docs` not `doc` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs target should be `docs` not `doc` | |
docs extra should be `docs` not `doc` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I am not interested in having a check that goes against the official Python packaging specifications, which state test
and doc
are reserved for this. This means tools (like Hatch) can assume special meanings for these extras. IMO, SPECs are only for standardizing things not already standardized across Python, and so we can't enforce a SPEC over a the official core specification.
https://packaging.python.org/en/latest/specifications/core-metadata/#provides-extra-multiple-use
However, given that [docs]
is more popular, and I can't see any PEP source for that recommendation (other than PEPs stating it is the source of truth), I think we could see if it can be changed or removed, in which case such a check is fine.
Thanks for the review. Let's wait on the agreement on the spec and I'll update this. |
return len([p for p in package.iterdir() if "doc" in p.name]) > 0 | ||
|
||
|
||
class PY004b(General): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think a check can end in a letter. I think this could be merged into the PY004 check? Though some projects have multiple docs-*
folders, it's important not to error on those. Maybe just making sure /doc
doesn't exist is an option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it works :-)
├── PY003 Has a LICENSE* file ✅
├── PY004 Has docs folder ✅
├── PY004b Documentation folder should be `docs` not `doc` ❌
│ Projects must have documentation in a folder called docs not doc
One of my main concern was to not mark a project as "not having docs", and think of a plan to convey to projects that doc
used to be ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, interesting. I feel like I've encoded this somewhere. Maybe not.
I know there are not many tests yet, but there is a testing system set up if you want to add a couple of tests. |
if "tool" not in pyproject: | ||
return None | ||
if "project.optional-dependencies" not in pyproject["tool"]: | ||
return None | ||
optional_deps = pyproject["tool"]["project.optional-dependencies"] | ||
if "tests" in optional_deps: | ||
return True | ||
return "test" not in optional_deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if "tool" not in pyproject: | |
return None | |
if "project.optional-dependencies" not in pyproject["tool"]: | |
return None | |
optional_deps = pyproject["tool"]["project.optional-dependencies"] | |
if "tests" in optional_deps: | |
return True | |
return "test" not in optional_deps | |
match pyproject: | |
case {"tool": "project" { "optional-dependencies": {"tests": _}}}: | |
return True | |
case {"tool": "project" { "optional-dependencies": {"test": _}}}: | |
return False | |
case _: | |
return True |
Try pattern matching here. ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I need to practice more my pattern matching :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SPEC 0 should make that easier now. :)
closing for now to reduce noise in opened PRs. |
See scientific-python/specs#324