Skip to content

Commit d7a8925

Browse files
ahilgerfacebook-github-bot
authored andcommitted
make imports more robust to partial rollout
Summary: A large number of `.thrift` files pick-up dependencies on `fb303.thrift` or some other base class via `service MyService extends fb303.FacebookService {...}`. That makes it hard to do a partial in-place migration based on all these build graph edges to these core service `.thrift` files. However, this dependency is never used in types, i.e., as a thrift field, so it's not actually a blocker for in-place migration. To avoid import error from un-migrated thrift file, switch the dependency imports to `.types`, which contains aliases to the `inplace.py` types (or regular cython types if un-migrated). Reviewed By: prakashgayasen Differential Revision: D77401568 fbshipit-source-id: 78a400441137506e442f38a02a619219682d4c96
1 parent 1ecc666 commit d7a8925

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

third-party/thrift/src/thrift/compiler/generate/templates/py3/types_inplace_FBTHRIFT_ONLY_DO_NOT_USE.py.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:n
4848

4949
{{#program:includeNamespaces}}
5050
{{#hasTypes?}}
51-
import {{#includeNamespace}}{{value}}.{{/includeNamespace}}types_inplace_FBTHRIFT_ONLY_DO_NOT_USE as _{{#includeNamespace}}{{value}}_{{/includeNamespace}}types
51+
import {{#includeNamespace}}{{value}}.{{/includeNamespace}}types as _{{#includeNamespace}}{{value}}_{{/includeNamespace}}types
5252
{{#program:hasConstants}}
5353
import {{#includeNamespace}}{{value}}.{{/includeNamespace}}types
5454
{{/program:hasConstants}}

third-party/thrift/src/thrift/compiler/test/fixtures/interactions/out/py3_inplace/gen-py3/test/fixtures/interactions/module/types_inplace_FBTHRIFT_ONLY_DO_NOT_USE.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import test.fixtures.interactions.module.thrift_enums as _fbthrift_python_enums
2828

2929

30-
import test.fixtures.another_interactions.shared.types_inplace_FBTHRIFT_ONLY_DO_NOT_USE as _test_fixtures_another_interactions_shared_types
30+
import test.fixtures.another_interactions.shared.types as _test_fixtures_another_interactions_shared_types
3131

3232
def get_types_reflection():
3333
return importlib.import_module(

third-party/thrift/src/thrift/compiler/test/fixtures/types/out/py3_inplace/gen-py3/apache/thrift/fixtures/types/module/types_inplace_FBTHRIFT_ONLY_DO_NOT_USE.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import apache.thrift.fixtures.types.module.thrift_enums as _fbthrift_python_enums
2828

2929

30-
import apache.thrift.fixtures.types.included.types_inplace_FBTHRIFT_ONLY_DO_NOT_USE as _apache_thrift_fixtures_types_included_types
30+
import apache.thrift.fixtures.types.included.types as _apache_thrift_fixtures_types_included_types
3131

3232
def get_types_reflection():
3333
return importlib.import_module(

0 commit comments

Comments
 (0)