-
Notifications
You must be signed in to change notification settings - Fork 886
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
Add --package-name option to pcreate. #2783
Add --package-name option to pcreate. #2783
Conversation
of scaffold creating an existing directory where the package created should not be named after the base folder. For example if I am in I run pcreate in ~/code/trypyramid.com and would like to create package called tpc this is currently impossible. This solves the issues by allowing me to specify the package name on the command line
safe_name = pkg_resources.safe_name(project_name) | ||
if self.options.package_name is None: | ||
pkg_name = _bad_chars_re.sub( | ||
'', project_name.lower().replace('-', '_')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this code not run on the project name if --package-name
is not specified? It seems the pkg_name
should be normalized in one spot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's existing code though, unmodified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only change is if package name is given it is assumed to be safe and hence assigned in the else block. The assumption of safety is documented in help for pcreate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I read that test wrong, I thought it was is not None
. So are we not validating the package name if you specify --package-name
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not validating it. Rationale being: if user provide the package name then it's a case where they want a specific one and hence need to know if it is safe. I can add validation of course if you think it is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the assumption of safety documented? I don't get that from reading the help. Maybe rephrase that sentence slightly because I think has to be a valid python package name
implies that it will be validated. Perhaps Assumed to be a valid python package name
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed verbiage, and pushed.
more explicitly states that package name is assumed to be safe
Thanks! |
This solves the problem of scaffold creating an existing directory where the package created should not be named after the base folder. For example if I am in I run pcreate in ~/code/trypyramid.com and
would like to create package called tpc this is currently impossible. This solves the issues by allowing me to specify the package name on the command line.
Note: I'll add changelog changes post review