Skip to content

fix(apitable.py): guard MetaField property=None and relax pydantic pin#128

Merged
paylm merged 2 commits into
apitable:developfrom
zoe-icu:fix/metafield-property-none-and-pydantic-pin
Jul 8, 2026
Merged

fix(apitable.py): guard MetaField property=None and relax pydantic pin#128
paylm merged 2 commits into
apitable:developfrom
zoe-icu:fix/metafield-property-none-and-pydantic-pin

Conversation

@zoe-icu

@zoe-icu zoe-icu commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix a TypeError in MetaField.__init__ when a mapped field type is returned without a property payload (or with property=None). Previously the code did property_model(**property) unconditionally, which crashes when property is None.
  • Relax the pydantic version pin in pyproject.toml from an exact 2.5.3 to ^2.5.3, so installs succeed on Python 3.12+/3.14 (no 2.5.3 wheels exist for those interpreters).
  • Correct setup.py, which pinned pydantic==1.7 even though the code already uses the pydantic v2 API — pip install . was broken.
  • Add unit tests covering the property=None regression and nested MagicLookUp property parsing.

Motivation

Follow-up to vikadata/vika.py#62. The reporter is on Python 3.14, where the old vika.py (pydantic v1) can't import at all. They've been pointed at this SDK as the maintained replacement, but the exact pydantic = "2.5.3" pin here would also block them (no matching wheel on 3.14). Loosening it lets 3.14 users install cleanly, and the MetaField guard fixes a latent crash that surfaces whenever the API returns a nullable property.

Test plan

  • pytest test/test_meta_field.py test/test_utils.py — all pass locally
  • CI (py-test.yml) green
  • Manual sanity: from apitable import Apitable on Python 3.12

Notes

  • No behavior change for the happy path (property is a dict, or type is unmapped).
  • No public API change.

- MetaField.__init__ crashed with TypeError when a mapped field type
  arrived without a 'property' payload (or with property=None), because
  property_model(**None) is not valid. Guard on isinstance(property, dict)
  and fall back to data.get('type').
- pyproject.toml: pydantic '2.5.3' -> '^2.5.3' so installs succeed on
  Python 3.12+/3.14 where 2.5.3 wheels aren't available.
- setup.py: pydantic '==1.7' -> '>=2.5.3,<3'; the previous pin was
  incompatible with the v2 API the code already uses.
- Add unit tests covering the property=None regression and nested
  MagicLookUp property parsing.
@zoe-icu zoe-icu closed this Jul 6, 2026
@zoe-icu zoe-icu reopened this Jul 6, 2026
Fork PRs cannot activate a 'push'-only workflow, so PR apitable#128 shows no
CI status. Add pull_request as an additional trigger so PRs against
develop get validated too.
@paylm paylm merged commit 8411b35 into apitable:develop Jul 8, 2026
0 of 2 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