Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make boto3 and zarr extra dependencies #39

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Make boto3 and zarr extra dependencies
These dependencies are very large and are irrelevant to the project's core
features (to say nothing of the times that the boto3 requirement has sent me
into dependency hell).
  • Loading branch information
jwodder committed Dec 8, 2023
commit a8bcccb89b988a772fbb07064ce58763669f94db
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ zarrsum = "zarr_checksum.cli:cli"

[tool.poetry.dependencies]
python = "^3.7"
boto3 = "^1.24"
zarr = "^2.12"
click = "^8.1.3"
tqdm = "^4.64.1"
pydantic = "^2.0"

# Optional
boto3 = {version = "^1.24", optional = true}
boto3-stubs = {version = "^1.24", optional = true}
black = {version = "^23.3.0", optional = true}
isort = {version = "^5.11.4", optional = true}
Expand All @@ -31,8 +30,11 @@ flake8-isort = {version = "^6.0.0", optional = true}
flake8-quotes = {version = "^3.3.2", optional = true}
pep8-naming = {version = "^0.13.3", optional = true}
pytest = {version = "^7.2.1", optional = true}
zarr = {version = "^2.12", optional = true}

[tool.poetry.extras]
boto = ["boto3"]
zarr = ["zarr"]
test = ["pytest"]
format = ["black", "isort"]
lint = [
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ commands =

[testenv:test]
extras =
boto3
test
zarr
commands =
pytest {posargs}

Expand Down
9 changes: 6 additions & 3 deletions zarr_checksum/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import hashlib
import os
from pathlib import Path
from typing import Iterable
from typing import TYPE_CHECKING, Iterable

if TYPE_CHECKING:
from botocore.client import Config

import boto3
from botocore.client import Config
from tqdm import tqdm


Expand Down Expand Up @@ -47,6 +48,8 @@ class S3ClientOptions:
def yield_files_s3(
bucket: str, prefix: str = "", client_options: S3ClientOptions | None = None
) -> FileGenerator:
import boto3

if client_options is None:
client_options = S3ClientOptions()

Expand Down
Loading