Skip to content

Commit

Permalink
Merge pull request #4 from TzuH-Hsu/fix-urllib3-InsecureRequestWarnin…
Browse files Browse the repository at this point in the history
…g-and-remove-unnecessary-code

Disable urllib3 warnings and bump version to 0.2.1
  • Loading branch information
TzuH-Hsu authored Mar 19, 2024
2 parents c8b05a5 + dba02ae commit ad36df6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "parquetizer"
version = "0.2.0"
version = "0.2.1"
description = "A CLI tool for converting various data formats to Parquet."
authors = ["TzuH-Hsu <[email protected]>"]
license = "GPL-3.0"
Expand Down
32 changes: 5 additions & 27 deletions src/parquetizer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@

import dotenv
import questionary as q
import urllib3
from tqdm.contrib.concurrent import thread_map

from parquetizer._converter import csv2parquet
from parquetizer._source_handler import MinIO, SrcHandler

urllib3.disable_warnings()
logging.basicConfig(level=logging.INFO)

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -50,7 +53,7 @@ def _get_env_or_ask(
return value


def main() -> None: # noqa: C901
def main() -> None:
"""Main function for the CLI."""
minio_config = None
q.print(
Expand Down Expand Up @@ -105,31 +108,6 @@ def main() -> None: # noqa: C901
max_workers = int(n_workers) if n_workers else default_workers
q.print(f"Using number of workers: {max_workers}")

if not q.confirm(
f"Confirm to convert {len(files)} {extension} files to Parquet?",
).ask():
continue

thread_map(
process_file,
[(source_handler, file) for file in files],
max_workers=max_workers,
colour="green",
)

extension = q.select("Select the file format:", choices=[".csv"]).ask()
files = source_handler.list_filtered_objects(extension)
logger.debug("Found", extra={"files": files})
q.print(f"Found {len(files)} files with the extension {extension}.")

if not q.confirm("Do you want to continue?").ask():
continue

n_workers = q.text("Enter the number of workers:").ask()

if not n_workers:
q.print(f"Using default number of workers: {max(32, os.cpu_count() + 4)}") # type: ignore[operator]

if not q.confirm(
f"Confirm to convert {len(files)} {extension} files to Parquet?",
).ask():
Expand All @@ -138,7 +116,7 @@ def main() -> None: # noqa: C901
thread_map(
lambda file: process_file(source_handler, file), # noqa: B023
files,
max_workers=int(n_workers) if n_workers else None,
max_workers=max_workers,
colour="green",
)

Expand Down

0 comments on commit ad36df6

Please sign in to comment.