Skip to content

[Python] Add __all__ variable in the package __init__.py file for Python APIs #21185

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

Merged
merged 3 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@

__version__ = "{{packageVersion}}"

# Define package exports
__all__ = [
{{#apiInfo}}{{#apis}}"{{classname}}",
{{/apis}}{{/apiInfo}}"ApiResponse",
"ApiClient",
"Configuration",
"OpenApiException",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiAttributeError",
"ApiException",
{{#hasHttpSignatureMethods}}"HttpSigningConfiguration",
{{/hasHttpSignatureMethods}}{{#models}}{{#model}}"{{classname}}"{{^-last}},
{{/-last}}{{#-last}},{{/-last}}{{/model}}{{/models}}
]

# import apis into sdk package
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}}
{{/apis}}{{/apiInfo}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@

__version__ = "{{packageVersion}}"

# Define package exports
__all__ = [
{{#apiInfo}}{{#apis}}"{{classname}}",
{{/apis}}{{/apiInfo}}"ApiResponse",
"ApiClient",
"Configuration",
"OpenApiException",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiAttributeError",
"ApiException",
{{#hasHttpSignatureMethods}}"HttpSigningConfiguration",
{{/hasHttpSignatureMethods}}{{#models}}{{#model}}"{{classname}}"{{^-last}},
{{/-last}}{{#-last}},{{/-last}}{{/model}}{{/models}}
]

# import apis into sdk package
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}}
{{/apis}}{{/apiInfo}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,37 @@

__version__ = "1.0.0"

# Define package exports
__all__ = [
"AuthApi",
"BodyApi",
"FormApi",
"HeaderApi",
"PathApi",
"QueryApi",
"ApiResponse",
"ApiClient",
"Configuration",
"OpenApiException",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiAttributeError",
"ApiException",
"Bird",
"Category",
"DataQuery",
"DefaultValue",
"NumberPropertiesOnly",
"Pet",
"Query",
"StringEnumRef",
"Tag",
"TestFormObjectMultipartRequestMarker",
"TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter",
"TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter",
]

# import apis into sdk package
from openapi_client.api.auth_api import AuthApi
from openapi_client.api.body_api import BodyApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,37 @@

__version__ = "1.0.0"

# Define package exports
__all__ = [
"AuthApi",
"BodyApi",
"FormApi",
"HeaderApi",
"PathApi",
"QueryApi",
"ApiResponse",
"ApiClient",
"Configuration",
"OpenApiException",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiAttributeError",
"ApiException",
"Bird",
"Category",
"DataQuery",
"DefaultValue",
"NumberPropertiesOnly",
"Pet",
"Query",
"StringEnumRef",
"Tag",
"TestFormObjectMultipartRequestMarker",
"TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter",
"TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter",
]

# import apis into sdk package
from openapi_client.api.auth_api import AuthApi
from openapi_client.api.body_api import BodyApi
Expand Down
31 changes: 31 additions & 0 deletions samples/client/echo_api/python/openapi_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,37 @@

__version__ = "1.0.0"

# Define package exports
__all__ = [
"AuthApi",
"BodyApi",
"FormApi",
"HeaderApi",
"PathApi",
"QueryApi",
"ApiResponse",
"ApiClient",
"Configuration",
"OpenApiException",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiAttributeError",
"ApiException",
"Bird",
"Category",
"DataQuery",
"DefaultValue",
"NumberPropertiesOnly",
"Pet",
"Query",
"StringEnumRef",
"Tag",
"TestFormObjectMultipartRequestMarker",
"TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter",
"TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter",
]

# import apis into sdk package
from openapi_client.api.auth_api import AuthApi
from openapi_client.api.body_api import BodyApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,136 @@

__version__ = "1.0.0"

# Define package exports
__all__ = [
"AnotherFakeApi",
"DefaultApi",
"FakeApi",
"FakeClassnameTags123Api",
"ImportTestDatetimeApi",
"PetApi",
"StoreApi",
"UserApi",
"ApiResponse",
"ApiClient",
"Configuration",
"OpenApiException",
"ApiTypeError",
"ApiValueError",
"ApiKeyError",
"ApiAttributeError",
"ApiException",
"HttpSigningConfiguration",
"AdditionalPropertiesAnyType",
"AdditionalPropertiesClass",
"AdditionalPropertiesObject",
"AdditionalPropertiesWithDescriptionOnly",
"AllOfSuperModel",
"AllOfWithSingleRef",
"Animal",
"AnyOfColor",
"AnyOfPig",
"ArrayOfArrayOfModel",
"ArrayOfArrayOfNumberOnly",
"ArrayOfNumberOnly",
"ArrayTest",
"BaseDiscriminator",
"BasquePig",
"Bathing",
"Capitalization",
"Cat",
"Category",
"CircularAllOfRef",
"CircularReferenceModel",
"ClassModel",
"Client",
"Color",
"Creature",
"CreatureInfo",
"DanishPig",
"DeprecatedObject",
"DiscriminatorAllOfSub",
"DiscriminatorAllOfSuper",
"Dog",
"DummyModel",
"EnumArrays",
"EnumClass",
"EnumNumberVendorExt",
"EnumString1",
"EnumString2",
"EnumStringVendorExt",
"EnumTest",
"Feeding",
"File",
"FileSchemaTestClass",
"FirstRef",
"Foo",
"FooGetDefaultResponse",
"FormatTest",
"HasOnlyReadOnly",
"HealthCheckResult",
"HuntingDog",
"Info",
"InnerDictWithProperty",
"InputAllOf",
"IntOrString",
"ListClass",
"MapOfArrayOfModel",
"MapTest",
"MixedPropertiesAndAdditionalPropertiesClass",
"Model200Response",
"ModelApiResponse",
"ModelField",
"ModelReturn",
"MultiArrays",
"Name",
"NullableClass",
"NullableProperty",
"NumberOnly",
"ObjectToTestAdditionalProperties",
"ObjectWithDeprecatedFields",
"OneOfEnumString",
"Order",
"OuterComposite",
"OuterEnum",
"OuterEnumDefaultValue",
"OuterEnumInteger",
"OuterEnumIntegerDefaultValue",
"OuterObjectWithEnumProperty",
"Parent",
"ParentWithOptionalDict",
"Pet",
"Pig",
"PoopCleaning",
"PrimitiveString",
"PropertyMap",
"PropertyNameCollision",
"ReadOnlyFirst",
"SecondCircularAllOfRef",
"SecondRef",
"SelfReferenceModel",
"SingleRefType",
"SpecialCharacterEnum",
"SpecialModelName",
"SpecialName",
"Tag",
"Task",
"TaskActivity",
"TestEnum",
"TestEnumWithDefault",
"TestErrorResponsesWithModel400Response",
"TestErrorResponsesWithModel404Response",
"TestInlineFreeformAdditionalPropertiesRequest",
"TestModelWithEnumDefault",
"TestObjectForMultipartRequestsRequestMarker",
"Tiger",
"UnnamedDictWithAdditionalModelListProperties",
"UnnamedDictWithAdditionalStringListProperties",
"UploadFileWithAdditionalPropertiesRequestObject",
"User",
"WithNestedOneOf",
]

# import apis into sdk package
from petstore_api.api.another_fake_api import AnotherFakeApi
from petstore_api.api.default_api import DefaultApi
Expand Down
Loading
Loading