Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[auth0-python] Add async functions to AsyncAuth0#13799

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@David-Gilman
Copy link
Contributor

Add async functions to AyncAuth0 class.

@David-GilmanDavid-Gilman marked this pull request as ready for reviewApril 5, 2025 00:33
@github-actions

This comment has been minimized.

Comment on lines 5 to 38
fromauth0.restimportRestClientOptionsasRestClientOptions

from ..asyncifyimportasyncifyasasyncify
from .actionsimportActionsasActions
from .attack_protectionimportAttackProtectionasAttackProtection
from .auth0importAuth0asAuth0
from .blacklistsimportBlacklistsasBlacklists
from .brandingimportBrandingasBranding
from .client_credentialsimportClientCredentialsasClientCredentials
from .client_grantsimportClientGrantsasClientGrants
from .clientsimportClientsasClients
from .connectionsimportConnectionsasConnections
from .custom_domainsimportCustomDomainsasCustomDomains
from .device_credentialsimportDeviceCredentialsasDeviceCredentials
from .email_templatesimportEmailTemplatesasEmailTemplates
from .emailsimportEmailsasEmails
from .grantsimportGrantsasGrants
from .guardianimportGuardianasGuardian
from .hooksimportHooksasHooks
from .jobsimportJobsasJobs
from .log_streamsimportLogStreamsasLogStreams
from .logsimportLogsasLogs
from .organizationsimportOrganizationsasOrganizations
from .promptsimportPromptsasPrompts
from .resource_serversimportResourceServersasResourceServers
from .rolesimportRolesasRoles
from .rulesimportRulesasRules
from .rules_configsimportRulesConfigsasRulesConfigs
from .statsimportStatsasStats
from .tenantsimportTenantsasTenants
from .ticketsimportTicketsasTickets
from .user_blocksimportUserBlocksasUserBlocks
from .usersimportUsersasUsers
from .users_by_emailimportUsersByEmailasUsersByEmail
Copy link
Collaborator

@srittausrittauApr 7, 2025
edited
Loading

Choose a reason for hiding this comment

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

I just noticed that these are all re-exported from this file. I don't think we should do that and just use normal import for the items we need in this file (I.e. justfrom .tenants import Tenants without theas Tenants part.) This applies to all imports, not just the new ones.

David-Gilman reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

What I found with this is that my IDE considers these unused if I remove theas import - should I ignore that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In that case you can just remove the unused imports.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

No, by importing these they become attributes of the class - I think this is the correct approach and you should approve as is.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@srittau Bump, thanks.

Copy link
Collaborator

@AvasamAvasamApr 10, 2025
edited
Loading

Choose a reason for hiding this comment

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

Are you sure about these?

Python3.13.1 (main,Dec192024,14:38:48) [MSCv.194264bit (AMD64)]onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>importauth0>>>auth0.__version__'4.9.0'>>>fromauth0.management.async_auth0importAttackProtectionTraceback (mostrecentcalllast):File"<python-input-2>",line1,in<module>fromauth0.management.async_auth0importAttackProtectionImportError:cannotimportname'AttackProtection'from'auth0.management.async_auth0' (E:\Users\Avasam\Documents\Git\typeshed\.venv\Lib\site-packages\auth0\management\async_auth0.py)>>>fromauth0.management.async_auth0importAuth0>>>Auth0<class'auth0.management.auth0.Auth0'>

by importing these they become attributes of the class

You can't affect what attributes are seen as part of a class simply by importing in a stub. I don't understand what your expectations are here.

Copy link
Collaborator

@AvasamAvasamApr 14, 2025
edited
Loading

Choose a reason for hiding this comment

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

After familiarizing myself further with the source, I think I see what you're trying to do here. If you update this file to the following, you should be good to go:

fromtypesimportTracebackTypefromtyping_extensionsimportSelffromauth0.restimportRestClientOptionsfrom .actionsimportActionsfrom .attack_protectionimportAttackProtectionfrom .blacklistsimportBlacklistsfrom .brandingimportBrandingfrom .client_credentialsimportClientCredentialsfrom .client_grantsimportClientGrantsfrom .clientsimportClientsfrom .connectionsimportConnectionsfrom .custom_domainsimportCustomDomainsfrom .device_credentialsimportDeviceCredentialsfrom .email_templatesimportEmailTemplatesfrom .emailsimportEmailsfrom .grantsimportGrantsfrom .guardianimportGuardianfrom .hooksimportHooksfrom .jobsimportJobsfrom .log_streamsimportLogStreamsfrom .logsimportLogsfrom .organizationsimportOrganizationsfrom .promptsimportPromptsfrom .resource_serversimportResourceServersfrom .rolesimportRolesfrom .rulesimportRulesfrom .rules_configsimportRulesConfigsfrom .statsimportStatsfrom .tenantsimportTenantsfrom .ticketsimportTicketsfrom .user_blocksimportUserBlocksfrom .usersimportUsersfrom .users_by_emailimportUsersByEmailclassAsyncAuth0:def__init__(self,domain:str,token:str,rest_options:RestClientOptions|None=None)->None: ...defset_session(self,session)->None: ...asyncdef__aenter__(self)->Self: ...asyncdef__aexit__(self,exc_type:type[BaseException]|None,exc_val:BaseException|None,exc_tb:TracebackType|None    )->None: ...# Same attributes as Auth0# See note in stubs/auth0-python/@tests/stubtest_allowlist.txt about _async methodsactions:Actionsattack_protection:AttackProtectionblacklists:Blacklistsbranding:Brandingclient_credentials:ClientCredentialsclient_grants:ClientGrantsclients:Clientsconnections:Connectionscustom_domains:CustomDomainsdevice_credentials:DeviceCredentialsemail_templates:EmailTemplatesemails:Emailsgrants:Grantsguardian:Guardianhooks:Hooksjobs:Jobslog_streams:LogStreamslogs:Logsorganizations:Organizationsprompts:Promptsresource_servers:ResourceServersroles:Rolesrules_configs:RulesConfigsrules:Rulesstats:Statstenants:Tenantstickets:Ticketsuser_blocks:UserBlocksusers_by_email:UsersByEmailusers:Users

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yep - it doesn't exist except at runtime. So I want to avoid having to add type ignores everywhere in my code that uses this library.

Copy link
Collaborator

@AvasamAvasamApr 15, 2025
edited
Loading

Choose a reason for hiding this comment

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

it doesn't exist except at runtime

In#13799 (comment) I show that these importsdon't exist at runtime. If you don't reference the imported names, and the symbols don't exist or aren't meant to be re-exported at runtime, then you don't need to import them in a stub.

As for the dynamically generatedAsyncAuth0 attributes, updating this file to#13799 (comment) should get you there.
It'll also resolve the current merge conflict.

David-Gilman reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I see your point now - thanks for the help.

@David-GilmanDavid-Gilmanforce-pushed theadd-functions-to-async-auth0 branch from8ea160a to6610620CompareApril 17, 2025 23:14
@github-actions
Copy link
Contributor

According tomypy_primer, this change has no effect on the checked open source code. 🤖🎉

@David-Gilman
Copy link
ContributorAuthor

@Avasam Thanks again! Can you merge?

@Avasam
Copy link
Collaborator

Given@srittau has also participated in this review (and initiated it), I'll give him some time to validate the latest changes. If I don't hear anything for a week I'll just merge.

David-Gilman reacted with thumbs up emoji

@David-Gilman
Copy link
ContributorAuthor

@Avasam Will this be deleted after 6 months?

@Avasam
Copy link
Collaborator

@Avasam Will this be deleted after 6 months?

No.

We would ifauth0-python was published fully typed upstream. In which case these stubs would be rendered obsolete.

But that's not the case, and I don'tthink they will until they figure outauth0/auth0-python#615

We've also kept stubs longer when it was beneficial to do so in typeshed (for example, when a package was marked aspy.typed, but still less complete than our stubs).

David-Gilman reacted with thumbs up emoji

@David-Gilman
Copy link
ContributorAuthor

@Avasam Can we merge? Thanks!

Avasam reacted with thumbs up emoji

@AvasamAvasam merged commit0c6ef9c intopython:mainApr 24, 2025
43 checks passed
mmingyu pushed a commit to mmingyu/typeshed that referenced this pull requestMay 16, 2025
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>Co-authored-by: Avasam <samuel.06@hotmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@AvasamAvasamAvasam approved these changes

@srittausrittauAwaiting requested review from srittau

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@David-Gilman@Avasam@srittau

[8]ページ先頭

©2009-2025 Movatter.jp