diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 2db5f66..599bbf2 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -37,7 +37,7 @@ jobs: python-version: '3.10' - name: Install hatch - run: pip install hatch==1.9.4 + run: pip install hatch==1.15.0 - name: Fetch relevant branches run: | diff --git a/.github/workflows/downstreams.yml b/.github/workflows/downstreams.yml index be8cc56..97f3ef2 100644 --- a/.github/workflows/downstreams.yml +++ b/.github/workflows/downstreams.yml @@ -44,7 +44,7 @@ jobs: - name: Install toolchain run: | - pip install hatch==1.9.4 + pip install hatch==1.15.0 - name: Downstreams uses: databrickslabs/sandbox/downstreams@acceptance/v0.4.2 with: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5a4742b..0498aeb 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -32,7 +32,7 @@ jobs: python-version: '3.10' - name: Install hatch - run: pip install hatch==1.9.4 + run: pip install hatch==1.15.0 - name: Run nightly tests uses: databrickslabs/sandbox/acceptance@acceptance/v0.4.2 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 775b45f..408cf04 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -15,7 +15,7 @@ on: - main env: - HATCH_VERSION: 1.9.4 + HATCH_VERSION: 1.15.0 jobs: ci: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b0bdfa..8d779a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: - name: Build wheels run: | - pip install hatch==1.9.4 + pip install hatch==1.15.0 hatch build - name: Draft release diff --git a/README.md b/README.md index 3a00716..41048d1 100644 --- a/README.md +++ b/README.md @@ -989,7 +989,7 @@ Keyword Arguments: Usage: ```python def test_storage_credential(env_or_skip, make_storage_credential, make_random): - random = make_random(6).lower() + random = make_random(8).lower() credential_name = f"dummy-{random}" make_storage_credential( credential_name=credential_name, @@ -1021,7 +1021,7 @@ def test_volume_creation(make_catalog, make_schema, make_volume, make_random): schema = make_schema(catalog_name=catalog.name) # Generate a random name for the volume - volume_name = f"dummy_vol_{make_random(6).lower()}" + volume_name = f"dummy_vol_{make_random(8).lower()}" # Create the volume volume = make_volume( diff --git a/src/databricks/labs/pytester/fixtures/catalog.py b/src/databricks/labs/pytester/fixtures/catalog.py index 2f88a43..37656f4 100644 --- a/src/databricks/labs/pytester/fixtures/catalog.py +++ b/src/databricks/labs/pytester/fixtures/catalog.py @@ -122,7 +122,7 @@ def create( # pylint: disable=too-many-locals,too-many-arguments,too-many-state schema = make_schema(catalog_name=catalog_name) catalog_name = schema.catalog_name schema_name = schema.name - name = name or f"dummy_t{make_random(4).lower()}" + name = name or f"dummy_t{make_random(8).lower()}" table_type: TableType | None = None data_source_format = None storage_location = None @@ -267,7 +267,7 @@ def test_catalog_fixture(make_catalog, make_schema, make_table): def create( *, catalog_name: str = "hive_metastore", name: str | None = None, location: str | None = None ) -> SchemaInfo: - name = name or f"dummy_s{make_random(4)}".lower() + name = name or f"dummy_s{make_random(8)}".lower() full_name = f"{catalog_name}.{name}".lower() schema_ddl = f"CREATE SCHEMA {full_name}" if location: @@ -307,7 +307,7 @@ def test_catalog_fixture(make_catalog, make_schema, make_table): """ def create(*, name: str | None = None) -> CatalogInfo: - name = name or f"dummy_c{make_random(4)}".lower() + name = name or f"dummy_c{make_random(8)}".lower() catalog_info = ws.catalogs.create(name=name, properties={"RemoveAfter": watchdog_remove_after}) if isinstance(catalog_info, Mock): catalog_info.name = name @@ -359,7 +359,7 @@ def create( catalog_name = schema.catalog_name schema_name = schema.name - name = name or f"dummy_f{make_random(4)}".lower() + name = name or f"dummy_f{make_random(8)}".lower() # Note: the Watchdog does not explicitly scan for functions; they are purged along with their parent schema. # As such the function can't be marked (and doesn't need to be if the schema as marked) for purge protection. @@ -409,7 +409,7 @@ def make_storage_credential(ws, watchdog_remove_after) -> Generator[Callable[... Usage: ```python def test_storage_credential(env_or_skip, make_storage_credential, make_random): - random = make_random(6).lower() + random = make_random(8).lower() credential_name = f"dummy-{random}" make_storage_credential( credential_name=credential_name, @@ -471,7 +471,7 @@ def test_volume_creation(make_catalog, make_schema, make_volume, make_random): schema = make_schema(catalog_name=catalog.name) # Generate a random name for the volume - volume_name = f"dummy_vol_{make_random(6).lower()}" + volume_name = f"dummy_vol_{make_random(8).lower()}" # Create the volume volume = make_volume( @@ -498,7 +498,7 @@ def create( schema_name = schema.name if not name: - name = f"dummy_v{make_random(6).lower()}" + name = f"dummy_v{make_random(8).lower()}" volume_info = ws.volumes.create( catalog_name=catalog_name, diff --git a/src/databricks/labs/pytester/fixtures/compute.py b/src/databricks/labs/pytester/fixtures/compute.py index e600130..a4ea066 100644 --- a/src/databricks/labs/pytester/fixtures/compute.py +++ b/src/databricks/labs/pytester/fixtures/compute.py @@ -48,7 +48,7 @@ def test_cluster_policy(make_cluster_policy): def create(*, name: str | None = None, **kwargs) -> CreatePolicyResponse: if name is None: - name = f"dummy-{make_random(4)}-{watchdog_purge_suffix}" + name = f"dummy-{make_random(8)}-{watchdog_purge_suffix}" if "definition" not in kwargs: kwargs["definition"] = json.dumps( { @@ -92,7 +92,7 @@ def create( **kwargs, ) -> Wait[ClusterDetails]: if cluster_name is None: - cluster_name = f"dummy-{make_random(4)}" + cluster_name = f"dummy-{make_random(8)}" if spark_version is None: spark_version = ws.clusters.select_spark_version(latest=True) if single_node: @@ -148,7 +148,7 @@ def test_instance_pool(make_instance_pool): def create(*, instance_pool_name=None, node_type_id=None, **kwargs) -> CreateInstancePoolResponse: if instance_pool_name is None: - instance_pool_name = f"dummy-{make_random(4)}" + instance_pool_name = f"dummy-{make_random(8)}" if node_type_id is None: node_type_id = ws.clusters.select_node_type(local_disk=True, min_memory_gb=16) pool = ws.instance_pools.create( @@ -223,7 +223,7 @@ def create( # pylint: disable=too-many-arguments raise ValueError( "The `tasks` parameter is exclusive with the `path`, `content` `spark_conf` and `libraries` parameters." ) - name = name or f"dummy-j{make_random(4)}" + name = name or f"dummy-j{make_random(8)}" tags = tags or {} tags["RemoveAfter"] = tags.get("RemoveAfter", watchdog_remove_after) if not tasks: @@ -231,8 +231,8 @@ def create( # pylint: disable=too-many-arguments if instance_pool_id is None: node_type_id = ws.clusters.select_node_type(local_disk=True, min_memory_gb=16) task = Task( - task_key=make_random(4), - description=make_random(4), + task_key=make_random(8), + description=make_random(8), new_cluster=ClusterSpec( num_workers=1, node_type_id=node_type_id, @@ -292,7 +292,7 @@ def test_pipeline(make_pipeline, make_pipeline_permissions, make_group): def create(**kwargs) -> CreatePipelineResponse: if "name" not in kwargs: - kwargs["name"] = f"sdk-{make_random(4)}-{watchdog_purge_suffix}" + kwargs["name"] = f"sdk-{make_random(8)}-{watchdog_purge_suffix}" if "libraries" not in kwargs: notebook_library = NotebookLibrary(path=make_notebook().as_posix()) kwargs["libraries"] = [PipelineLibrary(notebook=notebook_library)] @@ -342,7 +342,7 @@ def create( **kwargs, ) -> Wait[GetWarehouseResponse]: if warehouse_name is None: - warehouse_name = f"dummy-{make_random(4)}" + warehouse_name = f"dummy-{make_random(8)}" if warehouse_type is None: warehouse_type = CreateWarehouseRequestWarehouseType.PRO if cluster_size is None: diff --git a/src/databricks/labs/pytester/fixtures/iam.py b/src/databricks/labs/pytester/fixtures/iam.py index a411a58..aa26775 100644 --- a/src/databricks/labs/pytester/fixtures/iam.py +++ b/src/databricks/labs/pytester/fixtures/iam.py @@ -49,7 +49,7 @@ def test_new_user(make_user, ws): @retried(on=[ResourceConflict], timeout=timedelta(seconds=30)) def create(**kwargs) -> User: - user_name = f"dummy-{make_random(4)}-{watchdog_purge_suffix}@example.com".lower() + user_name = f"dummy-{make_random(8)}-{watchdog_purge_suffix}@example.com".lower() user = ws.users.create(user_name=user_name, **kwargs) log_workspace_link(user.user_name, f'settings/workspace/identity-and-access/users/{user.id}') return user @@ -171,7 +171,7 @@ def create( **kwargs, ): kwargs["display_name"] = ( - f"sdk-{make_random(4)}-{watchdog_purge_suffix}" if display_name is None else display_name + f"sdk-{make_random(8)}-{watchdog_purge_suffix}" if display_name is None else display_name ) if members is not None: kwargs["members"] = _scim_values(members) diff --git a/src/databricks/labs/pytester/fixtures/ml.py b/src/databricks/labs/pytester/fixtures/ml.py index d5c62da..72b3e7a 100644 --- a/src/databricks/labs/pytester/fixtures/ml.py +++ b/src/databricks/labs/pytester/fixtures/ml.py @@ -61,7 +61,7 @@ def create( folder = make_directory(path=path) if experiment_name is None: # The purge suffix is needed here as well, just in case the path was supplied. - experiment_name = f"dummy-{make_random(4)}-{watchdog_purge_suffix}" + experiment_name = f"dummy-{make_random(8)}-{watchdog_purge_suffix}" experiment = ws.experiments.create_experiment(name=f"{folder}/{experiment_name}", **kwargs) log_workspace_link(f'{experiment_name} experiment', f'ml/experiments/{experiment.experiment_id}', anchor=False) return experiment @@ -95,7 +95,7 @@ def test_models(make_group, make_model, make_registered_model_permissions): def create(*, model_name: str | None = None, **kwargs) -> ModelDatabricks: if model_name is None: - model_name = f"dummy-{make_random(4)}" + model_name = f"dummy-{make_random(8)}" remove_after_tag = ModelTag(key="RemoveAfter", value=watchdog_remove_after) if 'tags' not in kwargs: kwargs["tags"] = [remove_after_tag] @@ -143,7 +143,7 @@ def create( model_name: str | None = None, model_version: str | None = None, ) -> Wait[ServingEndpointDetailed]: - endpoint_name = endpoint_name or make_random(4) + endpoint_name = endpoint_name or make_random(8) model_name = model_name or "system.ai.llama_v3_2_1b_instruct" if not model_version and "." not in model_name: # The period in the name signals it is NOT workspace local try: diff --git a/src/databricks/labs/pytester/fixtures/redash.py b/src/databricks/labs/pytester/fixtures/redash.py index 90934e8..2b56c53 100644 --- a/src/databricks/labs/pytester/fixtures/redash.py +++ b/src/databricks/labs/pytester/fixtures/redash.py @@ -51,7 +51,7 @@ def create(*, sql_query: str | None = None, **kwargs) -> LegacyQuery: tags.append(remove_after_tag) else: tags = [remove_after_tag] - query_name = f"dummy_query_Q{make_random(4)}" + query_name = f"dummy_query_Q{make_random(8)}" query = ws.queries_legacy.create( name=query_name, description="Test query", diff --git a/src/databricks/labs/pytester/fixtures/secrets.py b/src/databricks/labs/pytester/fixtures/secrets.py index 9259d9c..6ac5f21 100644 --- a/src/databricks/labs/pytester/fixtures/secrets.py +++ b/src/databricks/labs/pytester/fixtures/secrets.py @@ -21,7 +21,7 @@ def test_secret_scope_creation(make_secret_scope): """ def create(**kwargs): - name = f"dummy-{make_random(4)}" + name = f"dummy-{make_random(8)}" ws.secrets.create_scope(name, **kwargs) return name diff --git a/src/databricks/labs/pytester/fixtures/workspace.py b/src/databricks/labs/pytester/fixtures/workspace.py index b0ac751..50704f5 100644 --- a/src/databricks/labs/pytester/fixtures/workspace.py +++ b/src/databricks/labs/pytester/fixtures/workspace.py @@ -57,7 +57,7 @@ def create( else: raise ValueError(f"Unsupported language: {language}") current_user = ws.current_user.me() - path = path or f"/Users/{current_user.user_name}/dummy-{make_random(4)}-{watchdog_purge_suffix}" + path = path or f"/Users/{current_user.user_name}/dummy-{make_random(8)}-{watchdog_purge_suffix}" workspace_path = WorkspacePath(ws, path) if '@' not in current_user.user_name: # If current user is a service principal added with `make_run_as`, there might be no home folder @@ -115,7 +115,7 @@ def create( else: raise ValueError(f"Unsupported language: {language}") current_user = ws.current_user.me() - path = path or f"/Users/{current_user.user_name}/dummy-{make_random(4)}-{watchdog_purge_suffix}{suffix}" + path = path or f"/Users/{current_user.user_name}/dummy-{make_random(8)}-{watchdog_purge_suffix}{suffix}" content = content or default_content encoding = encoding or _DEFAULT_ENCODING workspace_path = WorkspacePath(ws, path) @@ -159,7 +159,7 @@ def test_creates_some_folder_with_a_notebook(make_directory, make_notebook): def create(*, path: str | Path | None = None) -> WorkspacePath: if path is None: - path = f"~/dummy-{make_random(4)}-{watchdog_purge_suffix}" + path = f"~/dummy-{make_random(8)}-{watchdog_purge_suffix}" workspace_path = WorkspacePath(ws, path).expanduser() workspace_path.mkdir(exist_ok=True) logger.info(f"Created folder: {workspace_path.as_uri()}") @@ -188,7 +188,7 @@ def test_repo(make_repo): def create(*, url=None, provider=None, path=None, **kwargs) -> RepoInfo: if path is None: - path = f"/Repos/{ws.current_user.me().user_name}/sdk-{make_random(4)}-{watchdog_purge_suffix}" + path = f"/Repos/{ws.current_user.me().user_name}/sdk-{make_random(8)}-{watchdog_purge_suffix}" if url is None: url = "https://github.com/shreyas-goenka/empty-repo.git" if provider is None: diff --git a/tests/integration/fixtures/test_catalog.py b/tests/integration/fixtures/test_catalog.py index 1f18986..c3ceac1 100644 --- a/tests/integration/fixtures/test_catalog.py +++ b/tests/integration/fixtures/test_catalog.py @@ -21,7 +21,7 @@ def test_schema_fixture(make_schema): def test_managed_schema_fixture(make_schema, make_random, env_or_skip): schema_name = f"dummy_s{make_random(4)}".lower() schema_location = f"{env_or_skip('TEST_MOUNT_CONTAINER')}/a/{schema_name}" - logger.info(f"Created new schema: {make_schema(location = schema_location)}") + logger.info(f"Created new schema: {make_schema(location=schema_location)}") def test_new_managed_table_in_new_schema(make_table):