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

Merged
merged 2 commits into from Oct 3, 2016

Conversation

Projects
None yet
3 participants
@goodwillcoding
Member

goodwillcoding commented Oct 3, 2016

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

Add --package-name option to pcreate. 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
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('-', '_'))

This comment has been minimized.

@mmerickel

mmerickel Oct 3, 2016

Member

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.

@mmerickel

mmerickel Oct 3, 2016

Member

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.

This comment has been minimized.

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

That's existing code though, unmodified.

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

That's existing code though, unmodified.

This comment has been minimized.

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

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

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

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

This comment has been minimized.

@mmerickel

mmerickel Oct 3, 2016

Member

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?

@mmerickel

mmerickel Oct 3, 2016

Member

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?

This comment has been minimized.

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

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.

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

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.

This comment has been minimized.

@mmerickel

mmerickel Oct 3, 2016

Member

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.

@mmerickel

mmerickel Oct 3, 2016

Member

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.

This comment has been minimized.

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

Fixed verbiage, and pushed.

@goodwillcoding

goodwillcoding Oct 3, 2016

Member

Fixed verbiage, and pushed.

update pcreate --package-name help with better verbiage which
more explicitly states that package name is assumed to be safe

@bertjwregeer bertjwregeer merged commit 11cbc8f into Pylons:master Oct 3, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bertjwregeer

This comment has been minimized.

Show comment
Hide comment
@bertjwregeer

bertjwregeer Oct 3, 2016

Member

Thanks!

Member

bertjwregeer commented Oct 3, 2016

Thanks!

bertjwregeer added a commit to bertjwregeer/pyramid that referenced this pull request Oct 3, 2016

bertjwregeer added a commit to bertjwregeer/pyramid that referenced this pull request Oct 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment