Skip to content

feat: Add description field to columns#342

Open
Oliver Borchert (borchero) wants to merge 2 commits into
mainfrom
description
Open

feat: Add description field to columns#342
Oliver Borchert (borchero) wants to merge 2 commits into
mainfrom
description

Conversation

@borchero
Copy link
Copy Markdown
Member

@borchero Oliver Borchert (borchero) commented May 24, 2026

Motivation

Implements #323 (comment) and closes #132.

Why introduce a description parameter?

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 pydantic field descriptions.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b339296) to head (ff4f2f8).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | None to Column and thread it through concrete column constructors.
  • Include description in pydantic.Field(...) kwargs so it appears in generated JSON schema.
  • Add tests validating description storage, immutability via with_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.

Comment thread dataframely/columns/_base.py
Comment thread tests/columns/test_description.py
Comment thread dataframely/columns/_base.py
Comment thread tests/columns/test_description.py
Comment thread tests/columns/test_description.py
Comment thread tests/columns/test_description.py
Comment thread tests/columns/test_description.py
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

Successfully merging this pull request may close these issues.

Support for docstring styled column documentation

2 participants