-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving default for project_slug
#127
Comments
Just so you know where that came from https://github.com/audreyfeldroy/cookiecutter-pypackage/blob/7696a30f4fb66c6c87815c51e12e7c7e3985e844/cookiecutter.json#L6 |
I seem to remember we discussed this in hackday 3...? Or am I misremembering? I think the choice to have "Project name" → Napari and pytest extensions do this, e.g.
Or do I misunderstand your comment, Matt? +1 to this...
If the name is taken then our user should think of a different name. (Since we specifically want to encourage the distribution of research code.) |
I agree with @samcunliffe here - you see those examples everywhere. Whilst |
https://pypi.org/project/pkg-name-validator/ Looks like it does what we want. Even better if we could find a premade pre-generate hook to do this. Feels like someone must have... |
This might be where I'm misunderstanding things, but I thought the current set up is such that the |
But the replacements there are different from what we have right? Theirs:
versus our
So we replace space and underscores with hyphens while they replace spaces and hyphens with underscores (which would give a valid package / module name). |
I think some of the confusion here might be in what we are referring to as a package. I would refer to the package as the importable directory containing an https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/glossary.html#term-package I've been assuming what determines the name on PyPI is the distribution not package but I'm not sure on this point and it seems there is an inherent level of inconsistency in all of this |
It is very possible there are mistakes. Not sure if the cookiecutter tests this thing - they should. |
Bug!
|
Ah and we don't test for it, because we give the project slug directly without spaces in the test. → now a failing test in 9151ae5 |
Cheers @matt-graham. Good spot. --------- Co-authored-by: Patrick Roddy <[email protected]>
I think the default for
project_slug
could possibly be improved - specifically I'm not sure replacing spaces and underscores inproject_name
with hyphens gives a good model of what this should be as to be a valid package or module name we cannot have hyphens and to align with PEP8 recommendations we shouldn't have underscores in the package name either.Originally posted by @matt-graham in #108 (comment)
Somewhat relatedly I wonder if we should also add a pre-generate hook to check whether the
project_slug
chosen conflicts with an existing package (distribution) on PyPI (probably just warning the user rather than preventing this being possible).The text was updated successfully, but these errors were encountered: