Skip to content

Commit

Permalink
Update codegen Field imports
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Hayes <[email protected]>
  • Loading branch information
JacobHayes committed Oct 11, 2023
1 parent 7476ff0 commit 8ddabf3
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 16 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SHELL=bash

ARGO_WORKFLOWS_VERSION="3.4.4"
OPENAPI_SPEC_URL="https://raw.githubusercontent.com/argoproj/argo-workflows/v$(ARGO_WORKFLOWS_VERSION)/api/openapi-spec/swagger.json"
SPEC_PATH="$(shell pwd)/argo-workflows-$(ARGO_WORKFLOWS_VERSION).json"
Expand Down Expand Up @@ -62,6 +64,9 @@ workflows-models: ## Generate the Workflows models portion of Argo Workflows
--disable-appending-item-suffix \
--disable-timestamp \
--use-default-kwarg
@shopt -s globstar \
&& sed -i.bak 's/from pydantic import Field/from hera.shared._pydantic import Field/' src/hera/workflows/models/{**/,}*.py \
&& rm -rf src/hera/workflows/models/**/*.py.bak
@poetry run python scripts/models.py $(OPENAPI_SPEC_URL) workflows
@poetry run stubgen -o src -p hera.workflows.models && find src/hera/workflows/models -name '__init__.pyi' -delete
@rm $(SPEC_PATH)
Expand All @@ -83,6 +88,9 @@ events-models: ## Generate the Events models portion of Argo Workflows
--disable-appending-item-suffix \
--disable-timestamp \
--use-default-kwarg
@shopt -s globstar \
&& sed -i.bak 's/from pydantic import Field/from hera.shared._pydantic import Field/' src/hera/events/models/{**/,}*.py \
&& rm -rf src/hera/events/models/**/*.py.bak
@poetry run python scripts/models.py $(OPENAPI_SPEC_URL) events
@poetry run stubgen -o src -p hera.events.models && find src/hera/events/models -name '__init__.pyi' -delete
@rm $(SPEC_PATH)
Expand Down
5 changes: 4 additions & 1 deletion src/hera/events/models/eventsource.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from .io.argoproj.events import v1alpha1 as v1alpha1
from .io.k8s.apimachinery.pkg.apis.meta import v1 as v1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/events/models/io/argoproj/events/v1alpha1.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...k8s.api.core import v1 as v1
from ...k8s.apimachinery.pkg.apis.meta import v1 as v1_1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/events/models/io/argoproj/workflow/v1alpha1.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Any, Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...k8s.api.core import v1 as v1
from ...k8s.api.policy import v1beta1 as v1beta1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/events/models/io/k8s/api/core/v1.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from enum import Enum
from typing import Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...apimachinery.pkg.api import resource as resource
from ...apimachinery.pkg.apis.meta import v1 as v1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/events/models/io/k8s/api/policy/v1beta1.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...apimachinery.pkg.apis.meta import v1 as v1
from ...apimachinery.pkg.util import intstr as intstr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

class Quantity(BaseModel):
__root__: str
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from datetime import datetime
from typing import Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

class CreateOptions(BaseModel):
dry_run: Optional[List[str]]
Expand Down
5 changes: 4 additions & 1 deletion src/hera/events/models/sensor.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from .io.argoproj.events import v1alpha1 as v1alpha1
from .io.k8s.apimachinery.pkg.apis.meta import v1 as v1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/workflows/models/eventsource.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from .io.argoproj.events import v1alpha1 as v1alpha1
from .io.k8s.apimachinery.pkg.apis.meta import v1 as v1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/workflows/models/io/argoproj/events/v1alpha1.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...k8s.api.core import v1 as v1
from ...k8s.apimachinery.pkg.apis.meta import v1 as v1_1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/workflows/models/io/argoproj/workflow/v1alpha1.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Any, Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...k8s.api.core import v1 as v1
from ...k8s.api.policy import v1beta1 as v1beta1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/workflows/models/io/k8s/api/core/v1.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from enum import Enum
from typing import Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...apimachinery.pkg.api import resource as resource
from ...apimachinery.pkg.apis.meta import v1 as v1
Expand Down
5 changes: 4 additions & 1 deletion src/hera/workflows/models/io/k8s/api/policy/v1beta1.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from ...apimachinery.pkg.apis.meta import v1 as v1
from ...apimachinery.pkg.util import intstr as intstr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

class Quantity(BaseModel):
__root__: str
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from datetime import datetime
from typing import Dict, List, Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

class CreateOptions(BaseModel):
dry_run: Optional[List[str]]
Expand Down
5 changes: 4 additions & 1 deletion src/hera/workflows/models/sensor.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from typing import Optional

from hera.shared._pydantic import BaseModel as BaseModel
from hera.shared._pydantic import (
BaseModel as BaseModel,
Field as Field,
)

from .io.argoproj.events import v1alpha1 as v1alpha1
from .io.k8s.apimachinery.pkg.apis.meta import v1 as v1
Expand Down

0 comments on commit 8ddabf3

Please sign in to comment.