diff --git a/enex2notion/enex_uploader.py b/enex2notion/enex_uploader.py index b63e75d..e7f8478 100644 --- a/enex2notion/enex_uploader.py +++ b/enex2notion/enex_uploader.py @@ -3,8 +3,8 @@ from notion.block import CollectionViewPageBlock, PageBlock from notion.collection import CollectionRowBlock from notion.operations import build_operation -from progress.bar import Bar from requests import HTTPError +from tqdm import tqdm from enex2notion.enex_types import EvernoteNote from enex2notion.enex_uploader_block import upload_block @@ -12,13 +12,19 @@ logger = logging.getLogger(__name__) +PROGRESS_BAR_WIDTH = 80 + def upload_note(root, note: EvernoteNote, note_blocks): logger.debug(f"Creating new page for note '{note.title}'") new_page = _make_page(note, root) + progress_iter = tqdm( + iterable=note_blocks, unit="block", leave=False, ncols=PROGRESS_BAR_WIDTH + ) + try: - for block in Bar().iter(note_blocks): + for block in progress_iter: upload_block(new_page, block) except HTTPError: if isinstance(new_page, CollectionRowBlock): diff --git a/poetry.lock b/poetry.lock index 14998b2..695aafd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -158,7 +158,7 @@ importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} name = "colorama" version = "0.4.4" description = "Cross-platform colored terminal text." -category = "dev" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" @@ -701,14 +701,6 @@ pyyaml = ">=5.1" toml = "*" virtualenv = ">=20.0.8" -[[package]] -name = "progress" -version = "1.6" -description = "Easy to use progress bars" -category = "main" -optional = false -python-versions = "*" - [[package]] name = "py" version = "1.11.0" @@ -1015,6 +1007,23 @@ category = "dev" optional = false python-versions = ">=3.7" +[[package]] +name = "tqdm" +version = "4.64.0" +description = "Fast, Extensible Progress Meter" +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[package.extras] +dev = ["py-make (>=0.1.0)", "twine", "wheel"] +notebook = ["ipywidgets (>=6)"] +slack = ["slack-sdk"] +telegram = ["requests"] + [[package]] name = "typed-ast" version = "1.5.3" @@ -1187,7 +1196,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "56b8c1e6e52c3e93fb6e9e9aaf6015666bc561fd7b4094235c2db9acfbe457a7" +content-hash = "cc03951e5355f0e4dc7aab51d62711d776b0b8e06accb8a54c9456d5b76c3b33" [metadata.files] astor = [ @@ -1560,9 +1569,6 @@ pre-commit = [ {file = "pre_commit-2.19.0-py2.py3-none-any.whl", hash = "sha256:10c62741aa5704faea2ad69cb550ca78082efe5697d6f04e5710c3c229afdd10"}, {file = "pre_commit-2.19.0.tar.gz", hash = "sha256:4233a1e38621c87d9dda9808c6606d7e7ba0e087cd56d3fe03202a01d2919615"}, ] -progress = [ - {file = "progress-1.6.tar.gz", hash = "sha256:c9c86e98b5c03fa1fe11e3b67c1feda4788b8d0fe7336c2ff7d5644ccfba34cd"}, -] py = [ {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, @@ -1724,6 +1730,10 @@ tomli = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +tqdm = [ + {file = "tqdm-4.64.0-py2.py3-none-any.whl", hash = "sha256:74a2cdefe14d11442cedf3ba4e21a3b84ff9a2dbdc6cfae2c34addb2a14a5ea6"}, + {file = "tqdm-4.64.0.tar.gz", hash = "sha256:40be55d30e200777a307a7585aee69e4eabb46b4ec6a4b4a5f2d9f11e7d5408d"}, +] typed-ast = [ {file = "typed_ast-1.5.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9ad3b48cf2b487be140072fb86feff36801487d4abb7382bb1929aaac80638ea"}, {file = "typed_ast-1.5.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:542cd732351ba8235f20faa0fc7398946fe1a57f2cdb289e5497e1e7f48cfedb"}, diff --git a/pyproject.toml b/pyproject.toml index a6e5a0e..dbf6440 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,13 +35,13 @@ enex2notion = "enex2notion.cli:main" python = "^3.7" beautifulsoup4 = "^4.11.1" python-dateutil = "^2.8.2" -progress = "^1.6" requests = "^2.27.1" w3lib = "^1.22.0" tinycss2 = "^1.1.1" pdfkit = "^1.0.0" PyMuPDF = "^1.19.6" notion-vzhd1701-fork = "0.0.30" +tqdm = "^4.64.0" [tool.poetry.dev-dependencies] pytest = "^7.1.2"