diff --git a/README.md b/README.md index 837e83aef..ecd33d51c 100644 --- a/README.md +++ b/README.md @@ -122,21 +122,21 @@ that command. Thanks to [ApiVer methodology](#apiver-cli-versions-b2-vs-b2v3-b2v4-etc), you should be perfectly fine using `b2:latest` version even in long-term support scripts, -but make sure to explicitly use `b2v3` command from the docker image as shown below. +but make sure to explicitly use `b2v4` command from the docker image as shown below. #### Authorization User can either authorize on each command (`bucket list` is just a example here) ```bash -B2_APPLICATION_KEY= B2_APPLICATION_KEY_ID= docker run --rm -e B2_APPLICATION_KEY -e B2_APPLICATION_KEY_ID backblazeit/b2:latest b2v3 bucket list +B2_APPLICATION_KEY= B2_APPLICATION_KEY_ID= docker run --rm -e B2_APPLICATION_KEY -e B2_APPLICATION_KEY_ID backblazeit/b2:latest b2v4 bucket list ``` or authorize once and keep the credentials persisted: ```bash -docker run --rm -it -v b2:/root backblazeit/b2:latest b2v3 account authorize -docker run --rm -v b2:/root backblazeit/b2:latest b2v3 bucket list # remember to include `-v` - authorization details are there +docker run --rm -it -v b2:/root backblazeit/b2:latest b2v4 account authorize +docker run --rm -v b2:/root backblazeit/b2:latest b2v4 bucket list # remember to include `-v` - authorization details are there ``` #### Downloading and uploading @@ -144,13 +144,13 @@ docker run --rm -v b2:/root backblazeit/b2:latest b2v3 bucket list # remember t When uploading a single file, data can be passed to the container via a pipe: ```bash -cat source_file.txt | docker run -i --rm -v b2:/root backblazeit/b2:latest b2v3 upload-unbound-stream bucket_name - target_file_name +cat source_file.txt | docker run -i --rm -v b2:/root backblazeit/b2:latest b2v4 upload-unbound-stream bucket_name - target_file_name ``` or by mounting local files in the docker container: ```bash -docker run --rm -v b2:/root -v /home/user/path/to/data:/data backblazeit/b2:latest b2v3 file upload bucket_name /data/source_file.txt target_file_name +docker run --rm -v b2:/root -v /home/user/path/to/data:/data backblazeit/b2:latest b2v4 file upload bucket_name /data/source_file.txt target_file_name ``` ## ApiVer CLI versions (`b2` vs `b2v3`, `b2v4`, etc.) @@ -158,7 +158,7 @@ docker run --rm -v b2:/root -v /home/user/path/to/data:/data backblazeit/b2:late Summary: * in terminal, for best UX, use the latest apiver interface provided by `b2` command -* for long-term support, i.e. in scripts, use `b2v3` command +* for long-term support, i.e. in scripts, use `b2v4` command Explanation: @@ -170,13 +170,13 @@ It provides all the bells and whistles, latest features, and the best performanc While it's a great version to work with directly, but when writing a reliable, long-running script, you want to ensure that your script won't break when we release a new version of the `b2` command. -In that case instead of using the `b2` command, you should use a version-bound interface e.g.: `b2v3`. +In that case instead of using the `b2` command, you should use a version-bound interface e.g.: `b2v4`. This command will always provide the same ApiVer 3 interface, regardless of the semantic version of the `b2` command. Even if the `b2` command goes into the ApiVer `4`, `6` or even `10` with some major changes, -`b2v3` will still provide the same interface, same commands, and same parameters, with all the security and bug fixes. +`b2v4` will still provide the same interface, same commands, and same parameters, with all the security and bug fixes. Over time, it might get slower as we may need to emulate some older behaviors, but we'll ensure that it won't break. -You may find the next interface under `_b2v4`, but please note, as suggested by `_` prefix, +You may find the next interface under `_b2v5`, but please note, as suggested by `_` prefix, it is not yet stable and is not yet covered by guarantees listed above. ## Contrib diff --git a/b2/_internal/b2v3/registry.py b/b2/_internal/b2v3/registry.py index c7fa6449d..39998db33 100644 --- a/b2/_internal/b2v3/registry.py +++ b/b2/_internal/b2v3/registry.py @@ -9,7 +9,7 @@ ###################################################################### # ruff: noqa: F405 -from b2._internal._b2v4.registry import * # noqa +from b2._internal.b2v4.registry import * # noqa from b2._internal._cli.b2api import _get_b2api_for_profile from b2._internal.arg_parser import enable_camel_case_arguments from .rm import Rm diff --git a/b2/_internal/b2v3/rm.py b/b2/_internal/b2v3/rm.py index 841dfd727..4055de90e 100644 --- a/b2/_internal/b2v3/rm.py +++ b/b2/_internal/b2v3/rm.py @@ -9,7 +9,7 @@ ###################################################################### from __future__ import annotations -from b2._internal._b2v4.registry import B2URIBucketNFolderNameArgMixin, BaseRm +from b2._internal.b2v4.registry import B2URIBucketNFolderNameArgMixin, BaseRm # NOTE: We need to keep v3 Rm in separate file, because we need to import it in diff --git a/b2/_internal/_b2v4/__init__.py b/b2/_internal/b2v4/__init__.py similarity index 89% rename from b2/_internal/_b2v4/__init__.py rename to b2/_internal/b2v4/__init__.py index b60833325..1c486291f 100644 --- a/b2/_internal/_b2v4/__init__.py +++ b/b2/_internal/b2v4/__init__.py @@ -1,6 +1,6 @@ ###################################################################### # -# File: b2/_internal/_b2v4/__init__.py +# File: b2/_internal/b2v4/__init__.py # # Copyright 2023 Backblaze Inc. All Rights Reserved. # diff --git a/b2/_internal/_b2v4/__main__.py b/b2/_internal/b2v4/__main__.py similarity index 76% rename from b2/_internal/_b2v4/__main__.py rename to b2/_internal/b2v4/__main__.py index d381bc03d..62442275e 100644 --- a/b2/_internal/_b2v4/__main__.py +++ b/b2/_internal/b2v4/__main__.py @@ -1,6 +1,6 @@ ###################################################################### # -# File: b2/_internal/_b2v4/__main__.py +# File: b2/_internal/b2v4/__main__.py # # Copyright 2023 Backblaze Inc. All Rights Reserved. # @@ -8,6 +8,6 @@ # ###################################################################### -from b2._internal._b2v4.registry import main +from b2._internal.b2v4.registry import main main() diff --git a/b2/_internal/_b2v4/registry.py b/b2/_internal/b2v4/registry.py similarity index 98% rename from b2/_internal/_b2v4/registry.py rename to b2/_internal/b2v4/registry.py index c1bcf78d0..32afa3f54 100644 --- a/b2/_internal/_b2v4/registry.py +++ b/b2/_internal/b2v4/registry.py @@ -1,6 +1,6 @@ ###################################################################### # -# File: b2/_internal/_b2v4/registry.py +# File: b2/_internal/b2v4/registry.py # # Copyright 2023 Backblaze Inc. All Rights Reserved. # diff --git a/changelog.d/+apiver-v4.changed.md b/changelog.d/+apiver-v4.changed.md new file mode 100644 index 000000000..52c208dfa --- /dev/null +++ b/changelog.d/+apiver-v4.changed.md @@ -0,0 +1 @@ +CLI `b2` executable now points to the latest stable ApiVer version, `b2v4`, previously it pointed to `b2v3`. \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 72362505b..f4591385e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,9 +65,9 @@ full = [ Homepage = "https://github.com/Backblaze/B2_Command_Line_Tool" [project.scripts] -b2 = "b2._internal.b2v3.__main__:main" +b2 = "b2._internal.b2v4.__main__:main" b2v3 = "b2._internal.b2v3.__main__:main" -_b2v4 = "b2._internal._b2v4.__main__:main" +b2v4 = "b2._internal.b2v4.__main__:main" [build-system] requires = ["pdm-backend"] diff --git a/test/integration/conftest.py b/test/integration/conftest.py index 49791d4bd..bff38e952 100755 --- a/test/integration/conftest.py +++ b/test/integration/conftest.py @@ -125,7 +125,7 @@ def cli_version(request) -> str: """ Get CLI version name, i.e. b2v3, _b2v4, etc. """ - # The default stable version could be provided directly as e.g.: b2v3, but also indirectly as b2. + # The default stable version could be provided directly as e.g.: b2v4, but also indirectly as b2. # In case there is no direct version, we return the default binary name instead. raw_cli_version = get_raw_cli_int_version(request.config) if raw_cli_version is None: diff --git a/test/unit/test_console_tool.py b/test/unit/test_console_tool.py index 82cc2eda6..edec02f1a 100644 --- a/test/unit/test_console_tool.py +++ b/test/unit/test_console_tool.py @@ -35,13 +35,13 @@ from b2sdk.v2.exception import Conflict # Any error for testing fast-fail of the rm command. from more_itertools import one -from b2._internal._b2v4.registry import Rm as v4Rm from b2._internal._cli.const import ( B2_APPLICATION_KEY_ENV_VAR, B2_APPLICATION_KEY_ID_ENV_VAR, B2_ENVIRONMENT_ENV_VAR, ) from b2._internal.b2v3.rm import Rm as v3Rm +from b2._internal.b2v4.registry import Rm as v4Rm from b2._internal.version import VERSION from .test_base import TestBase