plotly / dash-component-boilerplate

Get started creating your own Dash components here.
265 stars 182 forks source link

Module names are too restrictive #127

Open tfcollins opened 3 years ago

tfcollins commented 3 years ago

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

alexcjohnson commented 3 years ago

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.

tfcollins commented 3 years ago

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

elda27 commented 2 years ago

Any update here?