Import order causes warnings when working with epicscorelibs and softioc
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 32/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện ví dụ về thứ tự import trong test_imports.py, sau đó đọc epicscorelibs/path/cothread.py và softioc/init.py tại các vị trí được liên kết. So sánh cách cothread.catools và softioc khởi tạo các dependency của chúng, và xác định hoàn thành là tránh cảnh báo và yêu cầu thứ tự import không an toàn mà không làm hỏng bất kỳ đường dẫn import nào trong hai đường dẫn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
As epicscorelibs maintains its own libca, it provides the option to set the 'CATOOLS_LIBCA_PATH' before using cothread. This can be found here. This mechanism does not appear to be ideal.
For example, softioc uses this mechanism here. The problem comes when another program attempts to use both softioc and cothread itself. A simple program such as the following:
#! /usr/bin/env python3
import cothread.catools
import softioc
will result in the following error (and potentially problematic behaviour):
$ ./test_imports.py
/path/to/pipenv/environment/lib/python3.7/site-packages/epicscorelibs/path/cothread.py:18: UserWarning: epicscorelibs.path.cothread must be imported before cothread.catools to have effect
warnings.warn("epicscorelibs.path.cothread must be imported before cothread.catools to have effect")
There are two problems:
- It is not immediately clear what is causing the error
- If using standard tools such as isort, you need to manually force a particular order of imports to avoid this error. You need to
isort:skipmultiple lines of code
I am not sure why cothread does not use epicscorelibs by default. Would it be possible to implement this?
Alternatively, some kind of conditional import of epicscorelibs could be useful.
- Ngôn ngữ chính
- C
- Star
- 13
- Fork
- 12
- Merge trung bình
- 6 giờ 21 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DiamondLightSource/cothread
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 30/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
DiamondLightSource/cothread#78 · 2 bình luận ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
DiamondLightSource/cothread#75 · 5 bình luận ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
DiamondLightSource/cothread#73 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Tất cả issue của DiamondLightSource/cothread
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
c easy first-contributor first-contributors good first issue help wanted up-for-grabs
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 96/100
fork-commit-merge/fork-commit-merge#8696 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
libsdl-org/SDL#16873 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cwc.kbd.xkb_layout/xkb_options changes are not applied to all keyboard groups after reload/runtimeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ionut-mihalache/aqua#31 · 1 bình luận ·