Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .codespell_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
juxt
7 changes: 0 additions & 7 deletions .isort.cfg

This file was deleted.

64 changes: 61 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
repos:
- repo: https://github.com/hyroai/lint
rev: eb3d81e2b50d7ac44ed9fe00c2ac3cac2511f3e7
- 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]
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
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
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

8 changes: 5 additions & 3 deletions cloud_utils/cache/file_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
)


Expand Down
7 changes: 6 additions & 1 deletion cloud_utils/cache/stores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
4 changes: 3 additions & 1 deletion cloud_utils/cache/stores/redis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)


Expand Down
2 changes: 1 addition & 1 deletion cloud_utils/cache/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
_LAST_RUN_TIMESTAMP = "last_run_timestamp"


class VersionNotFound(Exception):
class VersionNotFoundError(Exception):
pass


Expand Down
6 changes: 3 additions & 3 deletions cloud_utils/storage/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
)


Expand Down
3 changes: 2 additions & 1 deletion cloud_utils/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions mypy.ini

This file was deleted.

84 changes: 84 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",
]
6 changes: 0 additions & 6 deletions pytest.ini

This file was deleted.

40 changes: 0 additions & 40 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.