opsmill / infrahub-sdk-python

Python SDK to interact with Infrahub
https://www.opsmill.com
Apache License 2.0
3 stars 2 forks source link

Convert import paths to use relative Package name #80

Closed dgarros closed 1 month ago

dgarros commented 1 month ago

Related to https://github.com/opsmill/infrahub/issues/4234

In order to use a different package name within Infrahub, we need to convert the internal hardcoded import paths into relative paths.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 57.47126% with 74 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/client.py 0.00% 18 Missing :warning:
infrahub_sdk/__init__.py 0.00% 12 Missing :warning:
infrahub_sdk/node.py 0.00% 6 Missing :warning:
infrahub_sdk/config.py 0.00% 5 Missing :warning:
infrahub_sdk/schema.py 0.00% 5 Missing :warning:
infrahub_sdk/branch.py 0.00% 3 Missing :warning:
infrahub_sdk/query_groups.py 0.00% 3 Missing :warning:
infrahub_sdk/checks.py 0.00% 2 Missing :warning:
infrahub_sdk/playback.py 0.00% 2 Missing :warning:
infrahub_sdk/pytest_plugin/plugin.py 0.00% 2 Missing :warning:
... and 16 more
@@           Coverage Diff            @@
##           develop      #80   +/-   ##
========================================
  Coverage    43.28%   43.28%           
========================================
  Files           74       74           
  Lines         6847     6847           
  Branches      1353     1353           
========================================
  Hits          2964     2964           
- Misses        3552     3614   +62     
+ Partials       331      269   -62     
Flag Coverage Δ
python-3.10 43.28% <57.47%> (ø)
python-3.11 43.28% <57.47%> (ø)
python-3.12 43.28% <57.47%> (ø)
python-3.9 43.23% <57.47%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/code_generator.py 25.39% <100.00%> (ø)
infrahub_sdk/ctl/branch.py 76.81% <100.00%> (ø)
infrahub_sdk/ctl/check.py 27.00% <100.00%> (ø)
infrahub_sdk/ctl/cli_commands.py 37.05% <100.00%> (ø)
infrahub_sdk/ctl/client.py 47.61% <100.00%> (ø)
infrahub_sdk/ctl/exporter.py 52.17% <100.00%> (ø)
infrahub_sdk/ctl/generator.py 21.56% <100.00%> (ø)
infrahub_sdk/ctl/importer.py 55.00% <100.00%> (ø)
infrahub_sdk/ctl/menu.py 65.38% <100.00%> (ø)
infrahub_sdk/ctl/object.py 65.38% <100.00%> (ø)
... and 40 more
ogenstad commented 1 month ago

I think we might run into issues with this:

https://github.com/opsmill/infrahub-sdk-python/blob/develop/infrahub_sdk/schema.py#L111-L112

When we import the generators from the Git Agent and run this check on the imported objects we're probably going to get a mismatch. I still think we can move forward with this PR, but potentially we'll need to switch to using a protocol definition instead of pointing to the expected base class.

dgarros commented 1 month ago

I think we might run into issues with this:

https://github.com/opsmill/infrahub-sdk-python/blob/develop/infrahub_sdk/schema.py#L111-L112

When we import the generators from the Git Agent and run this check on the imported objects we're probably going to get a mismatch. I still think we can move forward with this PR, but potentially we'll need to switch to using a protocol definition instead of pointing to the expected base class.

This is a good point, I'll check that