-
-
Save podhmo/33ac3fed4e575075755d9c5b9f0f9215 to your computer and use it in GitHub Desktop.
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
def run(): | |
from flake8.options.parse_args import parse_args | |
plugins, namespace = parse_args([]) | |
print("plugins") | |
for p in plugins: | |
print("\t", p) | |
print("") | |
print("namespace") | |
print("\t", namespace) | |
def run2(): | |
from flake8.utils import normalize_pypi_name | |
from flake8.plugins.finder import _find_importlib_plugins | |
plugins = list(_find_importlib_plugins()) | |
for p in plugins: | |
L = [normalize_pypi_name(p.package), p.entry_point.name, p.entry_point.value] | |
print("\t".join(L)) | |
def run3(): | |
from importlib import metadata | |
m = metadata.distribution("flake8-soft-keywords") | |
filename = "entry_points.txt" | |
print(m.locate_file(filename)) | |
print(m._path.joinpath(filename)) | |
print(m.read_text(filename)) | |
print(m.entry_points) | |
run() |
locate_fileが壊れてたように見えたけど、filesを呼んだときも壊れてる?
locate_fileの使い方が違うのか。Distribution#files
の結果とかを見ながらこれをfilepathに変換するときに使うのか。PackagePathをPosixPathなどに変換する。 d.locate_file(d.files[0])
ここで PackagePath("pip/__init__.py")
みたいな感じになるので。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
entry pointsを見つけるやつ
poetnry install
を忘れててハマった