Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Improve semantics of library organization

Đang mở
#579 0 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với lean/components/util/library_manager.py, đặc biệt là is_lean_library(), cùng với các entry point project-create và library add trong lean/commands/create_project.py và lean/commands/library/add.py. Theo dõi cách các đường dẫn dự án và config.json được xử lý trước khi quyết định thiết lập thư viện tường minh nên tương tác như thế nào với logic Library/ hiện có. Hoàn tất nghĩa là các dự án thư viện có thể được xác định từ cấu hình và project-create hỗ trợ flag được đề xuất mà không chỉ dựa vào đường dẫn được hard-code.

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

Mô tả

Currently, the directory Library/ is treated as a hard-coded special case by the lean project-create and lean library add commands. Given that projects list the names and paths of their library dependencies and that libraries also have config.json files, it seems that dropping the hard-coded value in favor of more explicit settings/flags would be cleaner and allow users more flexibility for code organization.

This assumes that the runtime doesn't treat Library/paths as special, which I have not checked.

Current status:
is_lean_library() checks whether the argument to library add starts with "Library/" to determine its return value, and this is what the library add command uses to determine whether to add a local library or to install from pypi/nuget.

The docs say to use project-create to create a new library. [project_create] looks at whether the path to the project contains "Library/" and if so, uses the library template and puts it in Library.py (instead of main.py with the usual algo contents)
https://github.com/QuantConnect/lean-cli/blob/master/lean/commands/create_project.py#L428-L434
https://github.com/QuantConnect/lean-cli/blob/master/lean/commands/create_project.py#L455-L457

Proposed changes:

  • introduce an argument to project-create, --library to indicate that the project is intended to be a library
  • when "Library/" is in the path according to current logic, but --library is not set to true, emit warning log message
  • is_library_project = is-library-arg OR current logic
  • modify project-create so that it also sets is-library in config.json when creating a library
  • modify is_lean_library() in to use the field in the config rather than the path

Optional / nice-to-have changes:

  • introduce library-create command, analogous to project-create, but for creating libraries
  • factor out common logic between the two commands
  • add a deprecation warning log message to project-create in the library-creation path
  • introduce an argument to the library add to explicitly indicate whether the library is local or to be installed from pypi/nuget
Ngôn ngữ chính
Python
Star
326
Fork
168
Merge trung bình
3 ngày 50 phút
Pull request đã merge (30 ngày)
3

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 QuantConnect/lean-cli

Tất cả issue của QuantConnect/lean-cli

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.