Skip to content

Commit

Permalink
Rename to gloomy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kornelijus committed Mar 3, 2025
1 parent 9922844 commit 6c50470
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
# gloom
# gloomy

> "glom but not as slow"
An utility for retrieving values from deeply nested object attributes, mapping keys, sequence indexes, or any combination of them.

Not meant as a drop in replacement for `glom`, only basic functionality is implemented.
A good use-case would be to improve existing codebases in which the `glom` pattern is commonly used for convenience, as it can significantly affect performance.

## Installation

```
pip install gloomy
```

## Usage

```
from gloomy import gloom
assert gloom({"a": {"b": {"c": [123]}}}, "a.b.c.0") == 123
# Or with a default in case the path is invalid
assert gloom({}, "a.b.c", default=None) is None
```
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[project]
name = "gloom"
name = "gloomy"
version = "0.1.0"
readme = "README.md"
requires-python = ">=3.10"
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: MIT License",
]
dependencies = []
Expand All @@ -30,3 +33,7 @@ addopts = [

[tool.ruff]
line-length = 120

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
3 changes: 1 addition & 2 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Any
from tests.utils import Obj
import pytest
from gloomy import gloom


@pytest.mark.parametrize(
Expand All @@ -15,7 +16,5 @@
],
)
def test_valid_paths(target: Any, spec: str, expected: Any):
from gloom import gloom

result = gloom(target, spec)
assert result == expected
2 changes: 1 addition & 1 deletion tests/test_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Callable
from pytest_benchmark.fixture import BenchmarkFixture # type: ignore[import-untyped]
from gloom import gloom
from gloomy import gloom
from glom import glom # type: ignore[import-untyped]
from functools import partial
import pytest
Expand Down
5 changes: 3 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c50470

Please sign in to comment.