-
Notifications
You must be signed in to change notification settings - Fork 126
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
migrate to hatch + move importlib hacks to own module for typing #362
Open
RonnyPfannschmidt
wants to merge
7
commits into
pytest-dev:main
Choose a base branch
from
RonnyPfannschmidt:try-hatch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+181
−202
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
32c3fe7
pre-commit updates
RonnyPfannschmidt 69355a9
drop python 3.6 from github
RonnyPfannschmidt c366701
use explicit language for docs
RonnyPfannschmidt e24c6a6
harden readthedocs config to prepare hatch migration
RonnyPfannschmidt 49056c4
split importlib into own submodule for better typing
RonnyPfannschmidt a6a8a21
drop python3.6 from tox.ini and prepare isolated builds
RonnyPfannschmidt 2c8248d
migrate to hatch
RonnyPfannschmidt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
|
||
build: | ||
os: "ubuntu-20.04" | ||
tools: | ||
python: "3.10" | ||
|
||
sphinx: | ||
configuration: docs/conf.py | ||
|
||
python: | ||
install: | ||
- method: pip | ||
path: . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,12 +1,69 @@ | ||||||||||||||||||
[build-system] | ||||||||||||||||||
requires = [ | ||||||||||||||||||
"setuptools", | ||||||||||||||||||
"setuptools-scm", | ||||||||||||||||||
"wheel", | ||||||||||||||||||
"hatchling>=1.3.1", | ||||||||||||||||||
"hatch-vcs", | ||||||||||||||||||
] | ||||||||||||||||||
build-backend = "hatchling.build" | ||||||||||||||||||
|
||||||||||||||||||
[project] | ||||||||||||||||||
name = "pluggy" | ||||||||||||||||||
description = "plugin and hook calling mechanisms for python" | ||||||||||||||||||
readme = "README.rst" | ||||||||||||||||||
license = "MIT" | ||||||||||||||||||
requires-python = ">=3.7" | ||||||||||||||||||
authors = [ | ||||||||||||||||||
{ name = "Holger Krekel", email = "[email protected]" }, | ||||||||||||||||||
] | ||||||||||||||||||
classifiers = [ | ||||||||||||||||||
"Development Status :: 6 - Mature", | ||||||||||||||||||
"Intended Audience :: Developers", | ||||||||||||||||||
"License :: OSI Approved :: MIT License", | ||||||||||||||||||
"Operating System :: MacOS :: MacOS X", | ||||||||||||||||||
"Operating System :: Microsoft :: Windows", | ||||||||||||||||||
"Operating System :: POSIX", | ||||||||||||||||||
"Programming Language :: Python :: 3", | ||||||||||||||||||
"Programming Language :: Python :: 3 :: Only", | ||||||||||||||||||
"Programming Language :: Python :: 3.7", | ||||||||||||||||||
"Programming Language :: Python :: 3.8", | ||||||||||||||||||
"Programming Language :: Python :: 3.9", | ||||||||||||||||||
"Programming Language :: Python :: Implementation :: CPython", | ||||||||||||||||||
"Programming Language :: Python :: Implementation :: PyPy", | ||||||||||||||||||
"Programming Language :: Python :: 3.10", | ||||||||||||||||||
Comment on lines
+28
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
"Topic :: Software Development :: Libraries", | ||||||||||||||||||
"Topic :: Software Development :: Testing", | ||||||||||||||||||
"Topic :: Utilities", | ||||||||||||||||||
] | ||||||||||||||||||
dependencies = [ | ||||||||||||||||||
"importlib-metadata>=0.12;python_version<\"3.8\"", | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think can use
Suggested change
|
||||||||||||||||||
] | ||||||||||||||||||
dynamic = [ | ||||||||||||||||||
"version", | ||||||||||||||||||
] | ||||||||||||||||||
|
||||||||||||||||||
[project.optional-dependencies] | ||||||||||||||||||
dev = [ | ||||||||||||||||||
"pre-commit", | ||||||||||||||||||
"tox", | ||||||||||||||||||
] | ||||||||||||||||||
testing = [ | ||||||||||||||||||
"pytest", | ||||||||||||||||||
"pytest-benchmark", | ||||||||||||||||||
] | ||||||||||||||||||
|
||||||||||||||||||
[project.urls] | ||||||||||||||||||
Homepage = "https://github.com/pytest-dev/pluggy" | ||||||||||||||||||
|
||||||||||||||||||
[tool.hatch.version] | ||||||||||||||||||
source = "vcs" | ||||||||||||||||||
|
||||||||||||||||||
[tool.hatch.build.hooks.vcs] | ||||||||||||||||||
version-file = "src/pluggy/_version.py" | ||||||||||||||||||
|
||||||||||||||||||
[tool.hatch.build.targets.sdist] | ||||||||||||||||||
include = [ | ||||||||||||||||||
"/src", | ||||||||||||||||||
] | ||||||||||||||||||
|
||||||||||||||||||
[tool.setuptools_scm] | ||||||||||||||||||
write_to = "src/pluggy/_version.py" | ||||||||||||||||||
|
||||||||||||||||||
[tool.towncrier] | ||||||||||||||||||
package = "pluggy" | ||||||||||||||||||
|
@@ -15,42 +72,19 @@ filename = "CHANGELOG.rst" | |||||||||||||||||
directory = "changelog/" | ||||||||||||||||||
title_format = "pluggy {version} ({project_date})" | ||||||||||||||||||
template = "changelog/_template.rst" | ||||||||||||||||||
|
||||||||||||||||||
[[tool.towncrier.type]] | ||||||||||||||||||
directory = "removal" | ||||||||||||||||||
name = "Deprecations and Removals" | ||||||||||||||||||
showcontent = true | ||||||||||||||||||
|
||||||||||||||||||
[[tool.towncrier.type]] | ||||||||||||||||||
directory = "feature" | ||||||||||||||||||
name = "Features" | ||||||||||||||||||
showcontent = true | ||||||||||||||||||
|
||||||||||||||||||
[[tool.towncrier.type]] | ||||||||||||||||||
directory = "bugfix" | ||||||||||||||||||
name = "Bug Fixes" | ||||||||||||||||||
showcontent = true | ||||||||||||||||||
|
||||||||||||||||||
[[tool.towncrier.type]] | ||||||||||||||||||
directory = "vendor" | ||||||||||||||||||
name = "Vendored Libraries" | ||||||||||||||||||
showcontent = true | ||||||||||||||||||
|
||||||||||||||||||
[[tool.towncrier.type]] | ||||||||||||||||||
directory = "doc" | ||||||||||||||||||
name = "Improved Documentation" | ||||||||||||||||||
showcontent = true | ||||||||||||||||||
|
||||||||||||||||||
[[tool.towncrier.type]] | ||||||||||||||||||
directory = "trivial" | ||||||||||||||||||
name = "Trivial/Internal Changes" | ||||||||||||||||||
showcontent = true | ||||||||||||||||||
type = [ | ||||||||||||||||||
{ directory = "removal", name = "Deprecations and Removals", showcontent = true }, | ||||||||||||||||||
{ directory = "feature", name = "Features", showcontent = true }, | ||||||||||||||||||
{ directory = "bugfix", name = "Bug Fixes", showcontent = true }, | ||||||||||||||||||
{ directory = "vendor", name = "Vendored Libraries", showcontent = true }, | ||||||||||||||||||
{ directory = "doc", name = "Improved Documentation", showcontent = true }, | ||||||||||||||||||
{ directory = "trivial", name = "Trivial/Internal Changes", showcontent = true }, | ||||||||||||||||||
] | ||||||||||||||||||
|
||||||||||||||||||
[tool.mypy] | ||||||||||||||||||
python_version = "3.7" | ||||||||||||||||||
mypy_path = "src" | ||||||||||||||||||
check_untyped_defs = true | ||||||||||||||||||
# Hopefully we can set this someday! | ||||||||||||||||||
# disallow_any_expr = true | ||||||||||||||||||
disallow_any_generics = true | ||||||||||||||||||
disallow_any_unimported = true | ||||||||||||||||||
disallow_subclassing_any = true | ||||||||||||||||||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from __future__ import annotations | ||
|
||
import sys | ||
from typing import Callable, Iterable, Any | ||
|
||
if sys.version_info >= (3, 8): | ||
from importlib.metadata import distributions | ||
else: | ||
from importlib_metadata import distributions | ||
|
||
|
||
class DistFacade: | ||
"""Emulate a pkg_resources Distribution""" | ||
|
||
# turn Any to Distribution as soon as the typing details for them fit | ||
def __init__(self, dist: Any) -> None: | ||
self._dist = dist | ||
|
||
@property | ||
def project_name(self) -> str: | ||
name: str = self.metadata["name"] | ||
return name | ||
|
||
def __getattr__(self, attr: str, default: Any | None = None) -> Any: | ||
return getattr(self._dist, attr, default) | ||
|
||
def __dir__(self) -> list[str]: | ||
return sorted(dir(self._dist) + ["_dist", "project_name"]) | ||
|
||
|
||
def iter_entrypoint_loaders( | ||
group: str, name: str | None | ||
) -> Iterable[tuple[DistFacade, str, Callable[[], object]]]: | ||
for dist in list(distributions()): | ||
legacy = DistFacade(dist) | ||
for ep in dist.entry_points: | ||
if ep.group == group and name is None or name == ep.name: | ||
yield legacy, ep.name, ep.load |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
To match the one above: