Skip to content
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

Downgrade pydantic<2 #5

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions agipack/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import importlib
from pathlib import Path

import typer
Expand All @@ -21,7 +20,9 @@ def main(ctx: typer.Context):
@app.command()
def version():
"""Print the version number."""
print(importlib.metadata.version("agi-pack"))
from agipack.version import __version__

print(__version__)


@app.command()
Expand Down
8 changes: 4 additions & 4 deletions agipack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Dict, List, Optional, Union

import yaml
from pydantic import field_validator
from pydantic import validator
from pydantic.dataclasses import dataclass

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -113,15 +113,15 @@ def is_base_image(self) -> bool:
"""Check if the base target is root / does not have a parent."""
return ":" in self.base

@field_validator("python", mode="before")
@validator("python", pre=True)
def validate_python_version(cls, python):
"""Validate the python version."""
python = str(python)
if not python.startswith("3."):
raise ValueError(f"Python version must be >= 3.6 (found {python})")
return python

@field_validator("command", mode="before")
@validator("command", pre=True)
def validate_command_version(cls, cmd):
"""Validate the command."""
if isinstance(cmd, str):
Expand Down Expand Up @@ -175,7 +175,7 @@ def is_prod(self) -> bool:
"""Check if the configuration is for production."""
return self.prod

@field_validator("images")
@validator("images")
def validate_python_dependencies_for_nonbase_images(cls, images):
"""Validate that all images have the same python dependency as the base image."""
version = None
Expand Down
2 changes: 1 addition & 1 deletion agipack/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.11"
__version__ = "0.1.12"
2 changes: 1 addition & 1 deletion examples/generated/Dockerfile-base-cpu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# >>>>>>>>>>>>>>>>>>>>>>>>>>>
# Auto-generated by agi-pack (version=0.1.11).
# Auto-generated by agi-pack (version=0.1.12).
FROM debian:buster-slim AS base-cpu

# Setup environment variables
Expand Down
2 changes: 1 addition & 1 deletion examples/generated/Dockerfile-base-cu118
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# >>>>>>>>>>>>>>>>>>>>>>>>>>>
# Auto-generated by agi-pack (version=0.1.11).
# Auto-generated by agi-pack (version=0.1.12).
FROM nvidia/cuda:11.8.0-base-ubuntu22.04 AS base-gpu

# Setup environment variables
Expand Down
2 changes: 1 addition & 1 deletion examples/generated/Dockerfile-builder
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# >>>>>>>>>>>>>>>>>>>>>>>>>>>
# Auto-generated by agi-pack (version=0.1.11).
# Auto-generated by agi-pack (version=0.1.12).
FROM debian:buster-slim AS agipack-builder

# Setup environment variables
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers = [
dynamic = ["version"]
dependencies = [
"jinja2",
"pydantic>=2",
"pydantic<2",
"pyyaml",
"typer[all]"
]
Expand Down