Python module for interacting with nested dicts as a single level dict with delimited keys. https://flatdict.readthedocs.io
  • Python 84.7%
  • Shell 12.4%
  • Makefile 2.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
hermes adc06e3aac
Some checks failed
CI / Lint (ruff) (push) Failing after 3s
CI / Tests (Python 3.11) (push) Successful in 4m37s
CI / Tests (Python 3.12) (push) Successful in 4m28s
CI / Tests (Python 3.14) (push) Failing after 2s
CI / Tests (Python 3.13) (push) Successful in 1m45s
CI / Package build (push) Successful in 1m49s
feat: add Forgejo Actions CI and release workflows (#1)
## Problem
johnpreston/flatdict has no CI on Forgejo.

## Fix
Ports the CI/CD setup from compose-x/compose-x-common:
- `.forgejo/workflows/ci.yml`: lint (ruff), test matrix (3.12/3.13/3.14), package build — job logic in the Makefile, shell-only checkout, act-runner cache via `scripts/ci-cache.sh`
- `.forgejo/workflows/release.yml`: publish to PyPI on `v*` tags (requires `PYPI_TOKEN` secret)
- Modernized `flatdict.py` (f-strings, `yield from`, py310+) with ruff-clean formatting

Validated locally: ruff clean, 86/86 tests pass, `poetry build` + `twine check` PASSED.

Co-authored-by: OpenCode Agent <agent@compose-x.io>
Reviewed-on: #1
2026-09-20 18:06:07 +00:00
.forgejo/workflows feat: add Forgejo Actions CI and release workflows (#1) 2026-09-20 18:06:07 +00:00
.github/workflows Revert to codecov 1.0.2 2020-02-12 11:19:33 -05:00
docs Documentation updates 2020-02-12 10:38:38 -05:00
requires Move the testing requirements file to match my other repos 2020-02-12 10:36:13 -05:00
scripts feat: add Forgejo Actions CI and release workflows (#1) 2026-09-20 18:06:07 +00:00
tests feat: add Forgejo Actions CI and release workflows (#1) 2026-09-20 18:06:07 +00:00
.gitignore Ignoring updates 2019-06-10 11:02:04 -04:00
bootstrap Test configuration updates 2020-02-12 11:09:34 -05:00
CHANGELOG.md Require setuptools 39.2 or higher for installation 2020-02-13 14:12:02 -05:00
CONTRIBUTING.md Include note about flake8 tests 2020-02-12 11:24:13 -05:00
flatdict.py feat: add Forgejo Actions CI and release workflows (#1) 2026-09-20 18:06:07 +00:00
LICENSE Metadata prep for 4.0 release 2020-02-12 10:30:55 -05:00
Makefile feat: add Forgejo Actions CI and release workflows (#1) 2026-09-20 18:06:07 +00:00
poetry.lock feat: add Forgejo Actions CI and release workflows (#1) 2026-09-20 18:06:07 +00:00
pyproject.toml feat: add Forgejo Actions CI and release workflows (#1) 2026-09-20 18:06:07 +00:00
README.rst flatdict2 to continue un-maintained flatdict 2026-02-10 22:18:06 +00:00

FlatDict
========

|Version| |Status| |Coverage| |License|

``FlatDict`` and ``FlatterDict`` are a dict classes that allows for single level,
delimited key/value pair mapping of nested dictionaries. You can interact with
``FlatDict`` and ``FlatterDict`` like a normal dictionary and access child
dictionaries as you normally would or with the composite key.

*For example:*

.. code-block:: python

    value = flatdict.FlatDict({'foo': {'bar': 'baz', 'qux': 'corge'}})

*would be the same as:*

.. code-block:: python

    value == {'foo:bar': 'baz', 'foo:qux': 'corge'}

*values can be accessed as:*

.. code-block:: python

    print(foo['foo:bar'])

    # or

    print(foo['foo']['bar'])

Additionally, lists and tuples are also converted into dicts using ``enumerate()``,
using the ``FlatterDict`` class.

*For example:*

.. code-block:: python

    value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})

*will be the same as:*

.. code-block:: python

    value == {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}

API
---

Documentation is available at https://flatdict.readthedocs.io

Versioning
----------
This package attempts to use semantic versioning. API changes are indicated
by the major version, non-breaking improvements by the minor, and bug fixes
in the revision.

It is recommended that you pin your targets to greater or equal to the current
version and less than the next major version.

Installation
------------

.. code-block:: bash

    $ pip install flatdict2

Or using Poetry:

.. code-block:: bash

    $ poetry add flatdict2

.. |Version| image:: https://img.shields.io/pypi/v/flatdict2.svg?
   :target: https://pypi.python.org/pypi/flatdict2

.. |Status| image:: https://github.com/gmr/flatdict/workflows/Testing/badge.svg
   :target: https://github.com/gmr/flatdict/actions
   :alt: Build Status

.. |Coverage| image:: https://img.shields.io/codecov/c/github/gmr/flatdict.svg?
   :target: https://codecov.io/github/gmr/flatdict?branch=master

.. |License| image:: https://img.shields.io/pypi/l/flatdict2.svg?
   :target: https://flatdict.readthedocs.org