diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f116462..44378b0 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.2 +current_version = 0.0.3 commit = True tag = True message = 🔖 Bump version: {current_version} → {new_version} diff --git a/README.md b/README.md index 28065be..e72d561 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ smart_write(".local/data", data) ### command line ```bash -anystore --store .cache set foo "bar" +anystore --store .cache put foo "bar" anystore --store .cache get foo # "bar" @@ -65,7 +65,7 @@ store = Store(uri="s3://mybucket/data", backend_config={"client_kwargs":{ }}) store.get("/2023/1.txt") -store.set("/2023/2.txt", my_data) +store.put("/2023/2.txt", my_data) ``` ## Decorate your functions diff --git a/VERSION b/VERSION index 4e379d2..bcab45a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.2 +0.0.3 diff --git a/anystore/__init__.py b/anystore/__init__.py index c506fd3..83b73b3 100644 --- a/anystore/__init__.py +++ b/anystore/__init__.py @@ -12,4 +12,4 @@ ] -__version__ = "0.0.2" +__version__ = "0.0.3" diff --git a/anystore/cli.py b/anystore/cli.py index 6086023..1116a30 100644 --- a/anystore/cli.py +++ b/anystore/cli.py @@ -59,8 +59,8 @@ def cli_get( smart_write(o, value, mode=mode) -@cli.command("set") -def cli_set( +@cli.command("put") +def cli_put( key: str, value: Annotated[ Optional[str], @@ -69,12 +69,12 @@ def cli_set( i: Annotated[str, typer.Option("-i")] = "-", ): """ - Set content for a `key` to a store + Put content for a `key` to a store """ with ErrorHandler(): S = get_store(uri=state["uri"], use_pickle=state["pickle"]) value = value or smart_read(i) - S.set(key, value) + S.put(key, value) @cli.command("io") diff --git a/anystore/decorators.py b/anystore/decorators.py index 26e0f9f..06c6cdc 100644 --- a/anystore/decorators.py +++ b/anystore/decorators.py @@ -16,7 +16,7 @@ def _inner(*args, **kwargs): return store.get(key) except DoesNotExist: res = func(*args, **kwargs) - store.set(key, res) + store.put(key, res) return res return _inner diff --git a/anystore/store.py b/anystore/store.py index b1b9f9b..dccfcbb 100644 --- a/anystore/store.py +++ b/anystore/store.py @@ -40,7 +40,7 @@ def get( raise DoesNotExist(f"Key does not exist: `{key}`") return None - def set( + def put( self, key: Uri, value: Any, serialization_mode: Mode | None = None, **kwargs ): serialization_mode = serialization_mode or self.serialization_mode diff --git a/pyproject.toml b/pyproject.toml index beff08f..1c846d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "anystore" -version = "0.0.2" +version = "0.0.3" description = "Store and cache things anywhere" authors = ["Simon Wörpel "] license = "GPL-3.0" diff --git a/tests/test_cli.py b/tests/test_cli.py index 5ab134a..b44c581 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -11,13 +11,13 @@ def test_cli(tmp_path, fixtures_path): res = runner.invoke(cli, "--help") assert res.exit_code == 0 - res = runner.invoke(cli, ["--store", str(tmp_path), "set", "foo", "bar"]) + res = runner.invoke(cli, ["--store", str(tmp_path), "put", "foo", "bar"]) assert res.exit_code == 0 res = runner.invoke(cli, ["--store", str(tmp_path), "get", "foo"]) assert res.exit_code == 0 assert res.stdout == "bar" - res = runner.invoke(cli, ["--store", "s3://foo/bar", "set", "foo", "bar"]) + res = runner.invoke(cli, ["--store", "s3://foo/bar", "put", "foo", "bar"]) assert res.exit_code == 1 res = runner.invoke(cli, ["io", "-i", str(fixtures_path / "lorem.txt")]) diff --git a/tests/test_store.py b/tests/test_store.py index b2ecaff..27d338c 100644 --- a/tests/test_store.py +++ b/tests/test_store.py @@ -13,17 +13,17 @@ def test_store(tmp_path, fixtures_path): # store and retrieve store = Store(uri=tmp_path) key = "test" - store.set(key, "foo") + store.put(key, "foo") assert store.get(key) == b"foo" assert store.get(key, mode="r") == "foo" - store.set(key, False) + store.put(key, False) assert store.get(key) is False store = Store(uri="s3://anystore") key = "test" - store.set(key, "foo") + store.put(key, "foo") assert store.get(key) == b"foo" - store.set(key, False) + store.put(key, False) assert store.get(key) is False # don't pickle "external" data