Skip to main content

A Python dictionary template for storing serializable metadata

Project description

conceptual_dictionary

A Python dictionary template for storing serializable metadata.

Installation

Install from source:

pip install -e .

Usage

Using Templates

Import and use predefined dictionary templates:

from conceptual_dictionary.templates import sample_template, property_template, workflow_template

# Use a template directly
my_data = sample_template.copy()
my_data['material']['element_ratio'] = {'Fe': 0.7, 'C': 0.3}
my_data['simulation_cell']['volume']['value'] = 1000

Using ConceptualDict Class

Work with conceptual dictionaries using the ConceptualDict class:

from conceptual_dictionary.conceptualdict import ConceptualDict

# Create a new conceptual dictionary
cd = ConceptualDict()

# Set values using dot notation
cd.set("material.element_ratio.Fe", 0.7)
cd.set("material.element_ratio.C", 0.3)
cd.set("simulation_cell.volume.value", 1000)

# Get values
fe_ratio = cd.get("material.element_ratio.Fe")
volume = cd.get("simulation_cell.volume.value")

# Convert to standard dictionary
data = cd.to_dict()

# Serialize to JSON
json_str = cd.to_json(indent=2)

# Save to file
cd.save("my_conceptual.json")

# Load from file
cd_loaded = ConceptualDict.from_json("my_conceptual.json")

Available Templates

  • sample_template: Standard template with metadata, content, and schema sections
  • property_template: Template for defining properties with values and units
  • workflow_template: Template for describing workflows, including algorithms and methods

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

conceptual_dictionary-0.1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

conceptual_dictionary-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file conceptual_dictionary-0.1.1.tar.gz.

File metadata

  • Download URL: conceptual_dictionary-0.1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for conceptual_dictionary-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f0027f474a44b616d8f86e21d22a9f8e9585d9645aa9a4f1b8b8bda203d57ac8
MD5 2dd87e69d14633ffa789657912097867
BLAKE2b-256 64aec66a25118d05d9c4fde1af3fb38f41c01a252d1120591c7cb48722d6266e

See more details on using hashes here.

File details

Details for the file conceptual_dictionary-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for conceptual_dictionary-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba1ae53f168ab6fd61882a11c2df7a7ba2c13ab5b182874798da0c0cd41012d1
MD5 260aaa9513d2103355059ce2fc668b29
BLAKE2b-256 4543f4d0a0cc0a01097f9217b36e62e169a3eb5fb06fcc978c7b670d74b6a125

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