Skip to content

Comments

Use pydantic for Producers#73

Merged
JacobHayes merged 1 commit intogoldenfrom
pydantic-producers
Aug 4, 2021
Merged

Use pydantic for Producers#73
JacobHayes merged 1 commit intogoldenfrom
pydantic-producers

Conversation

@JacobHayes
Copy link
Member

@JacobHayes JacobHayes commented Jul 27, 2021

I think this lays most of the foundation for pydantic Producers. In order to build the appropriate model, a
Producer must now set the fields in the top level matching the .build signature.

I still need to:

  • Validate the .build/.map arguments are a subset of the model ones (cls.__fields__) and match on type
  • Validate no Optional/default None fields or add support for them We should support optional, but the Fingerprint logic mentioned below doesn't exist yet (so will keep in mind)
    • Do we need more entropy or "if dep is Optional and missing, replace Fingerprint.empty() with Fingerprint.identity()"?

In future PRs, I'll take a stab at:

  • Support Annotated / View arguments to Producer.build
    • Check the root type can be loaded into a View
  • build decorator -> Producer subclass (auto setup fields)

@JacobHayes JacobHayes self-assigned this Jul 27, 2021
@JacobHayes JacobHayes requested a review from mikss July 27, 2021 07:31
@JacobHayes JacobHayes force-pushed the pydantic-artifacts branch from c680622 to a5c4470 Compare July 27, 2021 19:43
@codecov
Copy link

codecov bot commented Jul 27, 2021

Codecov Report

Merging #73 (282148a) into golden (fe2fb7a) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 282148a differs from pull request most recent head 3157720. Consider uploading reports for the commit 3157720 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##            golden       #73   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           21        21           
  Lines          671       687   +16     
  Branches        70        77    +7     
=========================================
+ Hits           671       687   +16     
Impacted Files Coverage Δ
src/arti/artifacts/core.py 100.00% <100.00%> (ø)
src/arti/producers/core.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe2fb7a...3157720. Read the comment docs.

@JacobHayes JacobHayes force-pushed the pydantic-producers branch from e00b2b9 to 1415ad7 Compare July 27, 2021 21:16
Base automatically changed from pydantic-artifacts to golden July 29, 2021 02:12
@JacobHayes JacobHayes force-pushed the pydantic-producers branch 3 times, most recently from 87a2a40 to 8f824c5 Compare August 4, 2021 04:46
@JacobHayes JacobHayes marked this pull request as ready for review August 4, 2021 19:08
@JacobHayes JacobHayes merged commit 75fefa6 into golden Aug 4, 2021
@JacobHayes JacobHayes deleted the pydantic-producers branch August 4, 2021 21:19
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