Skip to content

Bump Pydantic to v2+ #1285

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

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1ad8472
Run bump-pydantic
BenjaminCharmes Jul 17, 2025
21b2c31
continue migration to Pydantic v2
BenjaminCharmes Jul 18, 2025
6ac09b3
Fix pytest
BenjaminCharmes Jul 22, 2025
9ba4b24
Fix deployment_metadata in /info
BenjaminCharmes Jul 28, 2025
be2630c
Fix circular import between Item and Collection
BenjaminCharmes Jul 28, 2025
3b8c00f
pydantic v2 is more strict and doesn't allow None
BenjaminCharmes Jul 28, 2025
1712be8
Case sensitive env variable
BenjaminCharmes Jul 28, 2025
82241ca
workflow ignore pydatalab_testing=true
BenjaminCharmes Jul 28, 2025
2928fd7
doteven not working with Pydantiv v2+
BenjaminCharmes Jul 28, 2025
8dc3b49
Test temp. fix
BenjaminCharmes Jul 28, 2025
e7aebca
Test temp. fix
BenjaminCharmes Jul 28, 2025
fdedf30
Remove bash in .pre-commit
BenjaminCharmes Jul 30, 2025
b1549bd
Remove env PYDATALAB_TESTING in docker-compose
BenjaminCharmes Jul 30, 2025
e338050
Pin pydantic dependencies
BenjaminCharmes Jul 30, 2025
c7b8a11
Remove quote in .pre-commit
BenjaminCharmes Jul 30, 2025
ee71307
Replace pattern with examples in backup frequency
BenjaminCharmes Jul 30, 2025
03b6383
uv lock
BenjaminCharmes Jul 30, 2025
1301b95
add dotenv_settings
BenjaminCharmes Jul 30, 2025
16e10e2
add dotenv_settings
BenjaminCharmes Jul 30, 2025
d4579e9
Add temp. debug log
BenjaminCharmes Jul 30, 2025
597fb69
Remove temp. debug log
BenjaminCharmes Jul 30, 2025
ac6c191
Models with circular refs
BenjaminCharmes Jul 30, 2025
b060816
type annotations for mypy
BenjaminCharmes Jul 31, 2025
9ec7bae
Replace field docstring with Pydantic Field Description to appear in …
BenjaminCharmes Jul 31, 2025
e5ebeb1
Remove deprecated .dict()
BenjaminCharmes Jul 31, 2025
50d86d9
Remove all scripts as they are now defunct
ml-evs Aug 8, 2025
fd9fe18
Remove one remaining .dict()
ml-evs Aug 8, 2025
48da590
Allow env file loading to be disabled to streamline local testing
ml-evs Aug 9, 2025
13e4f02
Switch to package name for cov report
ml-evs Aug 9, 2025
1cb7e5c
Restructure traits imports to avoid circular refs
ml-evs Aug 9, 2025
204e365
Relax type annotation on relationships
ml-evs Aug 9, 2025
74dcedf
Remove unecessary negation
ml-evs Aug 9, 2025
192323c
Placeholder
ml-evs Aug 11, 2025
280d891
Minor refactor
ml-evs Aug 11, 2025
51de25a
Simplify and tidy up models
ml-evs Aug 11, 2025
e74e6b9
Clean up item routes
ml-evs Aug 11, 2025
16025d5
Remove middleware
ml-evs Aug 11, 2025
510123a
Undo changes to login/users
ml-evs Aug 11, 2025
5989279
Add extra guards to prevent unupdateable fields from being updated
ml-evs Aug 11, 2025
f29fc98
Disable local coverage report but enable it in CI
ml-evs Aug 11, 2025
e52192f
Use full pydantic-schema types for datetimes and objectids
ml-evs Aug 11, 2025
2d673a6
Update tests
ml-evs Aug 11, 2025
2c53815
Minor fixup of users and login
ml-evs Aug 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 30 additions & 32 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
version: 2
updates:
- package-ecosystem: pip
directory: "./pydatalab"
schedule:
interval: monthly
day: monday
time: "05:43"
target-branch: main
labels:
- dependency_updates
versioning-strategy: "increase-if-necessary"
ignore:
- dependency-name: "pydantic"
versions: [ ">=2" ]
- dependency-name: "bokeh"
versions: [ ">=3" ]
- dependency-name: "langchain"
versions: [ ">=0.3" ]
# Updates GH actions versions as often as needed
- package-ecosystem: github-actions
directory: "/"
schedule:
day: monday
interval: monthly
time: "05:33"
target-branch: main
labels:
- CI
- dependency_updates
groups:
github-actions:
applies-to: version-updates
dependency-type: production
- package-ecosystem: pip
directory: "./pydatalab"
schedule:
interval: monthly
day: monday
time: "05:43"
target-branch: main
labels:
- dependency_updates
versioning-strategy: "increase-if-necessary"
ignore:
- dependency-name: "bokeh"
versions: [">=3"]
- dependency-name: "langchain"
versions: [">=0.3"]
# Updates GH actions versions as often as needed
- package-ecosystem: github-actions
directory: "/"
schedule:
day: monday
interval: monthly
time: "05:33"
target-branch: main
labels:
- CI
- dependency_updates
groups:
github-actions:
applies-to: version-updates
dependency-type: production
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
- name: Run all tests
working-directory: ./pydatalab
run: |
uv run pytest -rs -vvv ./tests
uv run pytest -rs --cov=pydatalab --cov-report=term --cov-report=xml -vvv ./tests

- name: Upload coverage to Codecov
if: matrix.python-version == '3.10' && github.repository == 'datalab-org/datalab'
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
files: docker-compose.yml
load: true
source: .
targets: 'app,api,database'
targets: "app,api,database"
set: |
app.cache-from=type=gha,scope=${{ github.ref_name }}-${{ matrix.browser-backend }}-build-app
app.cache-from=type=gha,scope=main-${{ matrix.browser-backend }}-build-app
Expand Down
48 changes: 24 additions & 24 deletions .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
ref: ${{ env.PUBLISH_UPDATE_BRANCH }}
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
ref: ${{ env.PUBLISH_UPDATE_BRANCH }}

- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
working-directory: "./pydatalab"
enable-cache: true
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
version: ${{ env.UV_VERSION }}
working-directory: "./pydatalab"
enable-cache: true

- name: Run liccheck
working-directory: ./pydatalab
run: |
uv venv
uv sync --all-extras --dev
uv export --locked --all-extras --no-hashes --no-dev > requirements.txt
uv pip install liccheck==0.9.2 pip
uv run liccheck -r requirements.txt
- name: Run liccheck
working-directory: ./pydatalab
run: |
uv venv
uv sync --all-extras --dev
uv export --locked --all-extras --no-hashes --no-dev > requirements.txt
uv pip install liccheck==0.9.2 pip
uv run liccheck -r requirements.txt
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ repos:
hooks:
- id: mypy
additional_dependencies:
["types-python-dateutil", "types-requests", "types-paramiko", "pydantic~=1.10"]
[
"types-python-dateutil",
"types-requests",
"types-paramiko",
"pydantic>=2.0,<3.0",
"pydantic-settings>=2.0",
]
args: ["--config-file", "pydatalab/pyproject.toml"]

- repo: local
Expand All @@ -75,6 +81,6 @@ repos:
name: Regenerate item model JSONSchemas
files: "^pydatalab/src/pydatalab/models/.*.$"
description: Check if the current code changes have enacted changes to the resulting JSONSchemas
entry: invoke -r pydatalab dev.generate-schemas
entry: uv run invoke -r pydatalab dev.generate-schemas
pass_filenames: false
language: system
5 changes: 3 additions & 2 deletions pydatalab/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ dependencies = [
"bokeh ~= 2.4, < 3.0",
"matplotlib ~= 3.8",
"periodictable ~= 1.7",
"pydantic[email, dotenv] < 2.0",
"pydantic[email] ~= 2.11",
"python-dotenv ~= 1.1",
"pydantic-settings ~= 2.10",
"pint ~= 0.24",
"pandas[excel] ~= 2.2",
"pymongo ~= 4.7",
Expand Down Expand Up @@ -134,7 +136,6 @@ dev-dependencies = [
datalab-app-plugin-insitu = { git = "https://github.com/datalab-org/datalab-app-plugin-insitu.git", rev = "v0.2.0" }

[tool.pytest.ini_options]
addopts = "--cov-report=term --cov-report=xml --cov ./src/pydatalab"
filterwarnings = [
"error",
"ignore:.*np.bool8*:DeprecationWarning",
Expand Down
Loading