Skip to content

feat: create alias alloydbconnector package#451

Merged
rhatgadkar-goog merged 11 commits into
mainfrom
alias-package
May 9, 2025
Merged

feat: create alias alloydbconnector package#451
rhatgadkar-goog merged 11 commits into
mainfrom
alias-package

Conversation

@rhatgadkar-goog

@rhatgadkar-goog rhatgadkar-goog commented May 6, 2025

Copy link
Copy Markdown
Collaborator

This PR creates a new package: google.cloud.alloydbconnector, which is an alias to google.cloud.alloydb.connector. The implementation resides in google.cloud.alloydbconnector, and google.cloud.alloydb.connector points to it.
So importing google.cloud.alloydbconnector is the same as importing google.cloud.alloydb.connector.

This PR aims to fix googleapis/google-cloud-python#13871, where a PEX environment, containing google-cloud-alloydb and alloydb-python-connector packages, fails to import google.cloud.alloydb.connector, because it attempts to find a connector/ directory under the google-cloud-alloydb package, which does not exist. The fix is that the user should import the google.cloud.alloydbconnector package instead.

This PR also updates the README and integration tests to mention importing google.cloud.alloydbconnector instead of google.cloud.alloydb.connector. This serves as documentation so that new users of the library will instead import google.cloud.alloydbconnector. Existing users can continue to import google.cloud.alloydb.connector without any issues.

@rhatgadkar-goog rhatgadkar-goog marked this pull request as ready for review May 7, 2025 19:18
@rhatgadkar-goog rhatgadkar-goog requested a review from a team as a code owner May 7, 2025 19:18
@rhatgadkar-goog rhatgadkar-goog requested a review from enocom May 7, 2025 19:18
Comment thread README.md Outdated
Comment thread tests/system/test_asyncpg_connection.py Outdated
@rhatgadkar-goog rhatgadkar-goog requested a review from enocom May 7, 2025 21:25

@enocom enocom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@enocom

enocom commented May 7, 2025

Copy link
Copy Markdown
Member

@jackwotherspoon would you mind taking a quick pass on this?

@enocom enocom requested a review from jackwotherspoon May 7, 2025 21:37
Comment thread README.md Outdated
@rhatgadkar-goog rhatgadkar-goog changed the title feat: create alias alloydb_connector package feat: create alias alloydbconnector package May 9, 2025
@rhatgadkar-goog rhatgadkar-goog merged commit 14509e8 into main May 9, 2025
15 checks passed
@rhatgadkar-goog rhatgadkar-goog deleted the alias-package branch May 9, 2025 21:08
@jackwotherspoon

Copy link
Copy Markdown
Collaborator

This naming of alloydbconnector is a really bad idea in my mind.

When readability is improved, underscores can be used to separate words. - PEP 8

In my mind this is a clear case where readability is improved by having the package name google.cloud.alloydb_connector

@rhatgadkar-goog

Copy link
Copy Markdown
Collaborator Author

This naming of alloydbconnector is a really bad idea in my mind.

When readability is improved, underscores can be used to separate words. - PEP 8

In my mind this is a clear case where readability is improved by having the package name google.cloud.alloydb_connector

That makes sense. But I don't think the google cloud python repo has strict guidelines on this. So I think it's okay if we keep this change to have the package name without underscores. For example, The org-policy package name is not separated with underscores: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-org-policy/google/cloud.

@jackwotherspoon

Copy link
Copy Markdown
Collaborator

That makes sense. But I don't think the google cloud python repo has strict guidelines on this. So I think it's okay if we keep this change to have the package name without underscores. For example, The org-policy package name is not separated with underscores: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-org-policy/google/cloud.

Just because "X" does it does not mean it is the right way.

LangChain integrations are using underscores... https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/src/langchain_google_cloud_sql_pg

@rhatgadkar-goog

Copy link
Copy Markdown
Collaborator Author

That makes sense. But I don't think the google cloud python repo has strict guidelines on this. So I think it's okay if we keep this change to have the package name without underscores. For example, The org-policy package name is not separated with underscores: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-org-policy/google/cloud.

Just because "X" does it does not mean it is the right way.

LangChain integrations are using underscores... https://github.com/googleapis/langchain-google-cloud-sql-pg-python/tree/main/src/langchain_google_cloud_sql_pg

Alright. I'll change the package name to alloydb_connector to maintain consistency in naming formats between AlloyDB and CloudSQL.

@enocom

enocom commented May 14, 2025

Copy link
Copy Markdown
Member

For posterity, we stuck with alloydbconnector.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

google.cloud.alloydb PEP 420 namespace issue

3 participants