zenml-nightly 0.68.0.dev20241027__py3-none-any.whl → 0.68.1.dev20241101__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. README.md +17 -11
  2. RELEASE_NOTES.md +9 -0
  3. zenml/VERSION +1 -1
  4. zenml/__init__.py +1 -1
  5. zenml/analytics/context.py +16 -1
  6. zenml/analytics/utils.py +18 -7
  7. zenml/artifacts/utils.py +40 -216
  8. zenml/cli/__init__.py +63 -90
  9. zenml/cli/base.py +3 -3
  10. zenml/cli/login.py +951 -0
  11. zenml/cli/server.py +462 -353
  12. zenml/cli/service_accounts.py +4 -4
  13. zenml/cli/stack.py +77 -2
  14. zenml/cli/stack_components.py +5 -16
  15. zenml/cli/user_management.py +0 -12
  16. zenml/cli/utils.py +24 -77
  17. zenml/client.py +46 -14
  18. zenml/config/compiler.py +1 -0
  19. zenml/config/global_config.py +9 -0
  20. zenml/config/pipeline_configurations.py +2 -1
  21. zenml/config/pipeline_run_configuration.py +2 -1
  22. zenml/constants.py +3 -9
  23. zenml/enums.py +1 -1
  24. zenml/exceptions.py +11 -0
  25. zenml/integrations/github/code_repositories/github_code_repository.py +1 -1
  26. zenml/login/__init__.py +16 -0
  27. zenml/login/credentials.py +346 -0
  28. zenml/login/credentials_store.py +603 -0
  29. zenml/login/pro/__init__.py +16 -0
  30. zenml/login/pro/client.py +496 -0
  31. zenml/login/pro/constants.py +34 -0
  32. zenml/login/pro/models.py +25 -0
  33. zenml/login/pro/organization/__init__.py +14 -0
  34. zenml/login/pro/organization/client.py +79 -0
  35. zenml/login/pro/organization/models.py +32 -0
  36. zenml/login/pro/tenant/__init__.py +14 -0
  37. zenml/login/pro/tenant/client.py +92 -0
  38. zenml/login/pro/tenant/models.py +174 -0
  39. zenml/login/pro/utils.py +121 -0
  40. zenml/{cli → login}/web_login.py +64 -28
  41. zenml/materializers/base_materializer.py +43 -9
  42. zenml/materializers/built_in_materializer.py +1 -1
  43. zenml/metadata/metadata_types.py +49 -0
  44. zenml/model/model.py +0 -38
  45. zenml/models/__init__.py +3 -0
  46. zenml/models/v2/base/base.py +12 -8
  47. zenml/models/v2/base/filter.py +9 -0
  48. zenml/models/v2/core/artifact_version.py +49 -10
  49. zenml/models/v2/core/component.py +54 -19
  50. zenml/models/v2/core/flavor.py +13 -13
  51. zenml/models/v2/core/model.py +3 -1
  52. zenml/models/v2/core/model_version.py +3 -5
  53. zenml/models/v2/core/model_version_artifact.py +3 -1
  54. zenml/models/v2/core/model_version_pipeline_run.py +3 -1
  55. zenml/models/v2/core/pipeline.py +3 -1
  56. zenml/models/v2/core/pipeline_run.py +23 -1
  57. zenml/models/v2/core/run_template.py +3 -1
  58. zenml/models/v2/core/stack.py +7 -3
  59. zenml/models/v2/core/step_run.py +43 -2
  60. zenml/models/v2/misc/auth_models.py +11 -2
  61. zenml/models/v2/misc/server_models.py +2 -0
  62. zenml/orchestrators/base_orchestrator.py +8 -4
  63. zenml/orchestrators/step_launcher.py +1 -0
  64. zenml/orchestrators/step_run_utils.py +10 -2
  65. zenml/orchestrators/step_runner.py +67 -55
  66. zenml/orchestrators/utils.py +45 -22
  67. zenml/pipelines/pipeline_decorator.py +5 -0
  68. zenml/pipelines/pipeline_definition.py +206 -160
  69. zenml/pipelines/run_utils.py +11 -10
  70. zenml/services/local/local_daemon_entrypoint.py +4 -4
  71. zenml/services/service.py +2 -2
  72. zenml/stack/stack.py +2 -6
  73. zenml/stack/stack_component.py +2 -7
  74. zenml/stack/utils.py +26 -14
  75. zenml/steps/base_step.py +8 -2
  76. zenml/steps/step_context.py +0 -3
  77. zenml/steps/step_invocation.py +14 -5
  78. zenml/steps/utils.py +1 -0
  79. zenml/utils/materializer_utils.py +1 -1
  80. zenml/utils/requirements_utils.py +71 -0
  81. zenml/utils/singleton.py +15 -3
  82. zenml/utils/source_utils.py +39 -2
  83. zenml/utils/visualization_utils.py +1 -1
  84. zenml/zen_server/auth.py +44 -39
  85. zenml/zen_server/deploy/__init__.py +7 -7
  86. zenml/zen_server/deploy/base_provider.py +46 -73
  87. zenml/zen_server/deploy/{local → daemon}/__init__.py +3 -3
  88. zenml/zen_server/deploy/{local/local_provider.py → daemon/daemon_provider.py} +44 -63
  89. zenml/zen_server/deploy/{local/local_zen_server.py → daemon/daemon_zen_server.py} +50 -22
  90. zenml/zen_server/deploy/deployer.py +90 -171
  91. zenml/zen_server/deploy/deployment.py +20 -12
  92. zenml/zen_server/deploy/docker/docker_provider.py +9 -28
  93. zenml/zen_server/deploy/docker/docker_zen_server.py +19 -3
  94. zenml/zen_server/deploy/helm/Chart.yaml +1 -1
  95. zenml/zen_server/deploy/helm/README.md +2 -2
  96. zenml/zen_server/exceptions.py +11 -0
  97. zenml/zen_server/jwt.py +9 -9
  98. zenml/zen_server/routers/auth_endpoints.py +30 -8
  99. zenml/zen_server/routers/stack_components_endpoints.py +1 -1
  100. zenml/zen_server/routers/workspaces_endpoints.py +1 -1
  101. zenml/zen_server/template_execution/runner_entrypoint_configuration.py +7 -4
  102. zenml/zen_server/template_execution/utils.py +6 -61
  103. zenml/zen_server/utils.py +64 -36
  104. zenml/zen_stores/base_zen_store.py +4 -49
  105. zenml/zen_stores/migrations/versions/0.68.1_release.py +23 -0
  106. zenml/zen_stores/migrations/versions/c22561cbb3a9_add_artifact_unique_constraints.py +86 -0
  107. zenml/zen_stores/rest_zen_store.py +325 -147
  108. zenml/zen_stores/schemas/api_key_schemas.py +9 -4
  109. zenml/zen_stores/schemas/artifact_schemas.py +21 -2
  110. zenml/zen_stores/schemas/artifact_visualization_schemas.py +1 -1
  111. zenml/zen_stores/schemas/component_schemas.py +49 -6
  112. zenml/zen_stores/schemas/device_schemas.py +9 -4
  113. zenml/zen_stores/schemas/flavor_schemas.py +1 -1
  114. zenml/zen_stores/schemas/model_schemas.py +1 -1
  115. zenml/zen_stores/schemas/service_schemas.py +1 -1
  116. zenml/zen_stores/schemas/step_run_schemas.py +1 -1
  117. zenml/zen_stores/schemas/trigger_schemas.py +1 -1
  118. zenml/zen_stores/sql_zen_store.py +393 -140
  119. zenml/zen_stores/template_utils.py +3 -1
  120. {zenml_nightly-0.68.0.dev20241027.dist-info → zenml_nightly-0.68.1.dev20241101.dist-info}/METADATA +18 -12
  121. {zenml_nightly-0.68.0.dev20241027.dist-info → zenml_nightly-0.68.1.dev20241101.dist-info}/RECORD +124 -107
  122. zenml/api.py +0 -60
  123. {zenml_nightly-0.68.0.dev20241027.dist-info → zenml_nightly-0.68.1.dev20241101.dist-info}/LICENSE +0 -0
  124. {zenml_nightly-0.68.0.dev20241027.dist-info → zenml_nightly-0.68.1.dev20241101.dist-info}/WHEEL +0 -0
  125. {zenml_nightly-0.68.0.dev20241027.dist-info → zenml_nightly-0.68.1.dev20241101.dist-info}/entry_points.txt +0 -0
zenml/cli/__init__.py CHANGED
@@ -1525,6 +1525,13 @@ If you wish to rename your stack, use the following command:
1525
1525
  zenml stack rename STACK_NAME NEW_STACK_NAME
1526
1526
  ```
1527
1527
 
1528
+ If you would like to export the requirements of your stack, you can
1529
+ use the command:
1530
+
1531
+ ```bash
1532
+ zenml stack export-requirements <STACK_NAME>
1533
+ ```
1534
+
1528
1535
  If you want to copy a stack component, run the following command:
1529
1536
  ```bash
1530
1537
  zenml STACK_COMPONENT copy SOURCE_COMPONENT_NAME TARGET_COMPONENT_NAME
@@ -1803,7 +1810,7 @@ other things. You can start the ZenML dashboard locally by running the following
1803
1810
  command:
1804
1811
 
1805
1812
  ```bash
1806
- zenml up
1813
+ zenml login --local
1807
1814
  ```
1808
1815
 
1809
1816
  This will start the dashboard on your local machine where you can access it at
@@ -1819,18 +1826,18 @@ zenml show
1819
1826
  If you want to stop the dashboard, simply run:
1820
1827
 
1821
1828
  ```bash
1822
- zenml down
1829
+ zenml logout --local
1823
1830
  ```
