[BUG] crewai create flow builds a project that cannot be imported for names like "News v2.0"

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

Maintainer thường phản hồi trong vòng 1 ngày

@Kiko0301 đang làm issue này rồi.

Từ ngày 25/11/2026.

  • #9765 của @Kiko0301 — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
30/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả 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

Read create_flow in lib/cli/src/crewai_cli/create_flow.py next to create_folder_structure in lib/cli/src/crewai_cli/create_crew.py, which already does the sanitising and rejection you want to mirror. Then open the templates under lib/cli/src/crewai_cli/templates/flow/ (main.py, pyproject.toml) to confirm the folder name is used as the package. Done means lib/cli/tests/test_create_flow.py no longer pins news_v2.0 and instead covers a stripped name plus a click.BadParameter rejection. Note a pull request (#9765) is already open against this issue, so check it before starting.

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

Mô tả

Description

crewai create flow derives the project's folder name with only two replacements:

    folder_name = name.replace(" ", "_").replace("-", "_").lower()

(lib/cli/src/crewai_cli/create_flow.py, in create_flow). That folder name is used verbatim as the Python package of the generated project:

  • lib/cli/src/crewai_cli/templates/flow/main.py:8 - from {{folder_name}}.crews.content_crew.content_crew import ContentCrew
  • lib/cli/src/crewai_cli/templates/flow/pyproject.toml - [project].name = "{{folder_name}}" and every [project.scripts] entry point ({{folder_name}}.main:kickoff, ...)

Any character a Python module name cannot hold therefore produces a project that cannot be imported. create_flow still prints Flow <name> created successfully! and exits 0.

create_crew (lib/cli/src/crewai_cli/create_crew.py::create_folder_structure) already handles this: after the same replacements it strips every other character (re.sub(r"[^a-zA-Z0-9_]", "", folder_name)) and rejects names that still cannot be a module name (empty, digit-first, keyword).

Steps to Reproduce

$ crewai create flow "News v2.0" --skip-provider
Creating flow news_v2.0...
Flow News v2.0 created successfully!
...
$ cd news_v2.0
$ python -c "import news_v2.0.main"
  File ".../news_v2.0/src/news_v2.0/main.py", line 8
    from news_v2.0.crews.content_crew.content_crew import ContentCrew
         ^^^^^^^^^
SyntaxError: invalid syntax

crewai create flow '!!!' creates a project in a folder literally named !!! whose main.py contains from !!!.crews...; crewai create flow '123bad' creates 123bad/ with an import starting with a digit. All three report success with exit status 0.

The same behavior is currently pinned by lib/cli/tests/test_create_flow.py::test_create_flow_returns_the_folder_it_created, which asserts the folder is news_v2.0.

Expected Behavior

crewai create flow should derive the folder/package name the same way crewai create crew does - dropping characters a Python module name cannot contain - and reject a name that cannot become a module name (with click.BadParameter, like the existing --provider validation) instead of writing a project that fails on its first import and reporting success.

AI assistance

I used an AI coding agent to investigate, reproduce, and prepare this report, and reviewed its results. Per CONTRIBUTING.md, please apply the llm-generated label; external contributors cannot add it with my current permissions.

Ngôn ngữ chính
Python
Star
61.2k
Fork
9.2k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
180

Chuẩn bị môi trường

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 crewAIInc/crewAI

Tất cả issue của crewAIInc/crewAI

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.