Skip to content

Conversation

@amerberg
Copy link
Contributor

@amerberg amerberg commented Jan 2, 2026

As of #2136, pandera uses a schema descriptor which can cause some problems when inspecting models that extend DataFrameModel classes:

import pydoc

import pandas as pd
import pandera.pandas as pa
from pandera.typing import Series
from pandera.api.dataframe.model import DataFrameModel as BaseDataFrameModel
from pandera.pandas import DataFrameModel as PandasDataFrameModel
from pandera.polars import DataFrameModel as PolarsDataFrameModel


class BaseModel(BaseDataFrameModel):
    name: Series[pa.String] = pa.Field()


class PandasModel(PandasDataFrameModel, BaseModel):
    pass


class PolarsModel(PolarsDataFrameModel, BaseModel):
    pass


print(pydoc.render_doc(PandasModel))

The pydoc.render_doc(PandasModel) raises NotImplementedError, because pydoc walks the MRO and attempts to access the __schema__ attribute on pandera.api.dataframe.model.DataFrameModel.

The fix here is to modify the _SchemaDescriptor to catch the NotImplementedError and raise an AttributeError, which is handled better by pydoc.

@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.86%. Comparing base (71255eb) to head (ed8ec8b).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
pandera/api/dataframe/model.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2197      +/-   ##
==========================================
- Coverage   83.86%   83.86%   -0.01%     
==========================================
  Files         137      137              
  Lines       10607    10610       +3     
==========================================
+ Hits         8896     8898       +2     
- Misses       1711     1712       +1     

☔ 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.

@amerberg amerberg marked this pull request as ready for review January 2, 2026 17:08
@amerberg
Copy link
Contributor Author

amerberg commented Jan 2, 2026

The test failure seems to be essentially a fluke. The tests ran successefully, but there was an error uploading coverage:

Run codecov/codecov-action@v4
eventName: pull_request
baseRef: unionai-oss:main | headRef: amerberg:schema_not_implemented
==> Fork detected, tokenless uploading used
==> macos OS detected
Error: getaddrinfo ENOTFOUND cli.codecov.io
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:122:26)

@cosmicBboy cosmicBboy merged commit 82096dd into unionai-oss:main Jan 6, 2026
442 of 444 checks passed
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