ros2 / ros2/ros2cli

`pkg create --build-type ament_python` should warn about hyphens in pkg-name

Open
#715 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Python
Stars
262
Forks
228
Avg merge
23h 15m
Merged PRs (30d)
12

Description

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • binaries
  • Version or commit hash:
    • humble
  • DDS implementation:
    • /
  • Client library (if applicable):
    • ros2cli
Steps to reproduce issue
cd src
ros2 pkg create --build-type ament_python --license MIT --node-name hello-world  hello-world-python-1   # build breaks
ros2 pkg create --build-type ament_python --license MIT --node-name hello_world  hello-world-python-2   # build breaks
ros2 pkg create --build-type ament_python --license MIT --node-name hello-world  hello_world_python_3   # build breaks
ros2 pkg create --build-type ament_python --license MIT --node-name hello_world  hello_world_python_4   # build works
cd ..
colcon build --packages-select hello-world-python-1 # breaks
colcon build --packages-select hello-world-python-2 # breaks
colcon build --packages-select hello_world_python_3 # breaks
colcon build --packages-select hello_world_python_4 # works
Expected behavior

When running ros2 pkg create with --build-type ament_python warn about hyphens in the name / or abort pkg creation.

Actual behavior

No warning

Additional information

Not really a bug of ros2cli but also not really a feature request. I'd expect a warning, thats why I put it as a bug report.
I assume the check can easily be added here.

If there is agreement on that, I can open a PR with it. Please let me know :)

For reference: PEP-8: Package and Module Names

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ros2pkg/ros2pkg/verb/create.py around the referenced package-creation logic, then reproduce the four commands in the issue to compare hyphenated and underscored names. Done means ament_python package creation clearly warns about or rejects hyphens, with the resulting behavior verified against the reported colcon build cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.