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

erdantic v1.0 coming soon #241

Closed
jayqi opened this issue Mar 31, 2024 · 5 comments
Closed

erdantic v1.0 coming soon #241

jayqi opened this issue Mar 31, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@jayqi
Copy link

jayqi commented Mar 31, 2024

Hello,

I'm the maintainer of erdantic, and I wanted to let you know that erdantic v1.0 is coming soon. It's available right now as a pre-release version v1.0.0rc1 and can be installed with pip install erdantic --pre. Please let me know how I can help to make sure that things go smoothly for autodoc_pydantic.

In general, there shouldn't be any breaking changes to the most commonly used APIs. I took a look through the repository, and I believe this is the spot where erdantic is actually called:

# Graphviz [DOT language](https://graphviz.org/doc/info/lang.html)
figure_dot = erd.to_dot(self.object).replace('\t', ' ').split('\n')

As far as I can tell, there should be no breaking changes there, and that code should continue to work without error.

The backend of erdantic has changed significantly in v1.0 and, in general, I am hoping it will be easier for users to customize diagrams. (It includes functionality for drivendataorg/erdantic#78.) A summary of changes is available here.

Thanks for including erdantic integration in your project! If you have any questions, please let me know.

@mansenfranzen
Copy link
Owner

Hi @jayqi,

thanks a lot for you work and the heads up! The new release will help to simplify our tests incorporating erdantic via removing the graph label from the test data which varies across different erdantic versions:

def test_autodoc_pydantic_model_erdantic_figure_true(autodocument):
kwargs = dict(object_path='target.configuration.ModelErdanticFigure', **KWARGS)
result = [
'',
'.. py:pydantic_model:: ModelErdanticFigure',
' :module: target.configuration',
'',
' ModelErdanticFigure.',
'',
'',
' .. raw:: html',
'',
' <p><details class="autodoc_pydantic_collapsable_erd">',
' <summary>Show Entity Relationship Diagram</summary>',
'',
' .. graphviz::',
'',
' digraph "Entity Relationship Diagram" {',
' graph [fontcolor=gray66,',
' fontsize=9,',
' label="Created by erdantic v0.5.0 <https://github.com/drivendataorg/erdantic>",',
' nodesep=0.5,',
' rankdir=LR,',
' ranksep=1.5',
' ];',
' node [fontsize=14,',
' label="\\N",',
' shape=plain',
' ];',
' "target.configuration.ModelErdanticFigure" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>ModelErdanticFigure</b></td></tr><tr><td>field1</td><td port="field1">int</td></tr><tr><td>field2</td><td port="field2">str</td></tr><tr><td>related</td><td port="related">ModelErdanticFigureRelated</td></tr></table>>,',
' tooltip="target.configuration.ModelErdanticFigure&#xA;&#xA;ModelErdanticFigure.&#xA;"];',
' "target.configuration.ModelErdanticFigureRelated" [label=<<table border="0" cellborder="1" cellspacing="0"><tr><td port="_root" colspan="2"><b>ModelErdanticFigureRelated</b></td></tr><tr><td>field1</td><td port="field1">int</td></tr><tr><td>field2</td><td port="field2">str</td></tr></table>>,',
' tooltip="target.configuration.ModelErdanticFigureRelated&#xA;&#xA;ModelErdanticFigureRelated.&#xA;"];',
' "target.configuration.ModelErdanticFigure":related:e -> "target.configuration.ModelErdanticFigureRelated":_root:w [arrowhead=noneteetee];',
' }' '',
'',
'',
'',
' .. raw:: html',
'',
' </details></p>',
'',
'',
]
# explicit global
actual = autodocument(
options_app={'autodoc_pydantic_model_erdantic_figure': True}, **kwargs
)
assert actual[:17] == result[:17]
assert actual[18:] == result[18:]
# explicit local
actual = autodocument(options_doc={'model-erdantic-figure': True}, **kwargs)
assert actual[:17] == result[:17]
assert actual[18:] == result[18:]
# explicit local overwrite global
actual = autodocument(
options_app={'autodoc_pydantic_model_erdantic_figure': False},
options_doc={'model-erdantic-figure': True},
**kwargs,
)
assert actual[:17] == result[:17]
assert actual[18:] == result[18:]

By the way, I'm also convinced that your new release greatly improves the customizability of the diagrams with great benefit for end users.

When do you intend to release the new version?

@jayqi
Copy link
Author

jayqi commented Apr 5, 2024

Thanks for the feedback! I'm thinking about waiting through this weekend in case anybody is still going to test against 1.0.0rc1. So doing the release probably Monday or Tuesday.

@mansenfranzen mansenfranzen added the enhancement New feature or request label Apr 7, 2024
@jayqi
Copy link
Author

jayqi commented Apr 11, 2024

@mansenfranzen v1.0 is out now on PyPI and conda-forge. Let me know if you have any questions or run into any issues. I'm leaving this issue open in case you want to use it to track something, but no need to keep it open on my account.

@mansenfranzen
Copy link
Owner

I just came across an issue with generics and typevar for which I opened an issue drivendataorg/erdantic#114.

@mansenfranzen
Copy link
Owner

Closed via #246

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants