Metadata-Version: 2.4
Name: camelize-dict-keys
Version: 0.1.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Dist: pytest>=8 ; extra == 'dev'
Requires-Dist: pydash ; extra == 'dev'
Provides-Extra: dev
License-File: LICENSE
Summary: Fast snake_case to camelCase conversion for nested dict and list keys, implemented in Rust.
Keywords: camelcase,snake-case,dict,keys,rust,pyo3
Author-email: wangxiwei <wangxiwei@bytedance.com>
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://pypi.org/project/camelize-dict-keys/

# camelize-dict-keys

Fast `snake_case` → `lowerCamelCase` conversion for nested dict and list keys. The hot path is a Rust extension (PyO3), with a stable `abi3` wheel for CPython 3.9+.

```python
from camelize_dict_keys import camelize_dict_keys

data = {
    "user_id": 1,
    "profile_settings": {"theme_name": "dark"},
    "address_list": [{"zip_code": "100000"}],
}
camelize_dict_keys(data)
# {
#     "userId": 1,
#     "profileSettings": {"themeName": "dark"},
#     "addressList": [{"zipCode": "100000"}],
# }
```

## Install

```bash
pip install camelize-dict-keys
```

Pre-built wheels are published for Linux, macOS, and Windows. Installing from source requires a Rust toolchain and [maturin](https://www.maturin.rs/).

## API

```python
camelize_dict_keys(obj, is_recursive=True, skip_keys=None)
to_lower_camel_case(key)
```

| Argument | Meaning |
| --- | --- |
| `obj` | A dict, list, or any other value (non-containers are returned as-is) |
| `is_recursive` | If `False`, only the current dict's keys are converted. A top-level list still camelizes each element. |
| `skip_keys` | Exact key strings and/or compiled `re.Pattern` objects (`Pattern.match`). Skipped keys keep their original name and subtree. |

Top-level dicts are updated in place and returned. Nested dicts/lists are rebuilt; leaf values (ints, strings, bools, …) are shared.

## Performance

On a typical nested API payload the Rust build is about **10–30×** faster than a Python reference that `clone_deep`s at every node. See [REPORT.md](REPORT.md) for the last local comparison.

## Development

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
maturin develop --release
pytest
python -m tests.bench
```

## Publish

GitHub Actions builds abi3 wheels for Linux / macOS / Windows and uploads them to PyPI when you push a tag like `v0.1.0`.

1. Create a GitHub repository and push this project.
2. On [pypi.org](https://pypi.org/manage/account/publishing/) add a Trusted Publisher:
   - PyPI project name: `camelize-dict-keys`
   - Workflow: `CI.yml`
   - Environment: `pypi`
3. Create the matching GitHub Environment named `pypi`.
4. Release:

```bash
git tag v0.1.0
git push origin v0.1.0
```

To upload a local build instead:

```bash
maturin publish --username __token__ --password "$PYPI_TOKEN"
```

## License

MIT

