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

Migrate to Pydantic v2 #347

Merged
merged 106 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
7a20bdb
refactor(PipelineConfig): migrate to pydantic v2
sujuka99 Aug 28, 2023
07a5e0f
refactor(helm): migrate to pydantic v2
sujuka99 Aug 28, 2023
cd91350
refactor(kafka connect): migrate to pydantic v2
sujuka99 Aug 28, 2023
c8dd3ab
refactor(base defaults component): migrate to pydantic v2
sujuka99 Aug 28, 2023
c29d5aa
refactor(gen schema): migrate to pydantic v2
sujuka99 Aug 28, 2023
a1084ae
refactor(components): migrate to pydantic v2
sujuka99 Aug 29, 2023
fe1147a
refactor: config classes
sujuka99 Aug 30, 2023
808107b
refactor: kafka connect models
sujuka99 Aug 30, 2023
9b03325
refactor(base_defaults_component): config
sujuka99 Aug 30, 2023
0c292a8
refactor(helm_handler): config
sujuka99 Aug 30, 2023
afa8ad3
refactor(component_handlers): config
sujuka99 Aug 30, 2023
120ba5a
refactor: migrate components to pydantic v2
sujuka99 Aug 30, 2023
11947d8
refactor: Add YAML settings source
sujuka99 Aug 30, 2023
94bcd34
refactor: use `model_config` instead of `Config`
sujuka99 Aug 30, 2023
0b69e79
fix: env vars
sujuka99 Aug 30, 2023
5fe318c
WIP
sujuka99 Aug 31, 2023
c6436a5
fix: WIP model serialization
sujuka99 Sep 1, 2023
922ee1d
fix: model serialization WIP
sujuka99 Sep 10, 2023
5e7fec8
fix: StreamsConfig serialization WIP
sujuka99 Sep 11, 2023
b334457
chore: formatting
sujuka99 Sep 11, 2023
dea8a78
fix: model serialization WIP
sujuka99 Sep 12, 2023
3576aa7
tests: check if serialization works
sujuka99 Oct 3, 2023
5a069e3
fix: hardcode checks for extra topics
sujuka99 Oct 4, 2023
332a4a7
WIP
sujuka99 Oct 4, 2023
b4f6aa0
refactor: update connector app validator
sujuka99 Oct 4, 2023
789b1ea
chore: update deprecated functions to current ones
sujuka99 Oct 4, 2023
4cd0544
chore: lint
sujuka99 Oct 4, 2023
9b7840d
chore: upgrade pydantic
sujuka99 Oct 4, 2023
e039fd8
fix: env vars doc gen
sujuka99 Oct 4, 2023
07aa116
chore: remove unneeded import
sujuka99 Oct 4, 2023
cd2fba3
fix: generation scripts WIP
sujuka99 Oct 4, 2023
325a2fe
fix: schema WIP
sujuka99 Oct 6, 2023
d9839ad
fix: schema generation WIP
sujuka99 Oct 9, 2023
b898a9c
chore: clean up
sujuka99 Oct 9, 2023
d97098b
fix: pipeline schema WIP
sujuka99 Oct 9, 2023
e7b6588
fix: pieline schema WIP
sujuka99 Oct 9, 2023
b220442
fix: schema WIP
sujuka99 Oct 9, 2023
320ad31
fix: schema WIP
sujuka99 Oct 9, 2023
22300ad
Merge remote-tracking branch 'origin/main' into refactor/pydantic-v2
sujuka99 Oct 9, 2023
98b103e
fix: misc errors from merge
sujuka99 Oct 9, 2023
7c81a82
fix: migration errors
sujuka99 Oct 10, 2023
adde6ca
fix: serialization WIP
sujuka99 Oct 10, 2023
995b9e2
Merge remote-tracking branch 'origin/refactor/pydantic-v2' into test/…
sujuka99 Oct 10, 2023
b09633f
misc fixes
sujuka99 Oct 11, 2023
f4ee855
test: remove leftover from playground
sujuka99 Oct 11, 2023
992b6ad
Merge remote-tracking branch 'origin/main' into refactor/pydantic-v2
sujuka99 Oct 11, 2023
e36f622
test: found bug
sujuka99 Oct 11, 2023
a4f508d
fix: pydantic deprecation warnings
sujuka99 Oct 11, 2023
e236873
chore: lint and format
sujuka99 Oct 11, 2023
b30b9d2
Merge remote-tracking branch 'origin/main' into refactor/pydantic-v2
sujuka99 Oct 19, 2023
a6b10e3
refactor: Custom schema gen WIP
sujuka99 Oct 19, 2023
7571d75
Merge remote-tracking branch 'origin/main' into refactor/pydantic-v2
sujuka99 Oct 23, 2023
abe4955
Merge remote-tracking branch 'origin/main' into refactor/pydantic-v2
sujuka99 Oct 24, 2023
4b6a6ec
Merge remote-tracking branch 'origin/v3' into refactor/pydantic-v2
sujuka99 Oct 24, 2023
542f8a1
test: update snapshot of example
sujuka99 Oct 24, 2023
db7abbf
test: update test pipeline snapshot
sujuka99 Oct 24, 2023
78001a2
fix: adapt to new AnyHttpUrl and pydantic v2 validation
sujuka99 Oct 24, 2023
f80d6e8
fix: update deprecated code
sujuka99 Oct 24, 2023
0bd0395
fix: json schema KafkaConnectorConfig
sujuka99 Oct 24, 2023
5db5586
chore: comment, update func name
sujuka99 Oct 24, 2023
776d7bb
Merge remote-tracking branch 'origin/v3' into refactor/pydantic-v2
sujuka99 Oct 30, 2023
d2c0527
chore: refactor, comment
sujuka99 Oct 30, 2023
18defbb
WIP schema generation
disrupted Oct 30, 2023
3d821e2
Use `pydantic.RootModel` for pipeline components union
disrupted Oct 30, 2023
e19c4de
Cleanup schema generator
disrupted Oct 30, 2023
b731b6c
Cleanup generated schema
disrupted Oct 30, 2023
0c803c4
Cleanup generated schema: hide discriminator field
disrupted Oct 30, 2023
dac09bc
Update test snapshot
disrupted Oct 30, 2023
566deba
Refactor schema generation
disrupted Oct 30, 2023
f0791fc
Fix format
disrupted Oct 30, 2023
6ad04c8
Fix Pyright diagnostics
disrupted Oct 30, 2023
b8cf538
chore: add comment
sujuka99 Oct 31, 2023
9788ab4
feat: Introduce functions that mimick the ``model_dump`` capabilities
sujuka99 Nov 2, 2023
d8337ca
refactor: add serializers
sujuka99 Nov 2, 2023
268d2c7
refactor: get rid of unneeded validator input
sujuka99 Nov 2, 2023
eddd4f8
feat: enable nested env vars
sujuka99 Nov 2, 2023
be30a0f
chore: remove todo, yaml source seems tested already
sujuka99 Nov 2, 2023
c3cf11b
style: fix todo messages
sujuka99 Nov 2, 2023
242986c
chore: comment
sujuka99 Nov 2, 2023
d079008
feat: Add dotenv support
sujuka99 Nov 3, 2023
94b17f5
feat: Allow custom paths to multiple dotenv files, test
sujuka99 Nov 3, 2023
ca44254
docs: update dotenv information
sujuka99 Nov 3, 2023
85e3085
tests: pass
sujuka99 Nov 3, 2023
96d8880
Add missing HelmApp docs
disrupted Oct 31, 2023
b57ed0e
Merge remote-tracking branch 'origin/v3' into refactor/pydantic-v2
sujuka99 Nov 3, 2023
f4bb546
misc: feedback and enable config schema gen
sujuka99 Nov 8, 2023
fd96130
refactor: move yaml settings source to pydantic module
sujuka99 Nov 8, 2023
f91ab02
refactor: `by_alias` rotate parameters
sujuka99 Nov 8, 2023
3bd9bd8
style: lowercase apps
sujuka99 Nov 8, 2023
9206cb0
fix: add missing arg in model serializer
sujuka99 Nov 8, 2023
356adb9
refactor: Add generic type to pydantic module
sujuka99 Nov 8, 2023
4a46d3a
chore: remove old comment
sujuka99 Nov 8, 2023
dc2f3d7
fix: Allow any type of data under `app.streams.config`
sujuka99 Nov 9, 2023
683986e
test: add temp test for name trimming
sujuka99 Nov 9, 2023
d6ea12a
chore: update dependencies
sujuka99 Nov 27, 2023
db3701c
chore: update lock file
sujuka99 Nov 30, 2023
9ec5757
Revert optional connector name
disrupted Dec 7, 2023
1192c2b
refactor: hide connector name from schema
sujuka99 Dec 7, 2023
10d7b54
chore: bum ruff version
sujuka99 Dec 7, 2023
4c8c75e
Change Kafka topic configs value type to `Any`
disrupted Dec 7, 2023
82e025f
Trigger CI
disrupted Dec 11, 2023
a19827f
Merge remote-tracking branch 'origin/v3' into refactor/pydantic-v2
sujuka99 Dec 11, 2023
94d3f9a
Format
disrupted Dec 11, 2023
b82dd58
Fix docs index indentation
disrupted Dec 11, 2023
8ddb8d8
Fix documentation generation (#384)
sujuka99 Dec 12, 2023
11f7f05
refactor: narrow down type hints
sujuka99 Dec 12, 2023
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
3 changes: 3 additions & 0 deletions docs/docs/resources/variables/cli_env_vars.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ KPOPS_PIPELINE_BASE_DIR=.
KPOPS_CONFIG_PATH=config.yaml
# Path to defaults folder
KPOPS_DEFAULT_PATH # No default value, not required
# Path to dotenvfile. Multiple files can be provided. The files will
# be loaded in order, with each file overriding the previous one.
KPOPS_DOTENV_PATH # No default value, not required
# Path to YAML with pipeline definition
KPOPS_PIPELINE_PATH # No default value, required
# Comma separated list of steps to apply the command on
Expand Down
15 changes: 8 additions & 7 deletions docs/docs/resources/variables/cli_env_vars.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
These variables are a lower priority alternative to the commands' flags. If a variable is set, the corresponding flag does not have to be specified in commands. Variables marked as required can instead be set as flags.

| Name |Default Value|Required| Description |
|-----------------------|-------------|--------|----------------------------------------------------------------------|
|KPOPS_PIPELINE_BASE_DIR|. |False |Base directory to the pipelines (default is current working directory)|
|KPOPS_CONFIG_PATH |config.yaml |False |Path to the config.yaml file |
|KPOPS_DEFAULT_PATH | |False |Path to defaults folder |
|KPOPS_PIPELINE_PATH | |True |Path to YAML with pipeline definition |
|KPOPS_PIPELINE_STEPS | |False |Comma separated list of steps to apply the command on |
| Name |Default Value|Required| Description |
|-----------------------|-------------|--------|----------------------------------------------------------------------------------------------------------------------------------|
|KPOPS_PIPELINE_BASE_DIR|. |False |Base directory to the pipelines (default is current working directory) |
|KPOPS_CONFIG_PATH |config.yaml |False |Path to the config.yaml file |
|KPOPS_DEFAULT_PATH | |False |Path to defaults folder |
|KPOPS_DOTENV_PATH | |False |Path to dotenvfile. Multiple files can be provided. The files will be loaded in order, with each file overriding the previous one.|
|KPOPS_PIPELINE_PATH | |True |Path to YAML with pipeline definition |
|KPOPS_PIPELINE_STEPS | |False |Comma separated list of steps to apply the command on |
49 changes: 36 additions & 13 deletions docs/docs/resources/variables/config_env_vars.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,51 @@
# alternative to the settings in `config.yaml`. Variables marked as
# required can instead be set in the pipeline config.
#
# defaults_path
# The path to the folder containing the defaults.yaml file and the
# environment defaults files. Paths can either be absolute or relative
# to `config.yaml`
defaults_path=.
# environment
# The environment you want to generate and deploy the pipeline to.
# Suffix your environment files with this value (e.g.
# defaults_development.yaml for environment=development).
KPOPS_ENVIRONMENT # No default value, required
environment=PydanticUndefined
# kafka_brokers
# The comma separated Kafka brokers address.
KPOPS_KAFKA_BROKERS # No default value, required
# url
# Address of the Schema Registry.
KPOPS_SCHEMA_REGISTRY_URL=http://localhost:8081
# url
# Address of the Kafka REST Proxy.
KPOPS_KAFKA_REST_URL=http://localhost:8082
# url
# Address of Kafka Connect.
KPOPS_KAFKA_CONNECT_URL=http://localhost:8083
kafka_brokers=PydanticUndefined
# defaults_filename_prefix
# The name of the defaults file and the prefix of the defaults
# environment file.
defaults_filename_prefix=defaults
# topic_name_config
# Configure the topic name variables you can use in the pipeline
# definition.
topic_name_config=default_output_topic_name='${pipeline_name}-${component_name}' default_error_topic_name='${pipeline_name}-${component_name}-error'
# schema_registry
# Configuration for Schema Registry.
schema_registry=enabled=False url=Url('http://localhost:8081/')
# kafka_rest
# Configuration for Kafka REST Proxy.
kafka_rest=url=Url('http://localhost:8082/')
# kafka_connect
# Configuration for Kafka Connect.
kafka_connect=url=Url('http://localhost:8083/')
# timeout
# The timeout in seconds that specifies when actions like deletion or
# deploy timeout.
KPOPS_TIMEOUT=300
timeout=300
# create_namespace
# Flag for `helm upgrade --install`. Create the release namespace if
# not present.
create_namespace=False
# helm_config
# Global flags for Helm.
helm_config=context=None debug=False api_version=None
# helm_diff_config
# Configure Helm Diff.
helm_diff_config=ignore=set()
# retain_clean_jobs
# Whether to retain clean up jobs in the cluster or uninstall the,
# after completion.
KPOPS_RETAIN_CLEAN_JOBS=False
retain_clean_jobs=False
24 changes: 15 additions & 9 deletions docs/docs/resources/variables/config_env_vars.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
These variables are a lower priority alternative to the settings in `config.yaml`. Variables marked as required can instead be set in the pipeline config.

| Name | Default Value |Required| Description | Setting name |
|-------------------------|---------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|
|KPOPS_ENVIRONMENT | |True |The environment you want to generate and deploy the pipeline to. Suffix your environment files with this value (e.g. defaults_development.yaml for environment=development).|environment |
|KPOPS_KAFKA_BROKERS | |True |The comma separated Kafka brokers address. |kafka_brokers |
|KPOPS_SCHEMA_REGISTRY_URL|http://localhost:8081|False |Address of the Schema Registry. |url |
|KPOPS_KAFKA_REST_URL |http://localhost:8082|False |Address of the Kafka REST Proxy. |url |
|KPOPS_KAFKA_CONNECT_URL |http://localhost:8083|False |Address of Kafka Connect. |url |
|KPOPS_TIMEOUT |300 |False |The timeout in seconds that specifies when actions like deletion or deploy timeout. |timeout |
|KPOPS_RETAIN_CLEAN_JOBS |False |False |Whether to retain clean up jobs in the cluster or uninstall the, after completion. |retain_clean_jobs|
| Name | Default Value |Required| Description | Setting name |
|------------------------|----------------------------------------------------------------------------------------------------------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------|
|defaults_path |. |False |The path to the folder containing the defaults.yaml file and the environment defaults files. Paths can either be absolute or relative to `config.yaml` |defaults_path |
|environment |PydanticUndefined |False |The environment you want to generate and deploy the pipeline to. Suffix your environment files with this value (e.g. defaults_development.yaml for environment=development).|environment |
|kafka_brokers |PydanticUndefined |False |The comma separated Kafka brokers address. |kafka_brokers |
|defaults_filename_prefix|defaults |False |The name of the defaults file and the prefix of the defaults environment file. |defaults_filename_prefix|
|topic_name_config |default_output_topic_name='${pipeline_name}-${component_name}' default_error_topic_name='${pipeline_name}-${component_name}-error'|False |Configure the topic name variables you can use in the pipeline definition. |topic_name_config |
|schema_registry |enabled=False url=Url('http://localhost:8081/') |False |Configuration for Schema Registry. |schema_registry |
|kafka_rest |url=Url('http://localhost:8082/') |False |Configuration for Kafka REST Proxy. |kafka_rest |
|kafka_connect |url=Url('http://localhost:8083/') |False |Configuration for Kafka Connect. |kafka_connect |
|timeout |300 |False |The timeout in seconds that specifies when actions like deletion or deploy timeout. |timeout |
|create_namespace |False |False |Flag for `helm upgrade --install`. Create the release namespace if not present. |create_namespace |
|helm_config |context=None debug=False api_version=None |False |Global flags for Helm. |helm_config |
|helm_diff_config |ignore=set() |False |Configure Helm Diff. |helm_diff_config |
|retain_clean_jobs |False |False |Whether to retain clean up jobs in the cluster or uninstall the, after completion. |retain_clean_jobs |
32 changes: 26 additions & 6 deletions docs/docs/schema/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,33 @@
"description": "Global Helm configuration.",
"properties": {
"api_version": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Kubernetes API version used for Capabilities.APIVersions",
"title": "API version",
"type": "string"
"title": "API version"
},
"context": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Name of kubeconfig context (`--kube-context`)",
"example": "dev-storage",
"title": "Context",
"type": "string"
"examples": [
"dev-storage"
],
"title": "Context"
},
"debug": {
"default": false,
Expand All @@ -29,7 +47,9 @@
"properties": {
"ignore": {
"description": "Set of keys that should not be checked.",
"example": "- name\n- imageTag",
"examples": [
"- name\n- imageTag"
],
"items": {
"type": "string"
},
Expand Down
Loading