vtlengine 1.0__tar.gz → 1.0.2__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.

Potentially problematic release.


This version of vtlengine might be problematic. Click here for more details.

Files changed (72) hide show
  1. vtlengine-1.0.2/PKG-INFO +245 -0
  2. vtlengine-1.0.2/README.md +213 -0
  3. vtlengine-1.0.2/pyproject.toml +76 -0
  4. vtlengine-1.0.2/src/vtlengine/API/_InternalApi.py +382 -0
  5. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/API/__init__.py +110 -68
  6. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTConstructor.py +188 -98
  7. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTConstructorModules/Expr.py +402 -205
  8. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTConstructorModules/ExprComponents.py +248 -104
  9. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTConstructorModules/Terminals.py +158 -95
  10. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTEncoders.py +1 -1
  11. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTTemplate.py +24 -9
  12. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTVisitor.py +8 -12
  13. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/DAG/__init__.py +43 -35
  14. vtlengine-1.0.2/src/vtlengine/AST/DAG/_words.py +9 -0
  15. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/Grammar/Vtl.g4 +49 -20
  16. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/Grammar/VtlTokens.g4 +13 -1
  17. vtlengine-1.0.2/src/vtlengine/AST/Grammar/lexer.py +2139 -0
  18. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/Grammar/parser.py +7524 -4343
  19. vtlengine-1.0.2/src/vtlengine/AST/Grammar/tokens.py +169 -0
  20. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/VtlVisitor.py +16 -5
  21. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/__init__.py +41 -11
  22. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/DataTypes/NumericTypesHandling.py +5 -4
  23. vtlengine-1.0.2/src/vtlengine/DataTypes/TimeHandling.py +519 -0
  24. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/DataTypes/__init__.py +304 -218
  25. vtlengine-1.0.2/src/vtlengine/Exceptions/__init__.py +176 -0
  26. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Exceptions/messages.py +149 -69
  27. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Interpreter/__init__.py +817 -497
  28. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Model/__init__.py +172 -121
  29. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Aggregation.py +156 -95
  30. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Analytic.py +167 -79
  31. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Assignment.py +7 -4
  32. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Boolean.py +27 -32
  33. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/CastOperator.py +177 -131
  34. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Clause.py +137 -99
  35. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Comparison.py +148 -117
  36. vtlengine-1.0.2/src/vtlengine/Operators/Conditional.py +431 -0
  37. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/General.py +68 -47
  38. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/HROperators.py +91 -72
  39. vtlengine-1.0.2/src/vtlengine/Operators/Join.py +443 -0
  40. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Numeric.py +129 -46
  41. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/RoleSetter.py +16 -15
  42. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/Set.py +61 -36
  43. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/String.py +213 -139
  44. vtlengine-1.0.2/src/vtlengine/Operators/Time.py +920 -0
  45. vtlengine-1.0.2/src/vtlengine/Operators/Validation.py +241 -0
  46. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/Operators/__init__.py +340 -213
  47. vtlengine-1.0.2/src/vtlengine/Utils/__init__.py +406 -0
  48. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/__init__.py +1 -1
  49. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/files/output/__init__.py +15 -6
  50. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/files/output/_time_period_representation.py +10 -9
  51. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/files/parser/__init__.py +79 -52
  52. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/files/parser/_rfc_dialect.py +6 -5
  53. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/files/parser/_time_checking.py +48 -37
  54. vtlengine-1.0/PKG-INFO +0 -104
  55. vtlengine-1.0/README.md +0 -74
  56. vtlengine-1.0/pyproject.toml +0 -41
  57. vtlengine-1.0/src/vtlengine/API/_InternalApi.py +0 -325
  58. vtlengine-1.0/src/vtlengine/AST/DAG/_words.py +0 -9
  59. vtlengine-1.0/src/vtlengine/AST/Grammar/lexer.py +0 -1439
  60. vtlengine-1.0/src/vtlengine/AST/Grammar/tokens.py +0 -157
  61. vtlengine-1.0/src/vtlengine/DataTypes/TimeHandling.py +0 -624
  62. vtlengine-1.0/src/vtlengine/Exceptions/__init__.py +0 -107
  63. vtlengine-1.0/src/vtlengine/Operators/Conditional.py +0 -239
  64. vtlengine-1.0/src/vtlengine/Operators/Join.py +0 -344
  65. vtlengine-1.0/src/vtlengine/Operators/Time.py +0 -668
  66. vtlengine-1.0/src/vtlengine/Operators/Validation.py +0 -200
  67. vtlengine-1.0/src/vtlengine/Utils/__init__.py +0 -215
  68. {vtlengine-1.0 → vtlengine-1.0.2}/LICENSE.md +0 -0
  69. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTConstructorModules/__init__.py +0 -0
  70. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/ASTDataExchange.py +0 -0
  71. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/AST/Grammar/__init__.py +0 -0
  72. {vtlengine-1.0 → vtlengine-1.0.2}/src/vtlengine/files/__init__.py +0 -0
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.1
2
+ Name: vtlengine
3
+ Version: 1.0.2
4
+ Summary: Run and Validate VTL Scripts
5
+ Home-page: https://github.com/Meaningful-Data/vtlengine
6
+ License: AGPL-3.0
7
+ Keywords: vtl,sdmx,vtlengine,Validation and Transformation Language
8
+ Author: MeaningfulData
9
+ Author-email: info@meaningfuldata.eu
10
+ Requires-Python: >=3.10,<4.0
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Information Technology
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: antlr4-python3-runtime (==4.9.2)
23
+ Requires-Dist: bottleneck (>=1.3.4,<2.0.0)
24
+ Requires-Dist: duckdb (>=1.1.1,<2.0.0)
25
+ Requires-Dist: networkx (>=2.8.8,<3.0.0)
26
+ Requires-Dist: numexpr (>=2.9.0,<3.0.0)
27
+ Requires-Dist: pandas (>=2.1.4,<3.0.0)
28
+ Requires-Dist: s3fs (>=2024.9.0,<2025.0.0)
29
+ Requires-Dist: sqlglot (>=22.2.0,<23.0.0)
30
+ Project-URL: Repository, https://github.com/Meaningful-Data/vtlengine
31
+ Description-Content-Type: text/markdown
32
+
33
+ # VTL Engine
34
+
35
+ | | |
36
+ |---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
37
+ | Testing | [![Testing](https://github.com/Meaningful-Data/vtlengine/actions/workflows/testing.yml/badge.svg)](https://github.com/Meaningful-Data/vtlengine/actions/workflows/testing.yml) |
38
+ | Package | [![PyPI Latest Release](https://img.shields.io/pypi/v/vtlengine.svg)](https://pypi.org/project/vtlengine/) |
39
+ | License | [![License - AGPL 3.0](https://img.shields.io/pypi/l/vtlengine.svg)](https://github.com/Meaningful-Data/vtlengine/blob/main/LICENSE.md) |
40
+
41
+ ## Introduction
42
+
43
+ The VTL Engine is a Python library for validating and running VTL scripts.
44
+
45
+ It is a Python-based library around the [VTL Language](http://sdmx.org/?page_id=5096).
46
+
47
+ ## Installation
48
+
49
+ ### Requirements
50
+
51
+ The VTL Engine requires Python 3.10 or higher.
52
+
53
+ ### Install with pip
54
+
55
+ To install the VTL Engine on any Operating System, you can use pip:
56
+
57
+ ```bash
58
+
59
+ pip install vtlengine
60
+
61
+ ```
62
+
63
+ *Note: it is recommended to install the VTL Engine in a virtual environment.*
64
+
65
+ ## Usage
66
+
67
+ The VTL Engine API implements two basic methods:
68
+
69
+ * **Semantic Analysis**: aimed at validating the correctness of a script and computing the data
70
+ structures of the data sets created in the script.
71
+ * **Run**: aimed at executing the provided input on the provided input datasets.
72
+
73
+ Any action with VTL requires the following elements as input:
74
+
75
+ * **VTL Script**: Is the VTL to be executed, which includes the transformation scheme, as well as de
76
+ User Defined Operators, Hierarchical Rulesets and Datapoint Rulesets. It is provided as a string
77
+ or as a Path object to a vtl file.
78
+ * **Data structures** : Provides the structure of the input artifacts of the VTL script, according
79
+ to
80
+ the VTL Information model. Given that the current version doesn't prescribe a standard format for
81
+ providing the information, the VTL Engine is implementing a JSON format that can be found here.
82
+ Data Structures can be provided as Dictionaries or as Paths to JSON files. It is possible to have
83
+ * **External routines**: The VTL Engine allows using SQL (SQLite) with the eval operator. Can be
84
+ provided as a string with the SQL or as a path object to an SQL file. Its default value is `None`,
85
+ which shall be used if external routines are not applicable to the VTL script.
86
+ * **Value domains**: Provides the value domains that are used in the VTL script, normally with an in
87
+ operator. Can be provided as a dictionary or as a path to a JSON file. Its default value
88
+ is `None`, which shall be used if value domains are not applicable to the VTL script.
89
+
90
+ ### Semantic Analysis
91
+
92
+ The `semantic_analysis` method serves to validate the correctness of a VTL script, as well as to
93
+ calculate the data structures of the datasets generated by the VTL script itself (that calculation
94
+ is a pre-requisite for the semantic analysis).
95
+
96
+ * If the VTL script is correct, the method returns a dictionary with the data structures of all the
97
+ datasets generated by the script.
98
+ * If the VTL script is incorrect, raises a VTL Engine custom error Explaining the error.
99
+
100
+ #### Example 1: Correct VTL
101
+
102
+ ```python
103
+ from vtlengine import semantic_analysis
104
+
105
+ script = """
106
+ DS_A := DS_1 * 10;
107
+ """
108
+
109
+ data_structures = {
110
+ 'datasets': [
111
+ {'name': 'DS_1',
112
+ 'DataStructure': [
113
+ {'name': 'Id_1',
114
+ 'type':
115
+ 'Integer',
116
+ 'role': 'Identifier',
117
+ 'nullable': False},
118
+ {'name': 'Me_1',
119
+ 'type': 'Number',
120
+ 'role': 'Measure',
121
+ 'nullable': True}
122
+ ]
123
+ }
124
+ ]
125
+ }
126
+
127
+ sa_result = semantic_analysis(script=script, data_structures=data_structures)
128
+
129
+ print(sa_result)
130
+
131
+ ```
132
+
133
+ Returns:
134
+
135
+ ```
136
+ {'DS_A': Dataset(name='DS_A', components={'Id_1': Component(name='Id_1', data_type=<class 'vtlengine.DataTypes.Integer'>, role=<Role.IDENTIFIER: 'Identifier'>, nullable=False), 'Me_1': Component(name='Me_1', data_type=<class 'vtlengine.DataTypes.Number'>, role=<Role.MEASURE: 'Measure'>, nullable=True)}, data=None)}
137
+ ```
138
+
139
+ #### Example 2: Incorrect VTL
140
+
141
+ Note that, as compared to Example 1, the only change is that Me_1 is of the String data type,
142
+ instead of Number.
143
+
144
+ ```python
145
+ from vtlengine import semantic_analysis
146
+
147
+ script = """
148
+ DS_A := DS_1 * 10;
149
+ """
150
+
151
+ data_structures = {
152
+ 'datasets': [
153
+ {'name': 'DS_1',
154
+ 'DataStructure': [
155
+ {'name': 'Id_1',
156
+ 'type':
157
+ 'Integer',
158
+ 'role': 'Identifier',
159
+ 'nullable': False},
160
+ {'name': 'Me_1',
161
+ 'type': 'String',
162
+ 'role': 'Measure',
163
+ 'nullable': True}
164
+ ]
165
+ }
166
+ ]
167
+ }
168
+
169
+ sa_result = semantic_analysis(script=script, data_structures=data_structures)
170
+
171
+ print(sa_result)
172
+
173
+ ```
174
+
175
+ Will raise the following Error:
176
+
177
+ ``` python
178
+ raise SemanticError(code="1-1-1-2",
179
+ vtlengine.Exceptions.SemanticError: ('Invalid implicit cast from String and Integer to Number.', '1-1-1-2')
180
+ ```
181
+
182
+ ### Run VTL Scripts
183
+
184
+ The `run` method serves to execute a VTL script with input datapoints.
185
+
186
+ Returns a dictionary with all the generated Datasets.
187
+ When the output parameter is set, the engine will write the result of the computation to the output
188
+ folder, else it will include the data in the dictionary of the computed datasets.
189
+
190
+ Two validations are performed before running, which can raise errors:
191
+
192
+ * Semantic analysis: Equivalent to running the `semantic_analysis` method
193
+ * Data load analysis: Basic check of the data structure (names and types)
194
+
195
+ #### Example 3: Simple run
196
+
197
+ ```python
198
+ from vtlengine import run
199
+ import pandas as pd
200
+
201
+ script = """
202
+ DS_A := DS_1 * 10;
203
+ """
204
+
205
+ data_structures = {
206
+ 'datasets': [
207
+ {'name': 'DS_1',
208
+ 'DataStructure': [
209
+ {'name': 'Id_1',
210
+ 'type':
211
+ 'Integer',
212
+ 'role': 'Identifier',
213
+ 'nullable': False},
214
+ {'name': 'Me_1',
215
+ 'type': 'Number',
216
+ 'role': 'Measure',
217
+ 'nullable': True}
218
+ ]
219
+ }
220
+ ]
221
+ }
222
+
223
+ data_df = pd.DataFrame(
224
+ {"Id_1": [1, 2, 3],
225
+ "Me_1": [10, 20, 30]})
226
+
227
+ datapoints = {"DS_1": data_df}
228
+
229
+ run_result = run(script=script, data_structures=data_structures,
230
+ datapoints=datapoints)
231
+
232
+ print(run_result)
233
+ ```
234
+
235
+ returns:
236
+
237
+ ``` python
238
+ {'DS_A': Dataset(name='DS_A', components={'Id_1': Component(name='Id_1', data_type=<class 'vtlengine.DataTypes.Integer'>, role=<Role.IDENTIFIER: 'Identifier'>, nullable=False), 'Me_1': Component(name='Me_1', data_type=<class 'vtlengine.DataTypes.Number'>, role=<Role.MEASURE: 'Measure'>, nullable=True)}, data= Id_1 Me_1
239
+ 0 1 100.0
240
+ 1 2 200.0
241
+ 2 3 300.0)}
242
+ ```
243
+
244
+ For more information on usage, please refer to
245
+ the [API documentation](https://docs.vtlengine.meaningfuldata.eu/api.html).
@@ -0,0 +1,213 @@
1
+ # VTL Engine
2
+
3
+ | | |
4
+ |---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
5
+ | Testing | [![Testing](https://github.com/Meaningful-Data/vtlengine/actions/workflows/testing.yml/badge.svg)](https://github.com/Meaningful-Data/vtlengine/actions/workflows/testing.yml) |
6
+ | Package | [![PyPI Latest Release](https://img.shields.io/pypi/v/vtlengine.svg)](https://pypi.org/project/vtlengine/) |
7
+ | License | [![License - AGPL 3.0](https://img.shields.io/pypi/l/vtlengine.svg)](https://github.com/Meaningful-Data/vtlengine/blob/main/LICENSE.md) |
8
+
9
+ ## Introduction
10
+
11
+ The VTL Engine is a Python library for validating and running VTL scripts.
12
+
13
+ It is a Python-based library around the [VTL Language](http://sdmx.org/?page_id=5096).
14
+
15
+ ## Installation
16
+
17
+ ### Requirements
18
+
19
+ The VTL Engine requires Python 3.10 or higher.
20
+
21
+ ### Install with pip
22
+
23
+ To install the VTL Engine on any Operating System, you can use pip:
24
+
25
+ ```bash
26
+
27
+ pip install vtlengine
28
+
29
+ ```
30
+
31
+ *Note: it is recommended to install the VTL Engine in a virtual environment.*
32
+
33
+ ## Usage
34
+
35
+ The VTL Engine API implements two basic methods:
36
+
37
+ * **Semantic Analysis**: aimed at validating the correctness of a script and computing the data
38
+ structures of the data sets created in the script.
39
+ * **Run**: aimed at executing the provided input on the provided input datasets.
40
+
41
+ Any action with VTL requires the following elements as input:
42
+
43
+ * **VTL Script**: Is the VTL to be executed, which includes the transformation scheme, as well as de
44
+ User Defined Operators, Hierarchical Rulesets and Datapoint Rulesets. It is provided as a string
45
+ or as a Path object to a vtl file.
46
+ * **Data structures** : Provides the structure of the input artifacts of the VTL script, according
47
+ to
48
+ the VTL Information model. Given that the current version doesn't prescribe a standard format for
49
+ providing the information, the VTL Engine is implementing a JSON format that can be found here.
50
+ Data Structures can be provided as Dictionaries or as Paths to JSON files. It is possible to have
51
+ * **External routines**: The VTL Engine allows using SQL (SQLite) with the eval operator. Can be
52
+ provided as a string with the SQL or as a path object to an SQL file. Its default value is `None`,
53
+ which shall be used if external routines are not applicable to the VTL script.
54
+ * **Value domains**: Provides the value domains that are used in the VTL script, normally with an in
55
+ operator. Can be provided as a dictionary or as a path to a JSON file. Its default value
56
+ is `None`, which shall be used if value domains are not applicable to the VTL script.
57
+
58
+ ### Semantic Analysis
59
+
60
+ The `semantic_analysis` method serves to validate the correctness of a VTL script, as well as to
61
+ calculate the data structures of the datasets generated by the VTL script itself (that calculation
62
+ is a pre-requisite for the semantic analysis).
63
+
64
+ * If the VTL script is correct, the method returns a dictionary with the data structures of all the
65
+ datasets generated by the script.
66
+ * If the VTL script is incorrect, raises a VTL Engine custom error Explaining the error.
67
+
68
+ #### Example 1: Correct VTL
69
+
70
+ ```python
71
+ from vtlengine import semantic_analysis
72
+
73
+ script = """
74
+ DS_A := DS_1 * 10;
75
+ """
76
+
77
+ data_structures = {
78
+ 'datasets': [
79
+ {'name': 'DS_1',
80
+ 'DataStructure': [
81
+ {'name': 'Id_1',
82
+ 'type':
83
+ 'Integer',
84
+ 'role': 'Identifier',
85
+ 'nullable': False},
86
+ {'name': 'Me_1',
87
+ 'type': 'Number',
88
+ 'role': 'Measure',
89
+ 'nullable': True}
90
+ ]
91
+ }
92
+ ]
93
+ }
94
+
95
+ sa_result = semantic_analysis(script=script, data_structures=data_structures)
96
+
97
+ print(sa_result)
98
+
99
+ ```
100
+
101
+ Returns:
102
+
103
+ ```
104
+ {'DS_A': Dataset(name='DS_A', components={'Id_1': Component(name='Id_1', data_type=<class 'vtlengine.DataTypes.Integer'>, role=<Role.IDENTIFIER: 'Identifier'>, nullable=False), 'Me_1': Component(name='Me_1', data_type=<class 'vtlengine.DataTypes.Number'>, role=<Role.MEASURE: 'Measure'>, nullable=True)}, data=None)}
105
+ ```
106
+
107
+ #### Example 2: Incorrect VTL
108
+
109
+ Note that, as compared to Example 1, the only change is that Me_1 is of the String data type,
110
+ instead of Number.
111
+
112
+ ```python
113
+ from vtlengine import semantic_analysis
114
+
115
+ script = """
116
+ DS_A := DS_1 * 10;
117
+ """
118
+
119
+ data_structures = {
120
+ 'datasets': [
121
+ {'name': 'DS_1',
122
+ 'DataStructure': [
123
+ {'name': 'Id_1',
124
+ 'type':
125
+ 'Integer',
126
+ 'role': 'Identifier',
127
+ 'nullable': False},
128
+ {'name': 'Me_1',
129
+ 'type': 'String',
130
+ 'role': 'Measure',
131
+ 'nullable': True}
132
+ ]
133
+ }
134
+ ]
135
+ }
136
+
137
+ sa_result = semantic_analysis(script=script, data_structures=data_structures)
138
+
139
+ print(sa_result)
140
+
141
+ ```
142
+
143
+ Will raise the following Error:
144
+
145
+ ``` python
146
+ raise SemanticError(code="1-1-1-2",
147
+ vtlengine.Exceptions.SemanticError: ('Invalid implicit cast from String and Integer to Number.', '1-1-1-2')
148
+ ```
149
+
150
+ ### Run VTL Scripts
151
+
152
+ The `run` method serves to execute a VTL script with input datapoints.
153
+
154
+ Returns a dictionary with all the generated Datasets.
155
+ When the output parameter is set, the engine will write the result of the computation to the output
156
+ folder, else it will include the data in the dictionary of the computed datasets.
157
+
158
+ Two validations are performed before running, which can raise errors:
159
+
160
+ * Semantic analysis: Equivalent to running the `semantic_analysis` method
161
+ * Data load analysis: Basic check of the data structure (names and types)
162
+
163
+ #### Example 3: Simple run
164
+
165
+ ```python
166
+ from vtlengine import run
167
+ import pandas as pd
168
+
169
+ script = """
170
+ DS_A := DS_1 * 10;
171
+ """
172
+
173
+ data_structures = {
174
+ 'datasets': [
175
+ {'name': 'DS_1',
176
+ 'DataStructure': [
177
+ {'name': 'Id_1',
178
+ 'type':
179
+ 'Integer',
180
+ 'role': 'Identifier',
181
+ 'nullable': False},
182
+ {'name': 'Me_1',
183
+ 'type': 'Number',
184
+ 'role': 'Measure',
185
+ 'nullable': True}
186
+ ]
187
+ }
188
+ ]
189
+ }
190
+
191
+ data_df = pd.DataFrame(
192
+ {"Id_1": [1, 2, 3],
193
+ "Me_1": [10, 20, 30]})
194
+
195
+ datapoints = {"DS_1": data_df}
196
+
197
+ run_result = run(script=script, data_structures=data_structures,
198
+ datapoints=datapoints)
199
+
200
+ print(run_result)
201
+ ```
202
+
203
+ returns:
204
+
205
+ ``` python
206
+ {'DS_A': Dataset(name='DS_A', components={'Id_1': Component(name='Id_1', data_type=<class 'vtlengine.DataTypes.Integer'>, role=<Role.IDENTIFIER: 'Identifier'>, nullable=False), 'Me_1': Component(name='Me_1', data_type=<class 'vtlengine.DataTypes.Number'>, role=<Role.MEASURE: 'Measure'>, nullable=True)}, data= Id_1 Me_1
207
+ 0 1 100.0
208
+ 1 2 200.0
209
+ 2 3 300.0)}
210
+ ```
211
+
212
+ For more information on usage, please refer to
213
+ the [API documentation](https://docs.vtlengine.meaningfuldata.eu/api.html).
@@ -0,0 +1,76 @@
1
+ [tool.poetry]
2
+ name = "vtlengine"
3
+ version = "1.0.2"
4
+ description = "Run and Validate VTL Scripts"
5
+ authors = ["MeaningfulData <info@meaningfuldata.eu>"]
6
+ license = "AGPL-3.0"
7
+ readme = "README.md"
8
+
9
+ classifiers = [
10
+ "Development Status :: 5 - Production/Stable",
11
+ "Intended Audience :: Developers",
12
+ "Intended Audience :: Information Technology",
13
+ "Intended Audience :: Science/Research",
14
+ "Typing :: Typed"
15
+ ]
16
+
17
+ keywords = ['vtl', 'sdmx', 'vtlengine', 'Validation and Transformation Language']
18
+ repository = 'https://github.com/Meaningful-Data/vtlengine'
19
+
20
+ [project.urls]
21
+ BugTracker = 'https://github.com/Meaningful-Data/vtlengine/issues'
22
+ Documentation = 'https://docs.vtlengine.meaningfuldata.eu'
23
+ SourceCode = 'https://github.com/Meaningful-Data/vtlengine'
24
+
25
+ [tool.poetry.dependencies]
26
+ python = "^3.10"
27
+ # PyPi dependencies
28
+ duckdb = "^1.1.1"
29
+ #numba = "^0.60.0"
30
+ s3fs = "^2024.9.0"
31
+
32
+ # APT dependencies
33
+ antlr4-python3-runtime = "4.9.2"
34
+ networkx = "^2.8.8"
35
+ numexpr = "^2.9.0"
36
+ pandas = "^2.1.4"
37
+ bottleneck = "^1.3.4"
38
+ sqlglot = "^22.2.0"
39
+
40
+ [tool.poetry.dev-dependencies]
41
+ pytest = "^7.3"
42
+ pytest-cov = "^5.0.0"
43
+ line-profiler-pycharm = "^1.2.0"
44
+ sphinx = "^7.4"
45
+ sphinx-rtd-theme = "^2.0.0"
46
+ flake8 = "^7.1.1"
47
+ black = "^24.8.0"
48
+ mypy = "^1.11.2"
49
+ pandas-stubs = "^2.2.3.241009"
50
+ stubs = "^1.0.0"
51
+ toml = "^0.10.2"
52
+
53
+ [tool.black]
54
+ line_length = 100
55
+
56
+ [tool.mypy]
57
+ files = "src"
58
+ exclude = "src/vtlengine/AST/.*"
59
+ disallow_untyped_defs = true
60
+ disallow_untyped_calls = true
61
+ ignore_errors = false
62
+ no_implicit_optional = true
63
+ show_column_numbers = true
64
+ strict_equality = true
65
+ strict_optional = true
66
+ strict = true
67
+ enable_error_code = [
68
+ "ignore-without-code",
69
+ "redundant-expr",
70
+ "truthy-bool",
71
+ ]
72
+ warn_return_any = false
73
+
74
+ [build-system]
75
+ requires = ["poetry-core"]
76
+ build-backend = "poetry.core.masonry.api"