1824
1831
 
1825
- The `zenml up` command has a few additional options that you can use to
1826
- customize how the ZenML dashboard is running.
1832
+ The `zenml login --local` command has a few additional options that you can use
1833
+ to customize how the ZenML dashboard is running.
1827
1834
 
1828
1835
  By default, the dashboard is started as a background process. On some operating
1829
1836
  systems, this capability is not available. In this case, you can use the
1830
1837
  `--blocking` flag to start the dashboard in the foreground:
1831
1838
 
1832
1839
  ```bash
1833
- zenml up --blocking
1840
+ zenml login --local --blocking
1834
1841
  ```
1835
1842
 
1836
1843
  This will block the terminal until you stop the dashboard with CTRL-C.
@@ -1840,7 +1847,7 @@ run the dashboard in a Docker container. This is useful if you don't want to
1840
1847
  install all the Zenml server dependencies on your machine. To do so, simply run:
1841
1848
 
1842
1849
  ```bash
1843
- zenml up --docker
1850
+ zenml login --local --docker
1844
1851
  ```
1845
1852
 
1846
1853
  The TCP port and the host address that the dashboard uses to listen for
@@ -1853,7 +1860,7 @@ For example, to start the dashboard on port 9000 and have it listen
1853
1860
  on all locally available interfaces on your machine, run:
1854
1861
 
1855
1862
  ```bash
1856
- zenml up --port 9000 --ip-address 0.0.0.0
1863
+ zenml login --local --port 9000 --ip-address 0.0.0.0
1857
1864
  ```
1858
1865
 
1859
1866
  Note that the above 0.0.0.0 IP address also exposes your ZenML dashboard
@@ -1862,68 +1869,58 @@ explicit IP address that is configured on one of your local interfaces, such as
1862
1869
  the Docker bridge interface, which usually has the IP address `172.17.0.1`:
1863
1870
 
