Skip to content

Conversation

@CasperWA
Copy link
Collaborator

@CasperWA CasperWA commented Feb 1, 2024

In #20 a lot of work has been done, but one of the crucial additions is the entity factory.

This PR essentially takes that addition and then also removes everything not actively used or that's very outdated from the repository.

Update the DataSource factory - should be a SOFT7Instance factory
instead with proper validation of property metadata and more.
Add pytest and pytest-cov dependencies, along with a new `testing`
installable extra.
Remove tests for the now re-written SOFT7EntityPropertyType (previously
an Enum, now just a Literal collection with an associated mapping).
Also, rename create_entity() to create_datasource().

Ensure the create_datasource() function returns an instantiated model.
This can now be used in both the SOFT7DataSource model as well as the
new DataSourceDimensions model.

Add `requests-mock` dependency. Consider using "python" backend for
OTELib instead to avoid mocking requests.

Remove all filterwarnings from pytest config.
New test using python otelib backend.
Added test for serializing
All the serialization tests (including JSON Schema) must be extended to
ensure not just that it _can_ be serialized, but that the content is
also what would be expected.
Implemented as a pydantic model_serializer in "wrap" mode.

Temporarily changed the otelib dependency to point to a git branch on
GitHub that implements migration to pydantic v2.
Make the namespace an AnyUrl.
Quick (but proper) solutions to ever so slightly decrease the number of
uncovered lines.
Specifically, move all the "helper"/utility functionalities from
`datasource_factory.py` to a new `soft7_instance.py` under
pydantic_models.
Run hooks on all files, upgrading them accordingly.
Make factory functions importable from `s7.factories` as `create_*`,
where * matches the name of any `*_factory.py` file in the folder.
Split ruff hook for core code base code and non-core.
Started to flesh out an OTEAPI function strategy plugin for converting
between a parsed data source to a SOFT7 Entity instance.
Missing finalizing example in notebook.
There is a design issue here with nested entities that should be fixable
in a more elegant way
Need to fix setting ClassVar on EntityInstance and the validator for the
same.
Add a YAML parse strategy for OTEAPI.
See issue #395 in oteapi-core to follow up on when this ignore statement
can be removed.
Focus on:
- the entity_instance factory
- the OTEAPI plugins
- the pydantic models
These should be removed when supporting Python 3.10+.

Pydantic does not support new-style type notation in Python 3.9.
@codecov
Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: Patch coverage is 45.88235% with 368 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@9268eb3). Click here to learn what that means.

Files Patch % Lines
s7/oteapi_plugin/soft7_function.py 26.45% 139 Missing ⚠️
s7/pydantic_models/soft7_instance.py 36.78% 122 Missing ⚠️
s7/pydantic_models/soft7_entity.py 58.38% 67 Missing ⚠️
s7/oteapi_plugin/yaml_parser.py 0.00% 35 Missing ⚠️
s7/pydantic_models/oteapi.py 80.00% 3 Missing ⚠️
s7/oteapi_plugin/models.py 95.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #21   +/-   ##
=======================================
  Coverage        ?   46.04%           
=======================================
  Files           ?       11           
  Lines           ?      682           
  Branches        ?        0           
=======================================
  Hits            ?      314           
  Misses          ?      368           
  Partials        ?        0           
Flag Coverage Δ
pytest 46.04% <45.88%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@CasperWA CasperWA marked this pull request as ready for review March 18, 2024 14:05
@CasperWA CasperWA marked this pull request as draft March 18, 2024 14:05
@CasperWA CasperWA marked this pull request as ready for review March 18, 2024 14:15
@CasperWA CasperWA requested review from Treesarj and quaat March 18, 2024 14:15
@CasperWA CasperWA changed the base branch from main to develop April 3, 2024 07:48
@CasperWA CasperWA merged commit 02a9dd6 into develop Apr 3, 2024
@CasperWA CasperWA deleted the cwa/soft7-entity-factory branch April 3, 2024 07:52
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

Successfully merging this pull request may close these issues.

2 participants