Cover PEP 420 namespace packages in "Creating and discovering plugins" guide

Đang mở
#1,104 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tài liệu
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu với phần “Using namespace packages” trong hướng dẫn Creating and discovering plugins, sau đó so sánh ví dụ của phần này với PEP 420 và packaging namespace-packages guide. Làm rõ liệu các hướng dẫn hiện tại mô tả native hay pkg-style namespaces, đồng thời ghi lại một ví dụ native namespace tối thiểu và chính xác nếu phù hợp. Được xem là hoàn tất khi hướng dẫn không còn mâu thuẫn với PEP 420 và giải thích trường hợp không có plugin.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

component: guides type: enhancement

Using namespace packages is not explicit whether it talks about native PEP 420 namespace packages, or pkg-style namespace packages.

I tried to apply it for PEP 420 namespace packages and stumbled over two issues:

First, the given example doesn't wrap import myapp.plugin in try/except, but actually ModuleNotFoundError should be handled because, as a core package maintainer, you can't know how many plugins will be installed at runtime. In case of zero plugins installed, how would you guarantee a myapp.plugins namespace will exists anyways? At least setuptools won't let you install empty directories.

Second, the guide says

include the namespace-package style init.py in the namespace sub-package directory

But PEP 420 explicitly requires the absence of __init__.py files. Then, what is a namespace-package style __init__.py in the context of PEP 420? I believe @theacodes had pkg-style namespace packages in mind when adding that sentence with #296.

Could we make it either more clear the guide is not 1:1 applicable for native namespace packages, or even better, find a suggested minimal working PEP 420 example and adapt the guide accordingly?

Ngôn ngữ chính
Python
Star
1.7k
Fork
1.7k
Merge trung bình
3 ngày 12 giờ
Pull request đã merge (30 ngày)
4

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pypa/packaging.python.org

Tất cả issue của pypa/packaging.python.org

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.