1864
1871
  ```bash
1865
- zenml up --port 9000 --ip-address 172.17.0.1
1866
- ```
1867
-
1868
- Connecting to a ZenML Server
1869
- ----------------------------
1870
-
1871
- The ZenML client can be [configured to connect to a remote database or ZenML
1872
- server](https://docs.zenml.io/how-to/connecting-to-zenml)
1873
- with the `zenml connect` command.
1874
-
1875
- To connect to a ZenML server, you can either pass the configuration as command
1876
- line arguments or as a YAML file:
1877
-
1878
- ```bash
1879
- zenml connect --url=https://zenml.example.com:8080 --no-verify-ssl
1872
+ zenml login --local --port 9000 --ip-address 172.17.0.1
1880
1873
  ```
1881
1874
 
1882
- or
1875
+ If you would like to take a look at the logs for the local ZenML server:
1883
1876
 
1884
1877
  ```bash
1885
- zenml connect --config=/path/to/zenml_server_config.yaml
1878
+ zenml logs
1886
1879
  ```
1887
1880
 
1888
- The YAML file should have the following structure when connecting to a ZenML
1889
- server:
1881
+ Connecting to a ZenML Server
1882
+ ----------------------------
1890
1883
 
1891
- ```yaml
1892
- url: <The URL of the ZenML server>
1893
- verify_ssl: |
1894
- <Either a boolean, in which case it controls whether the
1895
- server's TLS certificate is verified, or a string, in which case it
1896
- must be a path to a CA certificate bundle to use or the CA bundle
1897
- value itself>
1898
- ```
1884
+ The ZenML client can be [configured to connect to a local ZenML server, a remote
1885
+ database or a remote ZenML server](https://docs.zenml.io/how-to/connecting-to-zenml)
1886
+ with the `zenml login` command.
1899
1887
 
1900
- Both options can be combined, in which case the command line arguments will
1901
- override the values in the YAML file. For example:
1888
+ To connect or re-connect to any ZenML server, if you know its URL, you can
1889
+ simply run:
1902
1890
 
1903
1891
  ```bash
1904
- zenml connect --no-verify-ssl --config=/path/to/zenml_server_config.yaml
1892
+ zenml login https://zenml.example.com:8080
1905
1893
  ```
1906
1894
 
1895
+ Running `zenml login` without any arguments will check if your current ZenML
1896
+ server session is still valid. If it is not, you will be prompted to log in
1897
+ again. This is useful if you quickly want to refresh your CLI session when
1898
+ the current session expires.
1899
+
1907
1900
  You can open the ZenML dashboard of your currently connected ZenML server using
1908
1901
  the following command:
1909
1902
 
1910
1903
  ```bash
1911
- zenml show
1904
+ zenml server show
1912
1905
  ```
1913
1906
 
1914
- If you would like to take a look at the logs for the ZenML server:
1907
+ Note that if you have set your `AUTO_OPEN_DASHBOARD` environment variable to
1908
+ `false` then this will not open the dashboard until you set it back to `true`.
1909
+
1910
+ The CLI can be authenticated to multiple ZenML servers at the same time,
1911
+ even though it can only be connected to one server at a time. You can list
1912
+ all the ZenML servers that the client is currently authenticated to by
1913
+ running:
1915
1914
 
1916
1915
  ```bash
1917
- zenml logs
1916
+ zenml server list
1918
1917
  ```
1919
1918
 
1920
- Note that if you have set your `AUTO_OPEN_DASHBOARD` environment variable to
1921
- `false` then this will not open the dashboard until you set it back to `true`.
1922
1919
  To disconnect from the current ZenML server and revert to using the local
1923
1920
  default database, use the following command:
1924
1921
 
1925
1922
  ```bash
1926
- zenml disconnect
1923
+ zenml logout
1927
1924
  ```
1928
1925
 
1929
1926
  You can inspect the current ZenML configuration at any given time using the
@@ -1936,53 +1933,28 @@ zenml status
1936
1933
  Example output:
1937
1934
 
1938
1935
  ```
1939
- zenml status
1940
- Running without an active repository root.
1941
- Connected to a ZenML server: 'https://ac8ef63af203226194a7725ee71d85a-7635928635.us-east-1.elb.amazonaws.com'
1942
- The current user is: 'default'
1943
- The active workspace is: 'default' (global)
1944
- The active stack is: 'default' (global)
1945
- The status of the local dashboard:
1946
- ZenML server 'local'
1947
- ┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
1948
- URL │ http://172.17.0.1:9000 ┃
1949
- ┠────────────────┼─────────────────────────────┨
1950
- STATUS │ ✅ ┃
1951
- ┠────────────────┼─────────────────────────────┨
1952
- ┃ STATUS_MESSAGE │ Docker container is running ┃
1953
- ┠────────────────┼─────────────────────────────┨
1954
- ┃ CONNECTED │ ┃
1955
- ┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1956
- ```
1957
-
1958
- The ``zenml connect`` command can also be used to configure your client with
1959
- more advanced options, such as connecting directly to a local or remote SQL
1960
- database. In this case, the `--raw-config` flag must be passed to instruct the
1961
- CLI to not validate or fill in the missing configuration fields. For example,
1962
- to connect to a remote MySQL database, run:
1963
-
1964
- ```bash
1965
- zenml connect --raw-config --config=/path/to/mysql_config.yaml
1966
- ```
1967
-
1968
- with a YAML configuration file that looks like this:
1969
-
1970
- ```yaml
1971
- type: sql
1972
- url: mysql://<username>:<password>@mysql.database.com/<database_name>
1973
- ssl_ca: |
1974
- -----BEGIN CERTIFICATE-----
1975
- ...
1976
- -----END CERTIFICATE-----
1936
+ $ zenml status
1937
+ -----ZenML Client Status-----
1938
+ Connected to a ZenML Pro server: `test-zenml-login` [16f8a35d-5c2f-44aa-a564-b34186fbf6d6]
1939
+ ZenML Pro Organization: My Organization
1940
+ ZenML Pro authentication: valid until 2024-10-26 10:18:51 CEST (in 20h37m9s)
1941
+ Dashboard: https://cloud.zenml.io/organizations/bf873af9-aaf9-4ad1-a08e-3dc6d920d590/tenants/16f8336d-5c2f-44aa-a534-b34186fbf6d6
1942
+ API: https://6784e58f-zenml.staging.cloudinfra.zenml.io
1943
+ Server status: 'available'
1944
+ Server authentication: never expires
1945
+ The active user is: 'user'
1946
+ The active stack is: 'default' (global)
1947
+ Using configuration from: '/home/user/.config/zenml'
1948
+ Local store files are located at: '/home/user/.config/zenml/local_stores'
1977
1949
 
1978
- ssl_cert: null
1979
- ssl_key: null
1980
- ssl_verify_server_cert: false
1950
+ -----Local ZenML Server Status-----
1951
+ The local daemon server is running at: http://127.0.0.1:8237
1981
1952
  ```
1982
1953
 
1983
- Keep in mind, while connecting to a ZenML server, you will be provided with the
1984
- option to `Trust this device`. If you opt out of it a 24-hour token will be
1985
- issued for the authentication service. If you opt-in, you will be issued a 30-day token instead.
1954
+ When connecting to a ZenML server using the web login flow, you will be provided
1955
+ with the option to `Trust this device`. If you opt out of it a 24-hour token
1956
+ will be issued for the authentication service. If you opt-in, you will be
1957
+ issued a 30-day token instead.
1986
1958
 
1987
1959
  If you would like to see a list of all trusted devices, you can use:
1988
1960
 
@@ -2024,8 +1996,8 @@ Depending on how you set up and deployed ZenML, the secrets store keeps secrets
2024
1996
  in the local database or uses the ZenML server your client is connected to:
2025
1997
 
2026
1998
  * if you are using the default ZenML client settings, or if you connect your
2027
- ZenML client to a local ZenML server started with `zenml up`, the secrets store
2028
- is using the same local SQLite database as the rest of ZenML
1999
+ ZenML client to a local ZenML server started with `zenml login --local`, the
2000
+ secrets store is using the same local SQLite database as the rest of ZenML
2029
2001
  * if you connect your ZenML client to a remote ZenML server, the
2030
2002
  secrets are no longer managed on your local machine, but through the remote
2031
2003
  server instead. Secrets are stored in whatever secrets store back-end the
@@ -2259,7 +2231,7 @@ then use the issued API key to connect your ZenML client to the server with the
2259
2231
  CLI:
2260
2232
 
2261
2233
  ```bash
2262
- zenml connect --url https://... --api-key <API_KEY>
2234
+ zenml login https://... --api-key
2263
2235
  ```
2264
2236
 
2265
2237
  or by setting the `ZENML_STORE_URL` and `ZENML_STORE_API_KEY` environment
@@ -2523,6 +2495,7 @@ from zenml.cli.config import * # noqa
2523
2495
  from zenml.cli.downgrade import * # noqa
2524
2496
  from zenml.cli.feature import * # noqa
2525
2497
  from zenml.cli.integration import * # noqa
2498
+ from zenml.cli.login import *
2526
2499
  from zenml.cli.model import * # noqa
2527
2500
  from zenml.cli.model_registry import * # noqa
2528
2501
  from zenml.cli.pipeline import * # noqa
zenml/cli/base.py CHANGED
@@ -361,10 +361,10 @@ def clean(yes: bool = False, local: bool = False) -> None:
361
361
  server = get_local_server()
362
362
 
363
363
  if server:
364
- from zenml.zen_server.deploy.deployer import ServerDeployer
364
+ from zenml.zen_server.deploy.deployer import LocalServerDeployer
365
365
 
366
- deployer = ServerDeployer()
367
- deployer.remove_server(server.config.name)
366
+ deployer = LocalServerDeployer()
367
+ deployer.remove_server()
368
368
  cli_utils.declare("The local ZenML dashboard has been shut down.")
369
369
 
370
370
  # delete the .zen folder