Skip to content

Conversation

@ajworkos
Copy link
Contributor

@ajworkos ajworkos commented Jul 31, 2025

Description

Aligns our python SDK with out Go and Node SDKs by adding a separate organization_domains module

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[x] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

https://github.com/workos/workos/pull/42288

@ajworkos ajworkos force-pushed the add-organization-domains-module branch from ad93796 to b0c5e71 Compare July 31, 2025 16:51
@ajworkos ajworkos marked this pull request as ready for review July 31, 2025 16:52
@ajworkos ajworkos requested a review from a team as a code owner July 31, 2025 16:52
@ajworkos ajworkos requested a review from amygdalama July 31, 2025 16:52
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR creates a dedicated organization_domains module to align the Python SDK architecture with the Go and Node.js SDKs. The change extracts organization domain functionality from the broader organizations module into its own specialized module, following the principle of separation of concerns.

The implementation includes:

  • A new OrganizationDomainsModule with CRUD operations (get_organization_domain, create_organization_domain, verify_organization_domain, delete_organization_domain)
  • Both synchronous and asynchronous client implementations following established patterns
  • Proper Protocol definition for type safety
  • Updates to base client classes to expose the new module via an organization_domains property
  • Migration of the OrganizationDomain type from workos.types.organizations to workos.types.organization_domains
  • Comprehensive test coverage matching existing testing patterns

The refactoring maintains backward compatibility at the API level while reorganizing the internal module structure. All import paths have been updated throughout the codebase to reference the new module location. The new module follows the same lazy initialization pattern used by other modules, where the module instance is created only when first accessed.

Confidence score: 3/5

  • This PR is generally safe to merge but has one incomplete refactoring that needs attention
  • The main issue is inconsistent cleanup in the organizations module where AsyncOrganizations still contains a delete_organization_domain method that should have been removed
  • The file workos/organizations.py needs more attention due to incomplete method removal and potential breaking changes for existing users

17 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment on lines 28 to 29
"created_at": datetime.datetime.now().isoformat(),
"updated_at": datetime.datetime.now().isoformat(),
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Using dynamic timestamps with datetime.now().isoformat() in test fixtures can cause flakiness. Consider using fixed timestamps for consistent test behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressing...

@ajworkos ajworkos force-pushed the add-organization-domains-module branch from b0c5e71 to d54a40d Compare July 31, 2025 16:55
@ajworkos
Copy link
Contributor Author

Regarding:

The file workos/organizations.py needs more attention due to incomplete method removal and potential breaking changes for existing users

The delete_organization_domain method on organizations was recently merged and unreleased, no breaking changes.

Copy link
Contributor

@mattgd mattgd left a comment

Choose a reason for hiding this comment

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

Left one minor comment, but otherwise looks good.

Comment on lines -131 to -142
def delete_organization_domain(
self, organization_domain_id: str
) -> SyncOrAsync[None]:
"""Deletes a single Organization Domain
Args:
organization_domain_id (str): Organization Domain unique identifier
Returns:
None
"""
...
Copy link
Contributor

Choose a reason for hiding this comment

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

Noting here that this is non-breaking because it was never released.

from .organization_common import *
from .organization_domain import *
from .organization import *
from workos.types.organization_domains import OrganizationDomain
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a little note that this import alias can be removed in a future major version bump?

@ajworkos ajworkos merged commit 4d69c55 into main Jul 31, 2025
6 checks passed
@ajworkos ajworkos deleted the add-organization-domains-module branch July 31, 2025 18:36
@ajworkos ajworkos mentioned this pull request Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants