feat: Add description field to columns#342
Open
Oliver Borchert (borchero) wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #342 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 56 56
Lines 3404 3410 +6
=========================================
+ Hits 3404 3410 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces an optional description field for column definitions so that human-readable column documentation is available at runtime (notably for propagation into pydantic field/schema descriptions).
Changes:
- Add
description: str | NonetoColumnand thread it through concrete column constructors. - Include
descriptioninpydantic.Field(...)kwargs so it appears in generated JSON schema. - Add tests validating
descriptionstorage, immutability viawith_description, and pydantic propagation.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/columns/test_description.py | Adds coverage for the new description attribute and pydantic schema propagation. |
| dataframely/columns/_base.py | Adds description storage, pydantic field kwargs propagation, and with_description(). |
| dataframely/columns/any.py | Accepts and forwards description for Any columns. |
| dataframely/columns/array.py | Accepts and forwards description for Array columns. |
| dataframely/columns/categorical.py | Accepts and forwards description for Categorical columns. |
| dataframely/columns/datetime.py | Accepts and forwards description for datetime-related columns. |
| dataframely/columns/decimal.py | Accepts and forwards description for Decimal columns. |
| dataframely/columns/enum.py | Accepts and forwards description for Enum columns. |
| dataframely/columns/float.py | Accepts and forwards description for float columns. |
| dataframely/columns/integer.py | Accepts and forwards description for integer columns. |
| dataframely/columns/list.py | Accepts and forwards description for List columns. |
| dataframely/columns/object.py | Accepts and forwards description for Object columns. |
| dataframely/columns/string.py | Accepts and forwards description for String columns. |
| dataframely/columns/struct.py | Accepts and forwards description for Struct columns. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Implements #323 (comment) and closes #132.
Why introduce a
descriptionparameter?Unfortunately, attribute docstrings cannot be extracted at runtime (PEP 224 was rejected). Hence, this is the only way to make use of the description at runtime, e.g. to pass to
pydanticfield descriptions.