From fac2be522f9b8ea18c30aeae4928c81701ef2e4c Mon Sep 17 00:00:00 2001 From: shabbywu Date: Wed, 9 Feb 2022 15:39:24 +0800 Subject: [PATCH] bugfix: fix missing tzinfo --- moby_distribution/__init__.py | 2 +- moby_distribution/spec/image_json.py | 7 ++++++- pyproject.toml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/moby_distribution/__init__.py b/moby_distribution/__init__.py index 6fbdc9e..c658664 100644 --- a/moby_distribution/__init__.py +++ b/moby_distribution/__init__.py @@ -7,7 +7,7 @@ from moby_distribution.spec.image_json import ImageJSON from moby_distribution.spec.manifest import ManifestSchema1, ManifestSchema2, OCIManifestSchema1 -__version__ = "0.4.3" +__version__ = "0.4.4" __ALL__ = [ "DockerRegistryV2Client", "Blob", diff --git a/moby_distribution/spec/image_json.py b/moby_distribution/spec/image_json.py index cbe2552..80ba131 100644 --- a/moby_distribution/spec/image_json.py +++ b/moby_distribution/spec/image_json.py @@ -5,6 +5,11 @@ from pydantic import BaseModel, Field +def default_created(): + dt = datetime.datetime.utcnow() + return dt.replace(microsecond=0, tzinfo=datetime.timezone.utc) + + class HealthConfig(BaseModel): Test: List[str] = Field( ..., @@ -68,7 +73,7 @@ class RootFS(BaseModel): class History(BaseModel): - created: Optional[datetime.datetime] = Field(default_factory=datetime.datetime.utcnow) + created: Optional[datetime.datetime] = Field(default_factory=default_created) author: Optional[str] created_by: Optional[str] comment: Optional[str] diff --git a/pyproject.toml b/pyproject.toml index dc7d896..d564f84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "moby-distribution" -version = "0.4.3" +version = "0.4.4" description = "Yet another moby(docker) distribution implement by python." authors = ["shabbywu "] license = "Apache-2.0"