Skip to content
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

Allow package name to be customized via a generator option #605

Closed
busunkim96 opened this issue Sep 18, 2020 · 0 comments · Fixed by #717 or #1133
Closed

Allow package name to be customized via a generator option #605

busunkim96 opened this issue Sep 18, 2020 · 0 comments · Fixed by #717 or #1133
Assignees
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@busunkim96
Copy link
Contributor

@property
def warehouse_package_name(self) -> str:
"""Return the appropriate Python package name for Warehouse."""
# Piece the name and namespace together to come up with the
# proper package name.
answer = list(self.namespace) + self.name.split(' ')
return '-'.join(answer).lower()

Occasionally we want to deviate from the generated provided api.naming.warehouse_package_name.

  • The published package includes two GAPICs (firestore admin and firestore) and we want the library to be consistently named google-cloud-firestore.
  • The API has a long name and we want to rename the package to make it easier to spell.
    google-cloud-assuredworkloads -> google-cloud-assured-workloads.

The name is used to identify the library in request headers so it is somewhat important.

DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
'{{ api.naming.warehouse_package_name }}',
).version,
)

CC @crwilcox

@busunkim96 busunkim96 added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Sep 18, 2020
gcf-merge-on-green bot pushed a commit that referenced this issue Dec 22, 2020
Allow warehouse name (package name in `setup.py`) to be customized via a CLI option.

This is a pretty common reason for a `synth.py` regex replace:
- One repo has more than one API (e.g., Bigtable and Bigtable Admin) but the package name should always be `google-cloud-bigtable`
- We want an extra `-` in the repo name and package name to make it easier to read and type. (`google-cloud-binaryauthorization` -> `google-cloud-binary-authorization`)
- Package name constructed from the namespace doesn't match the `google-cloud-{API}` convention (`google-cloud-devtools-containeranalysis` -> `google-cloud-containeranalysis`)

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