dash-component-boilerplate icon indicating copy to clipboard operation
dash-component-boilerplate copied to clipboard

Module names are too restrictive

Open tfcollins opened this issue 3 years ago • 3 comments

https://github.com/plotly/dash-component-boilerplate/blob/c59567cad7b6936720af1b19a9141af424efffc2/hooks/pre_gen_project.py#L27

I think this check is too restrictive as Python modules should be able to contain numbers just not start with them. PEP8 isn't super clear though: https://www.python.org/dev/peps/pep-0008/#package-and-module-names

tfcollins avatar May 01 '21 17:05 tfcollins

Good catch @tfcollins - we should certainly accept numbers after the first character. Feel like making a PR?

In fact I don't think even the lowercase restriction is necessary, just conventional. I believe any Python identifier is valid as a module name, ie [a-zA-Z_][a-zA-Z0-9_]*. That said I don't see any prominent examples of uppercase letters in module names whereas numbers do appear from time to time, so just adding numbers is probably the right thing to do here.

alexcjohnson avatar May 03 '21 18:05 alexcjohnson

I'll try to put together a PR in a few days. Based on my reading a PEP8 I'll change the check to assume all lowercase, cannot start with a number, and underscores cannot be on either end of name.

-Travis

tfcollins avatar May 03 '21 18:05 tfcollins

Any update here?

elda27 avatar Feb 10 '22 14:02 elda27