Skip to content

Commit

Permalink
Merge pull request #542 from atlanhq/APP-5633
Browse files Browse the repository at this point in the history
APP-5633: Updated deps to the latest version (main + dev)
  • Loading branch information
Aryamanz29 authored Feb 25, 2025
2 parents 9ec885e + 067c117 commit 1d21e02
Show file tree
Hide file tree
Showing 104 changed files with 341 additions and 473 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/pyatlan-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: QA checks (black, flake8, mypy)
- name: QA checks (ruff-format, ruff-lint, mypy)
run: |
./qa-checks
- name: Run unit tests
env: # Test tenant environment variables
ATLAN_API_KEY: ${{ secrets.ATLAN_API_KEY }}
ATLAN_BASE_URL: ${{ secrets.ATLAN_BASE_URL }}
MARK_API_KEY: ${{ secrets.MARK_ATLAN_API_KEY }}
MARK_BASE_URL: https://mark.atlan.com
# Run with `pytest-sugar` for enhancing the overall test report output
run: pytest tests/unit --force-sugar

Expand Down
41 changes: 8 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements

- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.7
hooks:
- id: autoflake
args: [--ignore-init-module-imports, --remove-all-unused-imports, --remove-unused-variables, --in-place]
language_version: python3

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: ["flake8-bandit", "flake8-bugbear"]

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
language_version: python3

- repo: local
hooks:
- id: tests
name: run tests
entry: pytest
language: system
types: [python]
stages: [push]
- id: ruff
name: ruff-sort-imports
args: [--select, I, --fix]
- id: ruff
- id: ruff-format
3 changes: 1 addition & 2 deletions pyatlan/cache/connection_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ def lookup_by_name(self, name: ConnectionName) -> None:
if len(results) > 1:
LOGGER.warning(
(
"Found multiple connections of the same type "
"with the same name, caching only the first: %s"
"Found multiple connections of the same type with the same name, caching only the first: %s"
),
name,
)
Expand Down
18 changes: 11 additions & 7 deletions pyatlan/client/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@ def _handle_relationships(self, raw_json):

