Skip to content
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

Valid conjure definition results in circular python import #62

Open
ahggns opened this issue Dec 11, 2018 · 0 comments
Open

Valid conjure definition results in circular python import #62

ahggns opened this issue Dec 11, 2018 · 0 comments

Comments

@ahggns
Copy link

ahggns commented Dec 11, 2018

What happened?

I modified the https://github.com/palantir/conjure-java-example to introduce a circular dependency between packages:

--- a/recipe-example-api/src/main/conjure/recipe-example-api.yml
+++ b/recipe-example-api/src/main/conjure/recipe-example-api.yml
@@ -14,6 +14,7 @@ types:
         alias: string

       BakeStep:
+        package: com.palantir.conjure.examples.recipe.api.step
         fields:
           temperature: Temperature
           durationInSeconds: integer

This causes two python packages to be created (expected):
conjure_examples_recipe_api:

from ..conjure_examples_recipe_api_step import BakeStep
from abc import ABCMeta, abstractmethod
from conjure_python_client import ConjureBeanType, ConjureDecoder, ConjureEncoder, ConjureEnumType, ConjureFieldDefinition, ConjureUnionType, ListType, Service
from typing import List, Set

class Recipe(ConjureBeanType):
[...]

conjure_examples_recipe_api_step:

from ..conjure_examples_recipe_api import Temperature
from conjure_python_client import ConjureBeanType, ConjureFieldDefinition

class BakeStep(ConjureBeanType):
[...]

This python code cannot be imported due to the circular dependency:

>>> import sys
>>> sys.path.append("/src/ahiggins/conjure-java-example/recipe-example-api/recipe-example-api-python/python/")
>>> from recipe_example_api.conjure_examples_recipe_api import Temperature

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-428f65a0c05a> in <module>
      1 import sys, os
      2 sys.path.append("/src/ahiggins/conjure-java-example/recipe-example-api/recipe-example-api-python/python/")
----> 3 from recipe_example_api.conjure_examples_recipe_api import Temperature

/src/ahiggins/conjure-java-example/recipe-example-api/recipe-example-api-python/python/recipe_example_api/conjure_examples_recipe_api/__init__.py in <module>
----> 1 from ..conjure_examples_recipe_api_step import BakeStep
      2 from abc import ABCMeta, abstractmethod
      3 from conjure_python_client import ConjureBeanType, ConjureDecoder, ConjureEncoder, ConjureEnumType, ConjureFieldDefinition, ConjureUnionType, ListType, Service
      4 from typing import List, Set
      5 

/src/ahiggins/conjure-java-example/recipe-example-api/recipe-example-api-python/python/recipe_example_api/conjure_examples_recipe_api_step/__init__.py in <module>
----> 1 from ..conjure_examples_recipe_api import Temperature
      2 from conjure_python_client import ConjureBeanType, ConjureFieldDefinition
      3 
      4 class BakeStep(ConjureBeanType):
      5 

ImportError: cannot import name 'Temperature'
@robert3005 robert3005 reopened this Mar 4, 2022
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

No branches or pull requests

2 participants