ros2cli icon indicating copy to clipboard operation
ros2cli copied to clipboard

feat (pkg): don't allow hyphen in python pkg name

Open krsche opened this issue 3 years ago • 3 comments

fixes #715

As @clalancette suggested to block creation of python pkgs with hyphens in the name I didn't implement a warning, but block them by returning early. Similar to what was being done for pkgs names test.

I didn't test this change locally as I didn't find instructions on how to install from source and it's such a minor change. Are there any instructions for installing from source / executing?

Should I add a unit test somewhere?

krsche avatar May 25 '22 18:05 krsche

Thanks for your review, I'll address your points tomorrow.

Regarding the pep-8 reference - I thought of that while writing as well.. It's more complicated though because technically calling my_module = __import__('my-module') should work while import my-module doesn't. But I've never seen that explicit __import__(...) call anywhere so I'd still say forbid it.
Also it probably would require quite some adjustment in the cli to make it work with ros2 run...

Should I just remove the pep-8 reference then?

krsche avatar May 25 '22 22:05 krsche

Also it probably would require quite some adjustment in the cli to make it work with ros2 run...

True, and I don't think it's worth the time trying to make that pathological case work.

Should I just remove the pep-8 reference then?

:+1:

aprotyas avatar May 26 '22 04:05 aprotyas

Ok, will do. I won't get to it until next week though

krsche avatar May 26 '22 18:05 krsche