Skip to main content

A Python library for API kit

Project description

dot-dict

A Python library for dot notation access to nested dictionaries.

Features

  • Access nested dictionary values using dot notation
  • Automatic creation of nested structures
  • Compatible with standard dictionary operations
  • JSON serialization support
  • Lightweight and efficient

Installation

pip install dot-dict

Usage

from dotdict import DotDict

# Create a Dot object from a dictionary
data = {
    "user": {
        "name": "John",
        "age": 30,
        "address": {
            "city": "New York",
            "country": "USA"
        }
    }
}

dot_data = Dot(data)

# Access values using dot notation
print(dot_data.user.name)  # Output: John
print(dot_data.user.address.city)  # Output: New York

# Set values using dot notation
dot_data.user.age = 31
dot_data.user.email = "john@example.com"

# Automatic creation of nested structures
dot_data.settings.theme = "dark"
dot_data.settings.language = "en"

# Convert back to dictionary
dict_data = dot_data.to_dict()

# JSON serialization
print(str(dot_data))

Development

pytest

pytest

Setup

# Clone the repository
git clone https://git.xmov.ai/jiangbin/dot-dict.git
cd dot-dict

# Install development dependencies
pip install -e ".[dev]"

Upload

make upload-test

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyapikit-1.0.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyapikit-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pyapikit-1.0.0.tar.gz.

File metadata

  • Download URL: pyapikit-1.0.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.19

File hashes

Hashes for pyapikit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d944a2cf019d1e7a29461a61d5cd3c04dd32fcfeea959f6c8f5ba90f8c2486ce
MD5 a75693b4bf7ecf04b24494510044ddce
BLAKE2b-256 553739e334886b1f1c1d099e348a17bae683aa5ae07660a4bc66933276c033eb

See more details on using hashes here.

File details

Details for the file pyapikit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyapikit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.19

File hashes

Hashes for pyapikit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3acac8c02c206ba7e8a95d9a818bd6110452ef01e0444de3d10274ee6f0c24ac
MD5 79d28be9bdc81a80de989a6745a66158
BLAKE2b-256 1e79387ca96d6a003ca941ab46964cb8120453ee5cc981f7c93a7b79463b9ce6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page