- 
                Notifications
    You must be signed in to change notification settings 
- Fork 935
[DTX-871] Refactor for async support #1971
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
Conversation
| 🎉 All Contributor License Agreements have been signed. Ready to merge.  | 
…support src/confluent_kafka/schema_registry/avro.py (change applied to src/confluent_kafka/schema_registry/_sync/avro.py)
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| with (patch("confluent_kafka.schema_registry.schema_registry_client.time.sleep") as mock_sleep, | ||
| patch("confluent_kafka.schema_registry.schema_registry_client.full_jitter") as mock_jitter): | ||
| with (patch("confluent_kafka.schema_registry._sync.schema_registry_client.time.sleep") as mock_sleep, | ||
| patch("confluent_kafka.schema_registry._sync.schema_registry_client.full_jitter") as mock_jitter): | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unittest.mock.patch needs to be used directly with the module that defines the function to be patched, hence this change.
| import os | ||
| from setuptools import setup | ||
| from distutils.core import Extension | ||
| from setuptools import Extension | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required to pip install . on Python 11+
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
    
      
        3 similar comments
      
    
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rohitsanj , LGTM
What
This PR refactors the schema registry modules across a newly introduced
_syncpackage, as well as thecommonpackage. The PR that introduces the_asyncpackage is stacked onto this one, see #1965.To illustrate the changes made, let's take
src/confluent_kafka/schema_registry/schema_registry_client.pyfor example:src/confluent_kafka/schema_registry/common/schema_registry_client.py-- this package is intended to house functionality that is common to both the sync and async implementations.SchemaRegistryClientand its dependent classes were moved intosrc/confluent_kafka/schema_registry/_sync/schema_registry_client.pysrc/schema_registry/schema_registry_client.pywas refactored to only contain imports from thecommon.schema_registry_clientand_sync.schema_registry_clientmodules. This is done so that users relying on imports directly fromconfluent_kafka.schema_registry.schema_registry_clientdon't encounter any breaking/missing imports.The above treatment was applied to:
schema_registry_client.py(as demonstrated),avro.py,json_schema.py,protobuf.pyandserde.py.Other changes:
_sync(with minimal changes).Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups