From 5a6bfe73b2a4813aae1097ef9b05d12d5fc8fb7a Mon Sep 17 00:00:00 2001 From: yoni17 Date: Mon, 2 Feb 2026 15:49:55 +0200 Subject: [PATCH 1/3] upgrade to python 3.14 --- .isort.cfg | 7 ---- .pre-commit-config.yaml | 2 +- .travis.yml | 3 +- mypy.ini | 4 -- pyproject.toml | 84 +++++++++++++++++++++++++++++++++++++++++ pytest.ini | 6 --- setup.cfg | 40 -------------------- setup.py | 3 -- 8 files changed, 86 insertions(+), 63 deletions(-) delete mode 100644 .isort.cfg delete mode 100644 mypy.ini create mode 100644 pyproject.toml delete mode 100644 pytest.ini delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 7b27ff5..0000000 --- a/.isort.cfg +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -atomic = true -not_skip = __init__.py -line_length = 88 -multi_line_output = 3 -include_trailing_comma = true -known_third_party = azure,boto3,cache,cachetools,datadog_api_client,fakeredis,gamla,google,kubernetes,motor,pymongo,pytest,redis,setuptools,slack_sdk,yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3c439d..4ea1247 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ repos: - repo: https://github.com/hyroai/lint - rev: eb3d81e2b50d7ac44ed9fe00c2ac3cac2511f3e7 + rev: 29f3032e3a69fb69845210b14661628de72e4ef3 hooks: - id: hyro-pre-commit diff --git a/.travis.yml b/.travis.yml index 2fd54b2..0166d9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,12 @@ dist: jammy language: python python: - - 3.11 + - 3.14 jobs: include: - stage: test name: pytest install: - - pip install --upgrade pytest - pip install -e . script: pytest - stage: test diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 3aa9cc8..0000000 --- a/mypy.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mypy-redis.*] -ignore_missing_imports = True -[mypy-yaml.*] -ignore_missing_imports = True \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1c8d40b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,84 @@ +[build-system] +requires = ["setuptools>=80", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "cloud-utils" +version = "0.0.1" +description = "Tools for multi cloud deployments." +readme = "README.md" +requires-python = ">=3.14" +license = { text = "MIT" } +classifiers = [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.14", +] +dependencies = [ + "async-cache", + "azure-storage-blob~=12.20.0", + "boto3", + "cachetools", + "datadog_api_client", + "dnspython", + "fakeredis", + "gamla>=152", + "google-cloud-storage", + "hvac", + "kubernetes", + "motor", + "pymongo<4", + "pytest", + "redis", + "slack-sdk", + "xmltodict", +] + +[project.scripts] +deploy-cron-jobs = "cloud_utils.scheduler.deploy_cron_jobs:main" +run-jobs = "cloud_utils.scheduler.run_jobs:main" + +[tool.setuptools.packages.find] +where = ["."] +include = ["cloud_utils*"] + +[tool.pytest.ini_options] +asyncio_mode = "auto" +log_cli = true +log_cli_level = "INFO" +log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)" +log_cli_date_format = "%Y-%m-%d %H:%M:%S" + +[tool.mypy] +[[tool.mypy.overrides]] +module = "redis.*" +ignore_missing_imports = true +[[tool.mypy.overrides]] +module = "yaml.*" +ignore_missing_imports = true + +[tool.isort] +atomic = true +not_skip = ["__init__.py"] +line_length = 88 +multi_line_output = 3 +include_trailing_comma = true +known_third_party = [ + "azure", + "boto3", + "cache", + "cachetools", + "datadog_api_client", + "fakeredis", + "gamla", + "google", + "kubernetes", + "motor", + "pymongo", + "pytest", + "redis", + "setuptools", + "slack_sdk", + "yaml", +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index eb2ee65..0000000 --- a/pytest.ini +++ /dev/null @@ -1,6 +0,0 @@ -[pytest] -asyncio_mode = auto -log_cli = 1 -log_cli_level = INFO -log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s) -log_cli_date_format=%Y-%m-%d %H:%M:%S diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c4587ca..0000000 --- a/setup.cfg +++ /dev/null @@ -1,40 +0,0 @@ -[metadata] -name = cloud-utils -version = 0.0.1 -description = Tools for multi cloud deployments. -long_description = file: README.md -long_description_content_type = text/markdown -license = MIT -license_file = LICENSE -classifiers = - License :: OSI Approved :: MIT License - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.11 - -[options] -packages = find: -install_requires = - async-cache - azure-storage-blob~=12.20.0 - boto3 - cachetools - datadog_api_client - # Required by PyMongo but not installed by it. - dnspython - fakeredis - gamla>=152 - google-cloud-storage - kubernetes - motor - pymongo<4 - redis - slack-sdk - xmltodict - hvac -python_requires = >=3.11 - -[options.entry_points] -console_scripts = - deploy-cron-jobs = cloud_utils.scheduler.deploy_cron_jobs:main - run-jobs = cloud_utils.scheduler.run_jobs:main diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From 11e015a3dd91a8cdbfe845b39784dd39f65fd442 Mon Sep 17 00:00:00 2001 From: yoni17 Date: Mon, 2 Feb 2026 16:18:30 +0200 Subject: [PATCH 2/3] remove before so we don't do a adiff on commits for pre committ --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0166d9e..3d76346 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,6 @@ jobs: script: pytest - stage: test name: pre-commit - before_install: - - git remote set-branches --add origin master - - git fetch origin master install: pip install pre-commit - script: pre-commit run --show-diff-on-failure --from-ref `git merge-base origin/master ${TRAVIS_COMMIT}` --to-ref ${TRAVIS_COMMIT} + script: pre-commit run --show-diff-on-failure --all-files From c6a42f2ad4c0a84766184cc485a948a999f82b9b Mon Sep 17 00:00:00 2001 From: yoni17 Date: Tue, 3 Feb 2026 17:57:04 +0200 Subject: [PATCH 3/3] pre-commit --- .codespell_ignore | 1 + .pre-commit-config.yaml | 64 ++++++++++++++++++++++++-- cloud_utils/cache/file_store.py | 8 ++-- cloud_utils/cache/stores/redis.py | 7 ++- cloud_utils/cache/stores/redis_test.py | 4 +- cloud_utils/cache/utils.py | 2 +- cloud_utils/storage/azure.py | 6 +-- cloud_utils/vault.py | 3 +- 8 files changed, 82 insertions(+), 13 deletions(-) diff --git a/.codespell_ignore b/.codespell_ignore index e69de29..aae339e 100644 --- a/.codespell_ignore +++ b/.codespell_ignore @@ -0,0 +1 @@ +juxt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ea1247..0e9fa3c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,63 @@ repos: - - repo: https://github.com/hyroai/lint - rev: 29f3032e3a69fb69845210b14661628de72e4ef3 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 hooks: - - id: hyro-pre-commit + - id: check-added-large-files + - id: debug-statements + + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + + - repo: https://github.com/asottile/add-trailing-comma + rev: v2.2.2 + hooks: + - id: add-trailing-comma + + - repo: https://github.com/psf/black + rev: 24.10.0 + hooks: + - id: black + + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + additional_dependencies: + [ + "flake8-assertive", + "flake8-comprehensions", + "flake8-mutable", + "flake8-print", + "flake8-self", + "pep8-naming", + ] + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.5.1 + hooks: + - id: mypy + args: [ --follow-imports=silent, --ignore-missing-imports ] + exclude: (?x)^( + [^/]*/.*_test\.py| + )$ + additional_dependencies: + - types-cachetools + - types-python-dateutil + - types-pytz + - types-requests + - types-tabulate + + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + entry: codespell --ignore-words=.codespell_ignore --quiet-level=4 --check-filenames + exclude: \.(csv|json|txt)$ + + - repo: https://github.com/PyCQA/autoflake + rev: v2.3.1 + hooks: + - id: autoflake + args: [--in-place, --remove-all-unused-imports] diff --git a/cloud_utils/cache/file_store.py b/cloud_utils/cache/file_store.py index abedeaf..c6c788c 100644 --- a/cloud_utils/cache/file_store.py +++ b/cloud_utils/cache/file_store.py @@ -66,9 +66,11 @@ def load_by_hash(should_save_local: bool, bucket_name: str, object_hash: str) -> object_hash, gamla.log_text(f"Loading {object_hash} from bucket..."), _load_item(bucket_name), - gamla.side_effect(_save_local(object_hash)) - if should_save_local - else gamla.identity, + ( + gamla.side_effect(_save_local(object_hash)) + if should_save_local + else gamla.identity + ), ) diff --git a/cloud_utils/cache/stores/redis.py b/cloud_utils/cache/stores/redis.py index 222e414..ae3a4a4 100644 --- a/cloud_utils/cache/stores/redis.py +++ b/cloud_utils/cache/stores/redis.py @@ -85,5 +85,10 @@ def make_store( decoder: Callable[[Any], Any], ) -> Tuple[Callable, Callable]: return make_store_with_custom_ttl( - make_redis_client, max_parallelism, gamla.just(ttl), name, encoder, decoder + make_redis_client, + max_parallelism, + gamla.just(ttl), + name, + encoder, + decoder, ) diff --git a/cloud_utils/cache/stores/redis_test.py b/cloud_utils/cache/stores/redis_test.py index dd03267..3a51f96 100644 --- a/cloud_utils/cache/stores/redis_test.py +++ b/cloud_utils/cache/stores/redis_test.py @@ -39,7 +39,9 @@ async def test_redis_store_unbounded(): _ttl_by_value: Callable[[str], int] = gamla.ternary( - gamla.equals("1"), gamla.just(1), gamla.just(5) + gamla.equals("1"), + gamla.just(1), + gamla.just(5), ) diff --git a/cloud_utils/cache/utils.py b/cloud_utils/cache/utils.py index 85859a6..0a58905 100644 --- a/cloud_utils/cache/utils.py +++ b/cloud_utils/cache/utils.py @@ -12,7 +12,7 @@ _LAST_RUN_TIMESTAMP = "last_run_timestamp" -class VersionNotFound(Exception): +class VersionNotFoundError(Exception): pass diff --git a/cloud_utils/storage/azure.py b/cloud_utils/storage/azure.py index e1b512e..0db435d 100644 --- a/cloud_utils/storage/azure.py +++ b/cloud_utils/storage/azure.py @@ -75,9 +75,9 @@ def _upload_blob(bucket_name: str, blob_name: str, data: str | bytes, zipped: bo overwrite=True, max_concurrency=10, timeout=600, - content_settings=blob.ContentSettings(content_encoding="gzip") - if zipped - else None, + content_settings=( + blob.ContentSettings(content_encoding="gzip") if zipped else None + ), ) diff --git a/cloud_utils/vault.py b/cloud_utils/vault.py index e390286..72cc605 100644 --- a/cloud_utils/vault.py +++ b/cloud_utils/vault.py @@ -15,7 +15,8 @@ def _build_read_secret(client: Client) -> Callable: def read_secret(path: str, version: Optional[str]) -> dict[str, str]: try: secret = client.secrets.kv.v2.read_secret_version( - path=path, version=version + path=path, + version=version, ) return secret["data"]["data"] except InvalidPath: