GeneralManager 0.5.1__tar.gz → 0.6.0__tar.gz
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.
- {generalmanager-0.5.1 → generalmanager-0.6.0}/GeneralManager.egg-info/PKG-INFO +43 -43
- {generalmanager-0.5.1 → generalmanager-0.6.0}/GeneralManager.egg-info/SOURCES.txt +10 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/PKG-INFO +43 -43
- generalmanager-0.6.0/README.md +142 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/pyproject.toml +12 -20
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/api/graphql.py +2 -1
- generalmanager-0.6.0/src/general_manager/bucket/baseBucket.py +240 -0
- generalmanager-0.5.1/src/general_manager/interface/calculationInterface.py → generalmanager-0.6.0/src/general_manager/bucket/calculationBucket.py +192 -121
- generalmanager-0.6.0/src/general_manager/bucket/databaseBucket.py +235 -0
- generalmanager-0.6.0/src/general_manager/bucket/groupBucket.py +296 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/cache/modelDependencyCollector.py +5 -8
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/interface/baseInterface.py +28 -105
- generalmanager-0.6.0/src/general_manager/interface/calculationInterface.py +119 -0
- generalmanager-0.5.1/src/general_manager/interface/databaseInterface.py → generalmanager-0.6.0/src/general_manager/interface/databaseBasedInterface.py +141 -348
- generalmanager-0.6.0/src/general_manager/interface/databaseInterface.py +106 -0
- generalmanager-0.6.0/src/general_manager/interface/readOnlyInterface.py +107 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/manager/generalManager.py +11 -10
- generalmanager-0.6.0/src/general_manager/manager/groupManager.py +125 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/manager/meta.py +19 -5
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/permission/basePermission.py +4 -6
- generalmanager-0.6.0/src/general_manager/permission/fileBasedPermission.py +0 -0
- generalmanager-0.6.0/tests/test_baseBucket.py +325 -0
- generalmanager-0.6.0/tests/test_baseInterface.py +273 -0
- generalmanager-0.6.0/tests/test_dabaseBasedInterface.py +274 -0
- generalmanager-0.6.0/tests/test_databaseBucket.py +333 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_generalManager.py +16 -16
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_generalManagerMeta.py +4 -3
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_groupManager.py +5 -2
- generalmanager-0.5.1/README.md +0 -142
- generalmanager-0.5.1/src/general_manager/interface/__init__.py +0 -3
- generalmanager-0.5.1/src/general_manager/manager/groupManager.py +0 -300
- {generalmanager-0.5.1 → generalmanager-0.6.0}/GeneralManager.egg-info/dependency_links.txt +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/GeneralManager.egg-info/requires.txt +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/GeneralManager.egg-info/top_level.txt +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/LICENSE +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/setup.cfg +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/api/mutation.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/api/property.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/apps.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/auxiliary/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/auxiliary/argsToKwargs.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/auxiliary/filterParser.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/auxiliary/jsonEncoder.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/auxiliary/makeCacheKey.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/auxiliary/noneToZero.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/auxiliary/pathMapping.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/cache/cacheDecorator.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/cache/cacheTracker.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/cache/dependencyIndex.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/cache/signals.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/factory/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/factory/autoFactory.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/factory/factories.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/factory/factoryMethods.py +0 -0
- /generalmanager-0.5.1/src/general_manager/permission/fileBasedPermission.py → /generalmanager-0.6.0/src/general_manager/interface/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/manager/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/manager/input.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/measurement/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/measurement/measurement.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/measurement/measurementField.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/permission/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/permission/managerBasedPermission.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/permission/permissionChecks.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/permission/permissionDataManager.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/rule/__init__.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/rule/handler.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/src/general_manager/rule/rule.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_argsToKwargs.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_autoFactory.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_basePermission.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_cacheDecorator.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_cacheTracker.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_dependencyIndex.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_factories.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_factoryMethods.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_filterParser.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_graph_ql.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_input.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_jsonEncoder.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_makeCacheKey.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_managerBasedPermission.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_measurement.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_measurement_field.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_modelDependencyCollector.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_noneToZero.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_rule_handler.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_rules.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_settings.py +0 -0
- {generalmanager-0.5.1 → generalmanager-0.6.0}/tests/test_signals.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: GeneralManager
|
3
|
-
Version: 0.
|
4
|
-
Summary:
|
3
|
+
Version: 0.6.0
|
4
|
+
Summary: Modular Django-based data management framework with ORM, GraphQL, fine-grained permissions, rule validation, calculations and caching.
|
5
5
|
Author-email: Tim Kleindick <tkleindick@yahoo.de>
|
6
6
|
License-Expression: MIT
|
7
7
|
Requires-Python: >=3.12
|
@@ -37,51 +37,51 @@ Dynamic: license-file
|
|
37
37
|
|
38
38
|
# GeneralManager
|
39
39
|
|
40
|
-
##
|
40
|
+
## Overview
|
41
41
|
|
42
|
-
|
42
|
+
GeneralManager is a powerful and flexible framework designed for managing and processing data. It provides a modular structure that enables developers to implement complex business logic efficiently. The module is written entirely in Python and uses Django as the backend framework.
|
43
43
|
|
44
|
-
##
|
44
|
+
## Key Features
|
45
45
|
|
46
|
-
### 1. **
|
47
|
-
- **
|
48
|
-
- **
|
49
|
-
- **
|
46
|
+
### 1. **Data Management**
|
47
|
+
- **Flexibility**: Supports managing all kinds of data, not just projects and derivatives.
|
48
|
+
- **Database Integration**: Seamless integration with the Django ORM for database operations.
|
49
|
+
- **External Interfaces**: Support for interfaces to other programs, such as Excel.
|
50
50
|
|
51
|
-
### 2. **
|
52
|
-
- **Django
|
53
|
-
- **
|
51
|
+
### 2. **Data Modeling**
|
52
|
+
- **Django Models**: The data structure is based on Django models, extended by custom fields like `MeasurementField`.
|
53
|
+
- **Rules and Validations**: Define rules for data validation, e.g., ensuring that a project's start date is before its end date.
|
54
54
|
|
55
|
-
### 3. **GraphQL
|
56
|
-
-
|
57
|
-
-
|
55
|
+
### 3. **GraphQL Integration**
|
56
|
+
- Automatic generation of GraphQL interfaces for all models.
|
57
|
+
- Support for custom queries and mutations.
|
58
58
|
|
59
|
-
### 4. **
|
60
|
-
- **ManagerBasedPermission**:
|
61
|
-
-
|
59
|
+
### 4. **Permission System**
|
60
|
+
- **ManagerBasedPermission**: A flexible permission system based on user roles and attributes.
|
61
|
+
- Attribute-level CRUD permissions.
|
62
62
|
|
63
63
|
### 5. **Interfaces**
|
64
|
-
- **CalculationInterface**:
|
65
|
-
- **DatabaseInterface**:
|
66
|
-
- **ReadOnlyInterface**:
|
64
|
+
- **CalculationInterface**: Allows the implementation of calculation logic.
|
65
|
+
- **DatabaseInterface**: Provides a standardized interface for database operations.
|
66
|
+
- **ReadOnlyInterface**: For read-only data access.
|
67
67
|
|
68
|
-
### 6. **
|
69
|
-
- **
|
70
|
-
- **
|
68
|
+
### 6. **Data Distribution and Calculations**
|
69
|
+
- **Volume Distribution**: Automatically calculates and distributes volume over multiple years.
|
70
|
+
- **Commercial Calculations**: Calculates total volume, shipping costs, and revenue for projects.
|
71
71
|
|
72
|
-
##
|
72
|
+
## Usage
|
73
73
|
|
74
74
|
### Installation
|
75
75
|
|
76
|
-
|
76
|
+
Install the module via `pip`:
|
77
77
|
|
78
78
|
```bash
|
79
79
|
pip install GeneralManager
|
80
80
|
```
|
81
81
|
|
82
|
-
###
|
82
|
+
### Example Code
|
83
83
|
|
84
|
-
|
84
|
+
The following example demonstrates how to create a GeneralManager and generate sample data (in this case 10 projects):
|
85
85
|
|
86
86
|
```python
|
87
87
|
from general_manager import GeneralManager
|
@@ -134,11 +134,11 @@ class Project(GeneralManager):
|
|
134
134
|
Project.Factory.createBatch(10)
|
135
135
|
```
|
136
136
|
|
137
|
-
### GraphQL
|
137
|
+
### GraphQL Integration
|
138
138
|
|
139
|
-
|
139
|
+
The module automatically generates GraphQL endpoints for all models. You can run queries and mutations through the GraphQL URL defined in your Django settings.
|
140
140
|
|
141
|
-
|
141
|
+
Example of a GraphQL query:
|
142
142
|
|
143
143
|
```graphql
|
144
144
|
query {
|
@@ -154,26 +154,26 @@ query {
|
|
154
154
|
}
|
155
155
|
```
|
156
156
|
|
157
|
-
##
|
157
|
+
## Benefits
|
158
158
|
|
159
|
-
- **
|
160
|
-
- **
|
161
|
-
- **Integration**:
|
162
|
-
- **
|
163
|
-
- **
|
164
|
-
- **Caching**:
|
159
|
+
- **Modularity**: Easy to extend and adapt.
|
160
|
+
- **Flexibility**: Supports complex business logic and calculations.
|
161
|
+
- **Integration**: Seamless integration with Django and GraphQL.
|
162
|
+
- **Permissions**: Fine-grained permissions for users and attributes.
|
163
|
+
- **Data Validation**: Automatic validation of data through rules and constraints.
|
164
|
+
- **Caching**: Automatic cache generation with the `@cached` decorator to improve performance.
|
165
165
|
|
166
|
-
##
|
166
|
+
## Requirements
|
167
167
|
|
168
168
|
- Python >= 3.12
|
169
169
|
- Django >= 5.2
|
170
|
-
-
|
170
|
+
- Additional dependencies (see `requirements.txt`):
|
171
171
|
- `graphene`
|
172
172
|
- `numpy`
|
173
173
|
- `Pint`
|
174
174
|
- `factory_boy`
|
175
|
-
-
|
175
|
+
- and more.
|
176
176
|
|
177
|
-
##
|
177
|
+
## License
|
178
178
|
|
179
|
-
|
179
|
+
This project is distributed under the **Non-Commercial MIT License**. It may only be used for non-commercial purposes. For further details see the [LICENSE](./LICENSE) file.
|
@@ -18,6 +18,10 @@ src/general_manager/auxiliary/jsonEncoder.py
|
|
18
18
|
src/general_manager/auxiliary/makeCacheKey.py
|
19
19
|
src/general_manager/auxiliary/noneToZero.py
|
20
20
|
src/general_manager/auxiliary/pathMapping.py
|
21
|
+
src/general_manager/bucket/baseBucket.py
|
22
|
+
src/general_manager/bucket/calculationBucket.py
|
23
|
+
src/general_manager/bucket/databaseBucket.py
|
24
|
+
src/general_manager/bucket/groupBucket.py
|
21
25
|
src/general_manager/cache/cacheDecorator.py
|
22
26
|
src/general_manager/cache/cacheTracker.py
|
23
27
|
src/general_manager/cache/dependencyIndex.py
|
@@ -30,7 +34,9 @@ src/general_manager/factory/factoryMethods.py
|
|
30
34
|
src/general_manager/interface/__init__.py
|
31
35
|
src/general_manager/interface/baseInterface.py
|
32
36
|
src/general_manager/interface/calculationInterface.py
|
37
|
+
src/general_manager/interface/databaseBasedInterface.py
|
33
38
|
src/general_manager/interface/databaseInterface.py
|
39
|
+
src/general_manager/interface/readOnlyInterface.py
|
34
40
|
src/general_manager/manager/__init__.py
|
35
41
|
src/general_manager/manager/generalManager.py
|
36
42
|
src/general_manager/manager/groupManager.py
|
@@ -50,9 +56,13 @@ src/general_manager/rule/handler.py
|
|
50
56
|
src/general_manager/rule/rule.py
|
51
57
|
tests/test_argsToKwargs.py
|
52
58
|
tests/test_autoFactory.py
|
59
|
+
tests/test_baseBucket.py
|
60
|
+
tests/test_baseInterface.py
|
53
61
|
tests/test_basePermission.py
|
54
62
|
tests/test_cacheDecorator.py
|
55
63
|
tests/test_cacheTracker.py
|
64
|
+
tests/test_dabaseBasedInterface.py
|
65
|
+
tests/test_databaseBucket.py
|
56
66
|
tests/test_dependencyIndex.py
|
57
67
|
tests/test_factories.py
|
58
68
|
tests/test_factoryMethods.py
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: GeneralManager
|
3
|
-
Version: 0.
|
4
|
-
Summary:
|
3
|
+
Version: 0.6.0
|
4
|
+
Summary: Modular Django-based data management framework with ORM, GraphQL, fine-grained permissions, rule validation, calculations and caching.
|
5
5
|
Author-email: Tim Kleindick <tkleindick@yahoo.de>
|
6
6
|
License-Expression: MIT
|
7
7
|
Requires-Python: >=3.12
|
@@ -37,51 +37,51 @@ Dynamic: license-file
|
|
37
37
|
|
38
38
|
# GeneralManager
|
39
39
|
|
40
|
-
##
|
40
|
+
## Overview
|
41
41
|
|
42
|
-
|
42
|
+
GeneralManager is a powerful and flexible framework designed for managing and processing data. It provides a modular structure that enables developers to implement complex business logic efficiently. The module is written entirely in Python and uses Django as the backend framework.
|
43
43
|
|
44
|
-
##
|
44
|
+
## Key Features
|
45
45
|
|
46
|
-
### 1. **
|
47
|
-
- **
|
48
|
-
- **
|
49
|
-
- **
|
46
|
+
### 1. **Data Management**
|
47
|
+
- **Flexibility**: Supports managing all kinds of data, not just projects and derivatives.
|
48
|
+
- **Database Integration**: Seamless integration with the Django ORM for database operations.
|
49
|
+
- **External Interfaces**: Support for interfaces to other programs, such as Excel.
|
50
50
|
|
51
|
-
### 2. **
|
52
|
-
- **Django
|
53
|
-
- **
|
51
|
+
### 2. **Data Modeling**
|
52
|
+
- **Django Models**: The data structure is based on Django models, extended by custom fields like `MeasurementField`.
|
53
|
+
- **Rules and Validations**: Define rules for data validation, e.g., ensuring that a project's start date is before its end date.
|
54
54
|
|
55
|
-
### 3. **GraphQL
|
56
|
-
-
|
57
|
-
-
|
55
|
+
### 3. **GraphQL Integration**
|
56
|
+
- Automatic generation of GraphQL interfaces for all models.
|
57
|
+
- Support for custom queries and mutations.
|
58
58
|
|
59
|
-
### 4. **
|
60
|
-
- **ManagerBasedPermission**:
|
61
|
-
-
|
59
|
+
### 4. **Permission System**
|
60
|
+
- **ManagerBasedPermission**: A flexible permission system based on user roles and attributes.
|
61
|
+
- Attribute-level CRUD permissions.
|
62
62
|
|
63
63
|
### 5. **Interfaces**
|
64
|
-
- **CalculationInterface**:
|
65
|
-
- **DatabaseInterface**:
|
66
|
-
- **ReadOnlyInterface**:
|
64
|
+
- **CalculationInterface**: Allows the implementation of calculation logic.
|
65
|
+
- **DatabaseInterface**: Provides a standardized interface for database operations.
|
66
|
+
- **ReadOnlyInterface**: For read-only data access.
|
67
67
|
|
68
|
-
### 6. **
|
69
|
-
- **
|
70
|
-
- **
|
68
|
+
### 6. **Data Distribution and Calculations**
|
69
|
+
- **Volume Distribution**: Automatically calculates and distributes volume over multiple years.
|
70
|
+
- **Commercial Calculations**: Calculates total volume, shipping costs, and revenue for projects.
|
71
71
|
|
72
|
-
##
|
72
|
+
## Usage
|
73
73
|
|
74
74
|
### Installation
|
75
75
|
|
76
|
-
|
76
|
+
Install the module via `pip`:
|
77
77
|
|
78
78
|
```bash
|
79
79
|
pip install GeneralManager
|
80
80
|
```
|
81
81
|
|
82
|
-
###
|
82
|
+
### Example Code
|
83
83
|
|
84
|
-
|
84
|
+
The following example demonstrates how to create a GeneralManager and generate sample data (in this case 10 projects):
|
85
85
|
|
86
86
|
```python
|
87
87
|
from general_manager import GeneralManager
|
@@ -134,11 +134,11 @@ class Project(GeneralManager):
|
|
134
134
|
Project.Factory.createBatch(10)
|
135
135
|
```
|
136
136
|
|
137
|
-
### GraphQL
|
137
|
+
### GraphQL Integration
|
138
138
|
|
139
|
-
|
139
|
+
The module automatically generates GraphQL endpoints for all models. You can run queries and mutations through the GraphQL URL defined in your Django settings.
|
140
140
|
|
141
|
-
|
141
|
+
Example of a GraphQL query:
|
142
142
|
|
143
143
|
```graphql
|
144
144
|
query {
|
@@ -154,26 +154,26 @@ query {
|
|
154
154
|
}
|
155
155
|
```
|
156
156
|
|
157
|
-
##
|
157
|
+
## Benefits
|
158
158
|
|
159
|
-
- **
|
160
|
-
- **
|
161
|
-
- **Integration**:
|
162
|
-
- **
|
163
|
-
- **
|
164
|
-
- **Caching**:
|
159
|
+
- **Modularity**: Easy to extend and adapt.
|
160
|
+
- **Flexibility**: Supports complex business logic and calculations.
|
161
|
+
- **Integration**: Seamless integration with Django and GraphQL.
|
162
|
+
- **Permissions**: Fine-grained permissions for users and attributes.
|
163
|
+
- **Data Validation**: Automatic validation of data through rules and constraints.
|
164
|
+
- **Caching**: Automatic cache generation with the `@cached` decorator to improve performance.
|
165
165
|
|
166
|
-
##
|
166
|
+
## Requirements
|
167
167
|
|
168
168
|
- Python >= 3.12
|
169
169
|
- Django >= 5.2
|
170
|
-
-
|
170
|
+
- Additional dependencies (see `requirements.txt`):
|
171
171
|
- `graphene`
|
172
172
|
- `numpy`
|
173
173
|
- `Pint`
|
174
174
|
- `factory_boy`
|
175
|
-
-
|
175
|
+
- and more.
|
176
176
|
|
177
|
-
##
|
177
|
+
## License
|
178
178
|
|
179
|
-
|
179
|
+
This project is distributed under the **Non-Commercial MIT License**. It may only be used for non-commercial purposes. For further details see the [LICENSE](./LICENSE) file.
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# GeneralManager
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
GeneralManager is a powerful and flexible framework designed for managing and processing data. It provides a modular structure that enables developers to implement complex business logic efficiently. The module is written entirely in Python and uses Django as the backend framework.
|
6
|
+
|
7
|
+
## Key Features
|
8
|
+
|
9
|
+
### 1. **Data Management**
|
10
|
+
- **Flexibility**: Supports managing all kinds of data, not just projects and derivatives.
|
11
|
+
- **Database Integration**: Seamless integration with the Django ORM for database operations.
|
12
|
+
- **External Interfaces**: Support for interfaces to other programs, such as Excel.
|
13
|
+
|
14
|
+
### 2. **Data Modeling**
|
15
|
+
- **Django Models**: The data structure is based on Django models, extended by custom fields like `MeasurementField`.
|
16
|
+
- **Rules and Validations**: Define rules for data validation, e.g., ensuring that a project's start date is before its end date.
|
17
|
+
|
18
|
+
### 3. **GraphQL Integration**
|
19
|
+
- Automatic generation of GraphQL interfaces for all models.
|
20
|
+
- Support for custom queries and mutations.
|
21
|
+
|
22
|
+
### 4. **Permission System**
|
23
|
+
- **ManagerBasedPermission**: A flexible permission system based on user roles and attributes.
|
24
|
+
- Attribute-level CRUD permissions.
|
25
|
+
|
26
|
+
### 5. **Interfaces**
|
27
|
+
- **CalculationInterface**: Allows the implementation of calculation logic.
|
28
|
+
- **DatabaseInterface**: Provides a standardized interface for database operations.
|
29
|
+
- **ReadOnlyInterface**: For read-only data access.
|
30
|
+
|
31
|
+
### 6. **Data Distribution and Calculations**
|
32
|
+
- **Volume Distribution**: Automatically calculates and distributes volume over multiple years.
|
33
|
+
- **Commercial Calculations**: Calculates total volume, shipping costs, and revenue for projects.
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
### Installation
|
38
|
+
|
39
|
+
Install the module via `pip`:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
pip install GeneralManager
|
43
|
+
```
|
44
|
+
|
45
|
+
### Example Code
|
46
|
+
|
47
|
+
The following example demonstrates how to create a GeneralManager and generate sample data (in this case 10 projects):
|
48
|
+
|
49
|
+
```python
|
50
|
+
from general_manager import GeneralManager
|
51
|
+
from general_manager.interface.database import DatabaseInterface
|
52
|
+
from general_manager.measurement import MeasurementField, Measurement
|
53
|
+
from general_manager.permission import ManagerBasedPermission
|
54
|
+
|
55
|
+
class Project(GeneralManager):
|
56
|
+
name: str
|
57
|
+
start_date: Optional[date]
|
58
|
+
end_date: Optional[date]
|
59
|
+
total_capex: Optional[Measurement]
|
60
|
+
derivative_list: DatabaseBucket[Derivative]
|
61
|
+
|
62
|
+
class Interface(DatabaseInterface):
|
63
|
+
name = CharField(max_length=50)
|
64
|
+
number = CharField(max_length=7, validators=[RegexValidator(r"^AP\d{4,5}$")])
|
65
|
+
description = TextField(null=True, blank=True)
|
66
|
+
start_date = DateField(null=True, blank=True)
|
67
|
+
end_date = DateField(null=True, blank=True)
|
68
|
+
total_capex = MeasurementField(base_unit="EUR", null=True, blank=True)
|
69
|
+
|
70
|
+
class Meta:
|
71
|
+
constraints = [
|
72
|
+
constraints.UniqueConstraint(
|
73
|
+
fields=["name", "number"], name="unique_booking"
|
74
|
+
)
|
75
|
+
]
|
76
|
+
|
77
|
+
rules = [
|
78
|
+
Rule["Project"](
|
79
|
+
lambda x: cast(date, x.start_date) < cast(date, x.end_date)
|
80
|
+
),
|
81
|
+
Rule["Project"](lambda x: cast(Measurement, x.total_capex) >= "0 EUR"),
|
82
|
+
]
|
83
|
+
|
84
|
+
class Factory:
|
85
|
+
name = LazyProjectName()
|
86
|
+
end_date = LazyDeltaDate(365 * 6, "start_date")
|
87
|
+
total_capex = LazyMeasurement(75_000, 1_000_000, "EUR")
|
88
|
+
|
89
|
+
class Permission(ManagerBasedPermission):
|
90
|
+
__read__ = ["ends_with:name:X-771", "public"]
|
91
|
+
__create__ = ["admin", "isMatchingKeyAccount"]
|
92
|
+
__update__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
|
93
|
+
__delete__ = ["admin", "isMatchingKeyAccount", "isProjectTeamMember"]
|
94
|
+
|
95
|
+
total_capex = {"update": ["isSalesResponsible", "isProjectManager"]}
|
96
|
+
|
97
|
+
Project.Factory.createBatch(10)
|
98
|
+
```
|
99
|
+
|
100
|
+
### GraphQL Integration
|
101
|
+
|
102
|
+
The module automatically generates GraphQL endpoints for all models. You can run queries and mutations through the GraphQL URL defined in your Django settings.
|
103
|
+
|
104
|
+
Example of a GraphQL query:
|
105
|
+
|
106
|
+
```graphql
|
107
|
+
query {
|
108
|
+
projectList {
|
109
|
+
name
|
110
|
+
startDate
|
111
|
+
endDate
|
112
|
+
totalCapex {
|
113
|
+
value
|
114
|
+
unit
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
```
|
119
|
+
|
120
|
+
## Benefits
|
121
|
+
|
122
|
+
- **Modularity**: Easy to extend and adapt.
|
123
|
+
- **Flexibility**: Supports complex business logic and calculations.
|
124
|
+
- **Integration**: Seamless integration with Django and GraphQL.
|
125
|
+
- **Permissions**: Fine-grained permissions for users and attributes.
|
126
|
+
- **Data Validation**: Automatic validation of data through rules and constraints.
|
127
|
+
- **Caching**: Automatic cache generation with the `@cached` decorator to improve performance.
|
128
|
+
|
129
|
+
## Requirements
|
130
|
+
|
131
|
+
- Python >= 3.12
|
132
|
+
- Django >= 5.2
|
133
|
+
- Additional dependencies (see `requirements.txt`):
|
134
|
+
- `graphene`
|
135
|
+
- `numpy`
|
136
|
+
- `Pint`
|
137
|
+
- `factory_boy`
|
138
|
+
- and more.
|
139
|
+
|
140
|
+
## License
|
141
|
+
|
142
|
+
This project is distributed under the **Non-Commercial MIT License**. It may only be used for non-commercial purposes. For further details see the [LICENSE](./LICENSE) file.
|
@@ -1,18 +1,13 @@
|
|
1
1
|
[build-system]
|
2
|
-
requires = [
|
3
|
-
"setuptools>=42",
|
4
|
-
"wheel",
|
5
|
-
]
|
2
|
+
requires = ["setuptools>=42", "wheel"]
|
6
3
|
build-backend = "setuptools.build_meta"
|
7
4
|
|
8
5
|
[project]
|
9
6
|
name = "GeneralManager"
|
10
|
-
version = "0.
|
11
|
-
description = "
|
7
|
+
version = "0.6.0"
|
8
|
+
description = "Modular Django-based data management framework with ORM, GraphQL, fine-grained permissions, rule validation, calculations and caching."
|
12
9
|
readme = "README.md"
|
13
|
-
authors = [
|
14
|
-
{ name = "Tim Kleindick", email = "tkleindick@yahoo.de" },
|
15
|
-
]
|
10
|
+
authors = [{ name = "Tim Kleindick", email = "tkleindick@yahoo.de" }]
|
16
11
|
license = "MIT"
|
17
12
|
license-files = ["LICENSE"]
|
18
13
|
requires-python = ">=3.12"
|
@@ -46,19 +41,16 @@ dependencies = [
|
|
46
41
|
]
|
47
42
|
|
48
43
|
[tool.setuptools.packages.find]
|
49
|
-
where = [
|
50
|
-
"src",
|
51
|
-
"general_manager",
|
52
|
-
]
|
44
|
+
where = ["src", "general_manager"]
|
53
45
|
|
54
46
|
[tool.semantic_release]
|
55
|
-
allow_zero_version
|
56
|
-
major_on_zero
|
57
|
-
version_toml
|
58
|
-
branch
|
59
|
-
build_command
|
60
|
-
upload_to_PyPI
|
61
|
-
upload_to_release
|
47
|
+
allow_zero_version = true
|
48
|
+
major_on_zero = false
|
49
|
+
version_toml = ["pyproject.toml:project.version"]
|
50
|
+
branch = "main"
|
51
|
+
build_command = "python -m build"
|
52
|
+
upload_to_PyPI = true
|
53
|
+
upload_to_release = true
|
62
54
|
|
63
55
|
[tool.semantic_release.remote]
|
64
56
|
ignore_token_for_push = true
|
@@ -9,7 +9,8 @@ import json
|
|
9
9
|
from general_manager.measurement.measurement import Measurement
|
10
10
|
from general_manager.manager.generalManager import GeneralManagerMeta, GeneralManager
|
11
11
|
from general_manager.api.property import GraphQLProperty
|
12
|
-
from general_manager.
|
12
|
+
from general_manager.bucket.baseBucket import Bucket
|
13
|
+
from general_manager.interface.baseInterface import InterfaceBase
|
13
14
|
|
14
15
|
if TYPE_CHECKING:
|
15
16
|
from general_manager.permission.basePermission import BasePermission
|