template-python icon indicating copy to clipboard operation
template-python copied to clipboard

Python package name vs. module name

Open amotl opened this issue 4 years ago • 2 comments

Dear Jace,

thanks a stack for conceiving this excellent cookiecutter template. I just used it for the first time and found it to be very pleasant.

Just to give you a little feedback from my daily routine: I use to use package names often containing dashes, like sigrok-telemetry. That should be the official package name used within, for example, the name, homepage or documentation attributes within pyproject.toml.

However, in all other places where the package name converges to the Python module name, the dash should be replaced by an underscore, thus sigrok_telemetry would be correct there.

Is this anything you could take into consideration for the next iteration?

Thanks already and with kind regards, Andreas.

amotl avatar Feb 21 '21 20:02 amotl

Yeah, that makes sense!

I think it would be as simple as adding a new cookiecutter.json variable:

"package_name": "demo",
"package_folder": "{{ cookiecutter.package_name.replace('-', '_') }}",

and use package_folder in templates where appropriate.

jacebrowning avatar Feb 21 '21 21:02 jacebrowning

Ah, nice! Attaching to PEP 423 -- Naming conventions and recipes related to packaging, we might want to use the names package_name vs. module_name here in order to apply the right jargon. I've also amended the title to reflect this -- sorry for being ambiguous (naming-wise ;]) firsthand.

amotl avatar Feb 21 '21 21:02 amotl