pythermodb-settings 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ # export
2
+ from .configs.about import (
3
+ __version__,
4
+ __description__,
5
+ __author__,
6
+ __author_email__,
7
+ )
8
+
9
+ __all__ = [
10
+ "__version__",
11
+ "__description__",
12
+ "__author__",
13
+ "__author_email__",
14
+ ]
File without changes
@@ -0,0 +1,13 @@
1
+ from .about import (
2
+ __version__,
3
+ __description__,
4
+ __author__,
5
+ __author_email__,
6
+ )
7
+
8
+ __all__ = [
9
+ "__version__",
10
+ "__description__",
11
+ "__author__",
12
+ "__author_email__",
13
+ ]
@@ -0,0 +1,5 @@
1
+ # NOTE: app info
2
+ __version__ = "0.1.0"
3
+ __description__ = """PyThermoDB Settings is a Python package that acts as an interface between pythermdb and other applications, providing robust, Pydantic-based data models and configuration structures for managing thermodynamic database (ThermoDB) settings."""
4
+ __author__ = "Sina Gilassi"
5
+ __author_email__ = "sina.gilassi@gmail.com"
@@ -0,0 +1,23 @@
1
+ # export
2
+ from .components import Component
3
+ from .conditions import Temperature, Pressure
4
+ from .configs import ComponentConfig
5
+ from .references import (
6
+ ReferenceThermoDB,
7
+ ComponentReferenceThermoDB,
8
+ ReferencesThermoDB,
9
+ CustomReference
10
+ )
11
+ from .rules import ComponentRule
12
+
13
+ __all__ = [
14
+ "Component",
15
+ "Temperature",
16
+ "Pressure",
17
+ "ComponentConfig",
18
+ "ReferenceThermoDB",
19
+ "ComponentReferenceThermoDB",
20
+ "ReferencesThermoDB",
21
+ "CustomReference",
22
+ "ComponentRule"
23
+ ]
@@ -0,0 +1,41 @@
1
+ # import libs
2
+ from typing import (
3
+ Literal
4
+ )
5
+ from pydantic import (
6
+ BaseModel,
7
+ Field,
8
+ ConfigDict
9
+ )
10
+
11
+
12
+ class Component(BaseModel):
13
+ """
14
+ Component model for input validation
15
+
16
+ Attributes
17
+ ----------
18
+ name : str
19
+ Name of the component.
20
+ formula : str
21
+ Chemical formula of the component.
22
+ state : Literal['g', 'l', 's', 'aq']
23
+ State of the component: 'g' for gas, 'l' for liquid, 's' for solid, 'aq' for aqueous.
24
+ mole_fraction : float, optional
25
+ Mole fraction of the component in a mixture, if applicable. Default is 1.0.
26
+ """
27
+ name: str = Field(..., description="Name of the component")
28
+ formula: str = Field(..., description="Chemical formula of the component")
29
+ state: Literal['g', 'l', 's', 'aq'] = Field(
30
+ ...,
31
+ description="State of the component: 'g' for gas, 'l' for liquid, 's' for solid, 'aq' for aqueous"
32
+ )
33
+ mole_fraction: float = Field(
34
+ default=1.0,
35
+ description="Mole fraction of the component in a mixture, if applicable"
36
+ )
37
+
38
+ model_config = ConfigDict(
39
+ arbitrary_types_allowed=True,
40
+ extra="allow"
41
+ )
@@ -0,0 +1,49 @@
1
+ # import libs
2
+ from pydantic import (
3
+ BaseModel,
4
+ Field,
5
+ ConfigDict
6
+ )
7
+
8
+
9
+ class Temperature(BaseModel):
10
+ """
11
+ Temperature model for input validation
12
+
13
+ Attributes
14
+ ----------
15
+ value : float
16
+ Temperature value.
17
+ unit : str
18
+ Temperature unit, e.g., 'K', 'C', 'F'.
19
+ """
20
+ value: float = Field(..., description="Temperature value")
21
+ unit: str = Field(..., description="Temperature unit, e.g., 'K', 'C', 'F'")
22
+
23
+ model_config = ConfigDict(
24
+ arbitrary_types_allowed=True,
25
+ extra="allow"
26
+ )
27
+
28
+
29
+ class Pressure(BaseModel):
30
+ """
31
+ Pressure model for input validation
32
+
33
+ Attributes
34
+ ----------
35
+ value : float
36
+ Pressure value.
37
+ unit : str
38
+ Pressure unit, e.g., 'bar', 'atm', 'Pa'.
39
+ """
40
+ value: float = Field(..., description="Pressure value")
41
+ unit: str = Field(
42
+ ...,
43
+ description="Pressure unit, e.g., 'bar', 'atm', 'Pa'"
44
+ )
45
+
46
+ model_config = ConfigDict(
47
+ arbitrary_types_allowed=True,
48
+ extra="allow"
49
+ )
@@ -0,0 +1,26 @@
1
+ # import libs
2
+ from typing_extensions import TypedDict
3
+
4
+
5
+ class ComponentConfig(TypedDict, total=False):
6
+ """
7
+ Component configuration model
8
+
9
+ Attributes
10
+ ----------
11
+ databook : str
12
+ Name of the databook.
13
+ table : str
14
+ Name of the table in the databook.
15
+ mode : str
16
+ Mode of the configuration, e.g., 'strict', 'lenient'.
17
+ label : str
18
+ Optional label for the configuration.
19
+ labels : dict[str, str]
20
+ Optional dictionary of labels for additional configuration details.
21
+ """
22
+ databook: str
23
+ table: str
24
+ mode: str
25
+ label: str # optional
26
+ labels: dict[str, str] # optional
@@ -0,0 +1,152 @@
1
+ # import libs
2
+ from typing import (
3
+ Literal,
4
+ Dict,
5
+ List,
6
+ Optional,
7
+ Any,
8
+ )
9
+ from pydantic import (
10
+ BaseModel,
11
+ Field,
12
+ ConfigDict
13
+ )
14
+ # local
15
+ from .configs import ComponentConfig
16
+ from .rules import ComponentRule
17
+ from .components import Component
18
+
19
+ # NOTE: custom reference models
20
+ CustomReference = Dict[str, List[str]]
21
+
22
+
23
+ # NOTE: reference thermodb model
24
+ class ReferenceThermoDB(BaseModel):
25
+ """
26
+ Model for reference thermodynamic database (ThermoDB).
27
+
28
+ Attributes
29
+ ----------
30
+ reference : Dict[str, List[str]]
31
+ Dictionary of references with their associated contents.
32
+ contents : List[str]
33
+ List of reference contents used for building the thermodynamic database.
34
+ configs : Dict[str, ComponentConfig]
35
+ Reference configuration used for building the thermodynamic database.
36
+ rules : ComponentRule
37
+ Reference rules generated from the reference configuration.
38
+ labels : Optional[List[str]]
39
+ List of labels used in the reference config.
40
+ ignore_labels : Optional[List[str]]
41
+ List of property labels to ignore state during the build.
42
+ ignore_props : Optional[List[str]]
43
+ List of property names to ignore state during the build.
44
+
45
+ Notes
46
+ -----
47
+ - The `reference_configs` attribute holds the configuration details that guide how the thermodynamic data is structured and referenced.
48
+ - The `reference_rules` attribute contains rules derived from the reference configurations, which may include mappings or transformations applied to the data.
49
+ - The `labels` attribute is optional and can be used to tag or categorize the reference configurations for easier identification and retrieval.
50
+ """
51
+ reference: Dict[str, List[str]] = Field(
52
+ ...,
53
+ description="Dictionary of references with their associated contents."
54
+ )
55
+ contents: List[str] = Field(
56
+ ...,
57
+ description="List of reference contents used for building the thermodynamic database."
58
+ )
59
+ configs: Dict[str, ComponentConfig] = Field(
60
+ default_factory=dict,
61
+ description="Reference configuration used for building the thermodynamic database."
62
+ )
63
+ rules: Dict[str, ComponentRule] = Field(
64
+ default_factory=dict,
65
+ description="Reference rules generated from the reference configuration."
66
+ )
67
+ labels: Optional[List[str]] = Field(
68
+ default_factory=list,
69
+ description="List of labels used in the reference config."
70
+ )
71
+ ignore_labels: Optional[List[str]] = Field(
72
+ default_factory=list,
73
+ description="List of property labels to ignore state during the build."
74
+ )
75
+ ignore_props: Optional[List[str]] = Field(
76
+ default_factory=list,
77
+ description="List of property names to ignore state during the build."
78
+ )
79
+
80
+ model_config = ConfigDict(
81
+ arbitrary_types_allowed=True,
82
+ extra="allow"
83
+ )
84
+
85
+
86
+ # NOTE: component reference thermodb model
87
+
88
+ class ComponentReferenceThermoDB(BaseModel):
89
+ """
90
+ Model for component thermodynamic database (ThermoDB).
91
+
92
+ Attributes
93
+ ----------
94
+ component : Component
95
+ The component for which the thermodynamic database is built.
96
+ reference_thermodb : ReferenceThermoDB
97
+ Reference thermodynamic database.
98
+ component_key : Literal['Name-State', 'Formula-State', 'Name', 'Formula', 'Name-Formula-State'], optional
99
+ Key to identify the component in the reference content, by default 'Name-State'.
100
+ """
101
+ component: Component = Field(
102
+ ...,
103
+ description="The component for which the thermodynamic database is built."
104
+ )
105
+ reference_thermodb: ReferenceThermoDB = Field(
106
+ ..., description="Reference thermodynamic database."
107
+ )
108
+
109
+ model_config = ConfigDict(
110
+ arbitrary_types_allowed=True,
111
+ extra="allow"
112
+ )
113
+
114
+ # NOTE: references thermodb model
115
+
116
+
117
+ class ReferencesThermoDB(BaseModel):
118
+ """
119
+ Model for references thermodynamic database (ThermoDB).
120
+ """
121
+ reference: Dict[str, Dict[str, List[str]]] = Field(
122
+ ...,
123
+ description="Dictionary of references with their associated contents."
124
+ )
125
+ contents: Dict[str, List[str]] = Field(
126
+ ...,
127
+ description="List of reference contents used for building the thermodynamic database."
128
+ )
129
+ configs: Dict[str, Dict[str, ComponentConfig]] = Field(
130
+ default_factory=dict,
131
+ description="Reference configuration used for building the thermodynamic database."
132
+ )
133
+ rules: Dict[str, Dict[str, ComponentRule]] = Field(
134
+ default_factory=dict,
135
+ description="Reference rules generated from the reference configuration."
136
+ )
137
+ labels: Dict[str, List[str]] = Field(
138
+ default_factory=dict,
139
+ description="Dictionary of labels used in the reference config."
140
+ )
141
+ ignore_labels: Dict[str, List[str]] = Field(
142
+ default_factory=dict,
143
+ description="Dictionary of property labels to ignore state during the build."
144
+ )
145
+ ignore_props: Dict[str, List[str]] = Field(
146
+ default_factory=dict,
147
+ description="Dictionary of property names to ignore state during the build."
148
+ )
149
+ model_config = ConfigDict(
150
+ arbitrary_types_allowed=True,
151
+ extra="allow"
152
+ )
@@ -0,0 +1,4 @@
1
+ # import libs
2
+ from typing import Dict
3
+
4
+ ComponentRule = Dict[str, str]
@@ -0,0 +1,147 @@
1
+ Metadata-Version: 2.4
2
+ Name: pythermodb-settings
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Author-email: Sina Gilassi <sina.gilassi@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/sinagilassi/PyThermoDB-Settings
8
+ Project-URL: Tracker, https://github.com/sinagilassi/PyThermoDB-Settings/issues
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pydantic>=2.11.7
15
+ Requires-Dist: pydantic-settings>=2.10.1
16
+ Dynamic: license-file
17
+
18
+
19
+ # ⚗️ PyThermoDB Settings
20
+
21
+ [![PyPI Downloads](https://static.pepy.tech/badge/pythermodb-settings/month)](https://pepy.tech/projects/pythermodb-settings)
22
+ ![PyPI Version](https://img.shields.io/pypi/v/pythermodb-settings)
23
+ ![Supported Python Versions](https://img.shields.io/pypi/pyversions/pythermodb-settings.svg)
24
+ ![License](https://img.shields.io/pypi/l/pythermodb-settings)
25
+
26
+ ## 📖 Introduction
27
+
28
+ **PyThermoDB Settings** is a Python package that acts as an interface between [pythermdb](https://github.com/sinagilassi/pythermdb) and other applications, providing robust, Pydantic-based data models and configuration structures for managing thermodynamic database (ThermoDB) settings.
29
+
30
+ ## ✨ Features
31
+
32
+ - 🧪 **Component Modeling:**
33
+
34
+ Define chemical components with attributes such as name, formula, state (gas, liquid, solid, aqueous), and mole fraction.
35
+
36
+ - 🌡️ **Condition Models:**
37
+
38
+ Represent temperature and pressure conditions with unit validation.
39
+
40
+ - ⚙️ **Component Configuration:**
41
+
42
+ TypedDict-based configuration for databook, table, mode, and custom labels.
43
+
44
+ - 📚 **Reference Models:**
45
+
46
+ - `ReferenceThermoDB`: Structure for reference thermodynamic databases, including references, contents, configs, rules, and label management.
47
+ - `ComponentReferenceThermoDB`: Links a component to its reference database.
48
+ - `ReferencesThermoDB`: Handles multiple references and their configurations.
49
+
50
+ - 📏 **Rule Management:**
51
+
52
+ Define and manage rules for components using dictionary-based structures.
53
+
54
+ - ✅ **Extensible and Validated:**
55
+
56
+ All models use Pydantic for input validation and extensibility.
57
+
58
+
59
+ ## 💾 Installation
60
+
61
+ Install via pip (after packaging):
62
+
63
+ ```bash
64
+ pip install pythermodb_settings
65
+ ```
66
+
67
+
68
+ ## 🚀 Usage Example
69
+
70
+ ```python
71
+ from pythermodb_settings.models import Component, Temperature, Pressure
72
+
73
+ # component example
74
+ component = Component(
75
+ name="Water",
76
+ formula="H2O",
77
+ state="l",
78
+ mole_fraction=1.0
79
+ )
80
+
81
+ # condition examples
82
+ temperature = Temperature(value=298.15, unit="K")
83
+ pressure = Pressure(value=1.0, unit="atm")
84
+ ```
85
+
86
+ ## 📝 API Documentation
87
+
88
+
89
+ ### 🧩 Models
90
+
91
+ - **Component**
92
+
93
+ - `name`: str — Name of the component
94
+ - `formula`: str — Chemical formula
95
+ - `state`: Literal['g', 'l', 's', 'aq'] — State (gas, liquid, solid, aqueous)
96
+ - `mole_fraction`: float — Mole fraction (default 1.0)
97
+
98
+ - **Temperature**
99
+
100
+ - `value`: float — Temperature value
101
+ - `unit`: str — Unit (e.g., 'K', 'C', 'F')
102
+
103
+ - **Pressure**
104
+
105
+ - `value`: float — Pressure value
106
+ - `unit`: str — Unit (e.g., 'bar', 'atm', 'Pa')
107
+
108
+ - **ComponentConfig**
109
+
110
+ - `databook`: str — Name of the databook
111
+ - `table`: str — Table name
112
+ - `mode`: str — Mode (e.g., 'DATA', 'EQUATION')
113
+ - `label`: str — Optional label
114
+ - `labels`: dict[str, str] — Optional labels
115
+
116
+ - **ReferenceThermoDB**
117
+
118
+ - `reference`: Dict[str, List[str]] — References and contents
119
+ - `contents`: List[str] — Reference contents
120
+ - `configs`: Dict[str, ComponentConfig] — Reference configs
121
+ - `rules`: Dict[str, ComponentRule] — Reference rules
122
+ - `labels`, `ignore_labels`, `ignore_props`: Optional label/property management
123
+
124
+ - **ComponentReferenceThermoDB**
125
+
126
+ - `component`: Component
127
+ - `reference_thermodb`: ReferenceThermoDB
128
+
129
+ - **ReferencesThermoDB**
130
+
131
+ - Handles multiple references, contents, configs, rules, and label management
132
+
133
+ ## 🤝 Contributing
134
+
135
+ Contributions are welcome! Please feel free to submit a Pull Request to improve the project.
136
+
137
+ ## 📝 License
138
+
139
+ This project is licensed under the MIT License. You are free to use, modify, and distribute this software in your own applications or projects. However, if you choose to use this app in another app or software, please ensure that my name, Sina Gilassi, remains credited as the original author. This includes retaining any references to the original repository or documentation where applicable. By doing so, you help acknowledge the effort and time invested in creating this project.
140
+
141
+ ## ❓ FAQ
142
+
143
+ For any questions, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/).
144
+
145
+ ## 👨‍💻 Authors
146
+
147
+ - [@sinagilassi](https://www.github.com/sinagilassi)
@@ -0,0 +1,15 @@
1
+ pythermodb_settings/__init__.py,sha256=VzJSYgJJNw_j5NmnIbq0pJhBd_9Kp-bbfOsRLepplSw,229
2
+ pythermodb_settings/app.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ pythermodb_settings/configs/__init__.py,sha256=QR38PBCzgoFwYqcViR9bFT2YIR5m9s7q8C7cV4fZjz4,211
4
+ pythermodb_settings/configs/about.py,sha256=ciuNeBHNLi61PAtqKVOUd4Fyy4G2fO3JRPxMSkhw1FM,379
5
+ pythermodb_settings/models/__init__.py,sha256=5OUwjWx1bgjiTIvRLP4vpcdysBgrPkPjH13IVuYr-Zg,527
6
+ pythermodb_settings/models/components.py,sha256=baeEklB9ULoIx_iSkPSWty85TK912ZDX4RAa64qje0k,1194
7
+ pythermodb_settings/models/conditions.py,sha256=Zm5JcM2kyMlS6b8hPbs6awa_6ps3xFoCVA4zwNPc5eg,1083
8
+ pythermodb_settings/models/configs.py,sha256=57nXShSbtiVo9fP2OFIbzRqS87oT4ITRLYJi_bp5cFI,674
9
+ pythermodb_settings/models/references.py,sha256=_MicXRkUdmZLMiuQEhMm2kJzmApHvz_CnjLaxxnueLg,5399
10
+ pythermodb_settings/models/rules.py,sha256=1a9CyTHwpQkZQXFJWDMrEcKQAOTOwquepoOQPGznTlc,74
11
+ pythermodb_settings-0.1.0.dist-info/licenses/LICENSE,sha256=pHRAx3wjVKpt2ec3NyhntY6_bGgJqV2SyE8xNUJ7MYE,1090
12
+ pythermodb_settings-0.1.0.dist-info/METADATA,sha256=V60YwBYoXryVdr0QPu-trzDbiufWzZos3tBhQqvnCLo,4894
13
+ pythermodb_settings-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ pythermodb_settings-0.1.0.dist-info/top_level.txt,sha256=6IdVIbW__wHFsKQYx7DDnXArm10qiJVIyaoSEFQylK4,20
15
+ pythermodb_settings-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sina Gilassi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ pythermodb_settings