@validate_arguments
def retrieve_minimal(
self, guid: str, asset_type: Type[A] = Asset # type: ignore[assignment]
self,
guid: str,
asset_type: Type[A] = Asset, # type: ignore[assignment]
) -> A:
"""
Retrieves an asset by its GUID, without any of its relationships.
Expand Down Expand Up @@ -599,8 +601,7 @@ def upsert_merging_cm(
) -> AssetMutationResponse:
"""Deprecated - use save_merging_cm() instead."""
warn(
"This method is deprecated, please use 'save_merging_cm' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'save_merging_cm' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -658,8 +659,7 @@ def upsert_replacing_cm(
) -> AssetMutationResponse:
"""Deprecated - use save_replacing_cm() instead."""
warn(
"This method is deprecated, please use 'save_replacing_cm' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'save_replacing_cm' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -1603,7 +1603,9 @@ def find_glossary_by_name(
def find_category_fast_by_name(
self,
name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr( # type: ignore
strip_whitespace=True, min_length=1, strict=True
),
attributes: Optional[List[StrictStr]] = None,
) -> List[AtlasGlossaryCategory]:
"""
Expand Down Expand Up @@ -1699,7 +1701,9 @@ def _search_for_asset_with_name(
def find_term_fast_by_name(
self,
name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr( # type: ignore
strip_whitespace=True, min_length=1, strict=True
),
attributes: Optional[List[StrictStr]] = None,
) -> AtlasGlossaryTerm:
"""
Expand Down
42 changes: 19 additions & 23 deletions pyatlan/client/atlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,7 @@ def get_roles(
def get_all_roles(self) -> RoleResponse:
"""Deprecated - use self.role.get_all() instead."""
warn(
"This method is deprecated, please use 'self.role.get_all' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'self.role.get_all' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -783,8 +782,7 @@ def get_groups_for_user(
) -> GroupResponse:
"""Deprecated - use user.get_groups() instead."""
warn(
"This method is deprecated, please use 'user.get_groups' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'user.get_groups' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -797,8 +795,7 @@ def add_user_to_groups(
) -> None:
"""Deprecated - use user.add_to_groups() instead."""
warn(
"This method is deprecated, please use 'user.add_to_groups' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'user.add_to_groups' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -811,8 +808,7 @@ def change_user_role(
) -> None:
"""Deprecated - use user.change_role() instead."""
warn(
"This method is deprecated, please use 'user.change_role' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'user.change_role' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -823,8 +819,7 @@ def get_current_user(
) -> UserMinimalResponse:
"""Deprecated - use user.get_current() instead."""
warn(
"This method is deprecated, please use 'user.get_current' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'user.get_current' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -867,8 +862,7 @@ def get_users_by_email(
) -> Optional[List[AtlanUser]]:
"""Deprecated - use user.get_by_email() instead."""
warn(
"This method is deprecated, please use 'user.get_by_email' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'user.get_by_email' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -932,8 +926,7 @@ def get_asset_by_guid(
) -> A:
"""Deprecated - use asset.get_by_guid() instead."""
warn(
"This method is deprecated, please use 'asset.get_by_guid' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'asset.get_by_guid' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -1106,8 +1099,7 @@ def delete_entity_by_guid(
def restore(self, asset_type: Type[A], qualified_name: str) -> bool:
"""Deprecated - use asset.restore() instead."""
warn(
"This method is deprecated, please use 'asset.restore' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'asset.restore' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -1590,7 +1582,9 @@ def find_glossary_by_name(
def find_category_fast_by_name(
self,
name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr( # type: ignore
strip_whitespace=True, min_length=1, strict=True
),
attributes: Optional[List[StrictStr]] = None,
) -> List[AtlasGlossaryCategory]:
"""Deprecated - use asset.find_category_fast_by_name() instead."""
Expand Down Expand Up @@ -1628,7 +1622,9 @@ def find_category_by_name(
def find_term_fast_by_name(
self,
name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr(strip_whitespace=True, min_length=1, strict=True), # type: ignore
glossary_qualified_name: constr( # type: ignore
strip_whitespace=True, min_length=1, strict=True
),
attributes: Optional[List[StrictStr]] = None,
) -> AtlasGlossaryTerm:
"""Deprecated - use asset.find_category_by_name() instead."""
Expand Down Expand Up @@ -1672,8 +1668,8 @@ def max_retries(
adapter = self._session.adapters[HTTP_PREFIX]
else:
adapter = self._session.adapters[HTTPS_PREFIX]
current_max = adapter.max_retries
adapter.max_retries = max_retries
current_max = adapter.max_retries # type: ignore[attr-defined]
adapter.max_retries = max_retries # type: ignore[attr-defined]
LOGGER.debug(
"max_retries set to total: %s force_list: %s",
max_retries.total,
Expand All @@ -1687,11 +1683,11 @@ def max_retries(
LOGGER.exception("Exception in max retries")
raise ErrorCode.RETRY_OVERRUN.exception_with_parameters() from err
finally:
adapter.max_retries = current_max
adapter.max_retries = current_max # type: ignore[attr-defined]
LOGGER.debug(
"max_retries restored to total: %s force_list: %s",
adapter.max_retries.total,
adapter.max_retries.status_forcelist,
adapter.max_retries.total, # type: ignore[attr-defined]
adapter.max_retries.status_forcelist, # type: ignore[attr-defined]
)


Expand Down
4 changes: 2 additions & 2 deletions pyatlan/client/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@
endpoint=EndPoint.ATLAS,
)
DELETE_CLASSIFICATION_BY_TYPE_AND_ATTRIBUTE = API(
ENTITY_API + "uniqueAttribute/type/{type_name}/classification/{"
"classification_name}",
ENTITY_API
+ "uniqueAttribute/type/{type_name}/classification/{classification_name}",
HTTPMethod.DELETE,
HTTPStatus.NO_CONTENT,
endpoint=EndPoint.ATLAS,
Expand Down
5 changes: 1 addition & 4 deletions pyatlan/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
from typing import Dict, List, Protocol, Type, TypeVar

E = TypeVar("E", bound="AtlanError")
RAISE_GITHUB_ISSUE = (
"Please raise an issue on the Python SDK GitHub "
"repository providing context in which this error occurred."
)
RAISE_GITHUB_ISSUE = "Please raise an issue on the Python SDK GitHub repository providing context in which this error occurred."


class ErrorInfo(Protocol):
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/events/atlan_event_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,7 @@ def upsert_changes(self, changed_assets: List[Asset]):
:param changed_assets: the in-memory-modified assets to send to Atlan
"""
warn(
"This method is deprecated, please use 'save_changes' instead, which offers identical "
"functionality.",
"This method is deprecated, please use 'save_changes' instead, which offers identical functionality.",
DeprecationWarning,
stacklevel=2,
)
Expand Down
7 changes: 3 additions & 4 deletions pyatlan/generator/class_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
pyatlan.model.enums. This script depends upon the presence of a JSON file containing typedefs downloaded from
an Atlan instance. The script create_typedefs_file.py can be used to produce this file.
"""

import datetime
import enum
import json
Expand Down Expand Up @@ -630,14 +631,12 @@ def get_indexes_for_attribute() -> Dict[IndexType, str]:
elif indices == {IndexType.NUMERIC, IndexType.RANK_FEATURE}:
return SearchType(
name="NumericRankField",
args=f'"{search_map.get(IndexType.NUMERIC)}", '
f'"{search_map.get(IndexType.RANK_FEATURE)}"',
args=f'"{search_map.get(IndexType.NUMERIC)}", "{search_map.get(IndexType.RANK_FEATURE)}"',
)
elif indices == {IndexType.KEYWORD, IndexType.TEXT}:
return SearchType(
name="KeywordTextField",
args=f'"{search_map.get(IndexType.KEYWORD)}", '
f'"{search_map.get(IndexType.TEXT)}"',
args=f'"{search_map.get(IndexType.KEYWORD)}", "{search_map.get(IndexType.TEXT)}"',
)
elif indices == {IndexType.KEYWORD, IndexType.TEXT, IndexType.STEMMED}:
return SearchType(
Expand Down
1 change: 1 addition & 0 deletions pyatlan/model/aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Details(AtlanObject):

class Hits(AtlanObject):
"Details of the hits requested."

total: Optional[AggregationHitsResult.Stats] = Field(default=None)
max_score: Optional[float] = Field(default=None)
hits: List[AggregationHitsResult.Details] = Field(default_factory=list)
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/model/assets/a_d_l_s_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def creator(cls, *, name: str, connection_qualified_name: str) -> ADLSAccount:
def create(cls, *, name: str, connection_qualified_name: str) -> ADLSAccount:
warn(
(
"This method is deprecated, please use 'creator' "
"instead, which offers identical functionality."
"This method is deprecated, please use 'creator' instead, which offers identical functionality."
),
DeprecationWarning,
stacklevel=2,
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/model/assets/a_d_l_s_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def creator(
def create(cls, *, name: str, adls_account_qualified_name: str) -> ADLSContainer:
warn(
(
"This method is deprecated, please use 'creator' "
"instead, which offers identical functionality."
"This method is deprecated, please use 'creator' instead, which offers identical functionality."
),
DeprecationWarning,
stacklevel=2,
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/model/assets/a_d_l_s_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ def create(
) -> ADLSObject:
warn(
(
"This method is deprecated, please use 'creator' "
"instead, which offers identical functionality."
"This method is deprecated, please use 'creator' instead, which offers identical functionality."
),
DeprecationWarning,
stacklevel=2,
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/model/assets/a_p_i_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def creator(
def create(cls, *, path_raw_uri: str, spec_qualified_name: str) -> APIPath:
warn(
(
"This method is deprecated, please use 'creator' "
"instead, which offers identical functionality."
"This method is deprecated, please use 'creator' instead, which offers identical functionality."
),
DeprecationWarning,
stacklevel=2,
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/model/assets/a_p_i_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def creator(cls, *, name: str, connection_qualified_name: str) -> APISpec:
def create(cls, *, name: str, connection_qualified_name: str) -> APISpec:
warn(
(
"This method is deprecated, please use 'creator' "
"instead, which offers identical functionality."
"This method is deprecated, please use 'creator' instead, which offers identical functionality."
),
DeprecationWarning,
stacklevel=2,
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/model/assets/badge.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def create(
) -> Badge:
warn(
(
"This method is deprecated, please use 'creator' "
"instead, which offers identical functionality."
"This method is deprecated, please use 'creator' instead, which offers identical functionality."
),
DeprecationWarning,
stacklevel=2,
Expand Down
3 changes: 1 addition & 2 deletions pyatlan/model/assets/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ def create(
) -> Connection:
warn(
(
"This method is deprecated, please use 'creator' "
"instead, which offers identical functionality."
"This method is deprecated, please use 'creator' instead, which offers identical functionality."
),
DeprecationWarning,
stacklevel=2,
Expand Down
Loading

0 comments on commit 1d21e02

Please sign in to comment.