flowquery 1.0.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.
Files changed (126) hide show
  1. flowquery-1.0.0/PKG-INFO +194 -0
  2. flowquery-1.0.0/README.md +166 -0
  3. flowquery-1.0.0/flowquery.egg-info/PKG-INFO +194 -0
  4. flowquery-1.0.0/flowquery.egg-info/SOURCES.txt +124 -0
  5. flowquery-1.0.0/flowquery.egg-info/dependency_links.txt +1 -0
  6. flowquery-1.0.0/flowquery.egg-info/entry_points.txt +2 -0
  7. flowquery-1.0.0/flowquery.egg-info/requires.txt +5 -0
  8. flowquery-1.0.0/flowquery.egg-info/top_level.txt +1 -0
  9. flowquery-1.0.0/pyproject.toml +75 -0
  10. flowquery-1.0.0/setup.cfg +4 -0
  11. flowquery-1.0.0/src/__init__.py +34 -0
  12. flowquery-1.0.0/src/__main__.py +10 -0
  13. flowquery-1.0.0/src/compute/__init__.py +5 -0
  14. flowquery-1.0.0/src/compute/runner.py +60 -0
  15. flowquery-1.0.0/src/extensibility.py +52 -0
  16. flowquery-1.0.0/src/graph/__init__.py +31 -0
  17. flowquery-1.0.0/src/graph/data.py +118 -0
  18. flowquery-1.0.0/src/graph/database.py +82 -0
  19. flowquery-1.0.0/src/graph/hops.py +43 -0
  20. flowquery-1.0.0/src/graph/node.py +112 -0
  21. flowquery-1.0.0/src/graph/node_data.py +26 -0
  22. flowquery-1.0.0/src/graph/node_reference.py +49 -0
  23. flowquery-1.0.0/src/graph/pattern.py +125 -0
  24. flowquery-1.0.0/src/graph/pattern_expression.py +62 -0
  25. flowquery-1.0.0/src/graph/patterns.py +42 -0
  26. flowquery-1.0.0/src/graph/physical_node.py +40 -0
  27. flowquery-1.0.0/src/graph/physical_relationship.py +36 -0
  28. flowquery-1.0.0/src/graph/relationship.py +135 -0
  29. flowquery-1.0.0/src/graph/relationship_data.py +33 -0
  30. flowquery-1.0.0/src/graph/relationship_match_collector.py +77 -0
  31. flowquery-1.0.0/src/graph/relationship_reference.py +21 -0
  32. flowquery-1.0.0/src/io/__init__.py +5 -0
  33. flowquery-1.0.0/src/io/command_line.py +67 -0
  34. flowquery-1.0.0/src/parsing/__init__.py +17 -0
  35. flowquery-1.0.0/src/parsing/alias.py +20 -0
  36. flowquery-1.0.0/src/parsing/alias_option.py +11 -0
  37. flowquery-1.0.0/src/parsing/ast_node.py +146 -0
  38. flowquery-1.0.0/src/parsing/base_parser.py +84 -0
  39. flowquery-1.0.0/src/parsing/components/__init__.py +19 -0
  40. flowquery-1.0.0/src/parsing/components/csv.py +8 -0
  41. flowquery-1.0.0/src/parsing/components/from_.py +10 -0
  42. flowquery-1.0.0/src/parsing/components/headers.py +12 -0
  43. flowquery-1.0.0/src/parsing/components/json.py +8 -0
  44. flowquery-1.0.0/src/parsing/components/null.py +10 -0
  45. flowquery-1.0.0/src/parsing/components/post.py +8 -0
  46. flowquery-1.0.0/src/parsing/components/text.py +8 -0
  47. flowquery-1.0.0/src/parsing/context.py +50 -0
  48. flowquery-1.0.0/src/parsing/data_structures/__init__.py +15 -0
  49. flowquery-1.0.0/src/parsing/data_structures/associative_array.py +41 -0
  50. flowquery-1.0.0/src/parsing/data_structures/json_array.py +30 -0
  51. flowquery-1.0.0/src/parsing/data_structures/key_value_pair.py +38 -0
  52. flowquery-1.0.0/src/parsing/data_structures/lookup.py +49 -0
  53. flowquery-1.0.0/src/parsing/data_structures/range_lookup.py +42 -0
  54. flowquery-1.0.0/src/parsing/expressions/__init__.py +57 -0
  55. flowquery-1.0.0/src/parsing/expressions/boolean.py +20 -0
  56. flowquery-1.0.0/src/parsing/expressions/expression.py +138 -0
  57. flowquery-1.0.0/src/parsing/expressions/expression_map.py +26 -0
  58. flowquery-1.0.0/src/parsing/expressions/f_string.py +27 -0
  59. flowquery-1.0.0/src/parsing/expressions/identifier.py +20 -0
  60. flowquery-1.0.0/src/parsing/expressions/number.py +32 -0
  61. flowquery-1.0.0/src/parsing/expressions/operator.py +169 -0
  62. flowquery-1.0.0/src/parsing/expressions/reference.py +47 -0
  63. flowquery-1.0.0/src/parsing/expressions/string.py +27 -0
  64. flowquery-1.0.0/src/parsing/functions/__init__.py +75 -0
  65. flowquery-1.0.0/src/parsing/functions/aggregate_function.py +60 -0
  66. flowquery-1.0.0/src/parsing/functions/async_function.py +62 -0
  67. flowquery-1.0.0/src/parsing/functions/avg.py +55 -0
  68. flowquery-1.0.0/src/parsing/functions/collect.py +75 -0
  69. flowquery-1.0.0/src/parsing/functions/function.py +68 -0
  70. flowquery-1.0.0/src/parsing/functions/function_factory.py +173 -0
  71. flowquery-1.0.0/src/parsing/functions/function_metadata.py +149 -0
  72. flowquery-1.0.0/src/parsing/functions/functions.py +59 -0
  73. flowquery-1.0.0/src/parsing/functions/join.py +47 -0
  74. flowquery-1.0.0/src/parsing/functions/keys.py +34 -0
  75. flowquery-1.0.0/src/parsing/functions/predicate_function.py +46 -0
  76. flowquery-1.0.0/src/parsing/functions/predicate_sum.py +47 -0
  77. flowquery-1.0.0/src/parsing/functions/rand.py +28 -0
  78. flowquery-1.0.0/src/parsing/functions/range_.py +34 -0
  79. flowquery-1.0.0/src/parsing/functions/reducer_element.py +15 -0
  80. flowquery-1.0.0/src/parsing/functions/replace.py +37 -0
  81. flowquery-1.0.0/src/parsing/functions/round_.py +32 -0
  82. flowquery-1.0.0/src/parsing/functions/size.py +32 -0
  83. flowquery-1.0.0/src/parsing/functions/split.py +47 -0
  84. flowquery-1.0.0/src/parsing/functions/stringify.py +47 -0
  85. flowquery-1.0.0/src/parsing/functions/sum.py +51 -0
  86. flowquery-1.0.0/src/parsing/functions/to_json.py +33 -0
  87. flowquery-1.0.0/src/parsing/functions/type_.py +47 -0
  88. flowquery-1.0.0/src/parsing/functions/value_holder.py +24 -0
  89. flowquery-1.0.0/src/parsing/logic/__init__.py +15 -0
  90. flowquery-1.0.0/src/parsing/logic/case.py +29 -0
  91. flowquery-1.0.0/src/parsing/logic/else_.py +12 -0
  92. flowquery-1.0.0/src/parsing/logic/end.py +8 -0
  93. flowquery-1.0.0/src/parsing/logic/then.py +12 -0
  94. flowquery-1.0.0/src/parsing/logic/when.py +10 -0
  95. flowquery-1.0.0/src/parsing/operations/__init__.py +35 -0
  96. flowquery-1.0.0/src/parsing/operations/aggregated_return.py +24 -0
  97. flowquery-1.0.0/src/parsing/operations/aggregated_with.py +22 -0
  98. flowquery-1.0.0/src/parsing/operations/call.py +74 -0
  99. flowquery-1.0.0/src/parsing/operations/create_node.py +34 -0
  100. flowquery-1.0.0/src/parsing/operations/create_relationship.py +34 -0
  101. flowquery-1.0.0/src/parsing/operations/group_by.py +130 -0
  102. flowquery-1.0.0/src/parsing/operations/limit.py +22 -0
  103. flowquery-1.0.0/src/parsing/operations/load.py +140 -0
  104. flowquery-1.0.0/src/parsing/operations/match.py +29 -0
  105. flowquery-1.0.0/src/parsing/operations/operation.py +69 -0
  106. flowquery-1.0.0/src/parsing/operations/projection.py +21 -0
  107. flowquery-1.0.0/src/parsing/operations/return_op.py +50 -0
  108. flowquery-1.0.0/src/parsing/operations/unwind.py +37 -0
  109. flowquery-1.0.0/src/parsing/operations/where.py +41 -0
  110. flowquery-1.0.0/src/parsing/operations/with_op.py +18 -0
  111. flowquery-1.0.0/src/parsing/parser.py +1011 -0
  112. flowquery-1.0.0/src/parsing/token_to_node.py +109 -0
  113. flowquery-1.0.0/src/tokenization/__init__.py +23 -0
  114. flowquery-1.0.0/src/tokenization/keyword.py +48 -0
  115. flowquery-1.0.0/src/tokenization/operator.py +29 -0
  116. flowquery-1.0.0/src/tokenization/string_walker.py +158 -0
  117. flowquery-1.0.0/src/tokenization/symbol.py +19 -0
  118. flowquery-1.0.0/src/tokenization/token.py +659 -0
  119. flowquery-1.0.0/src/tokenization/token_mapper.py +52 -0
  120. flowquery-1.0.0/src/tokenization/token_type.py +21 -0
  121. flowquery-1.0.0/src/tokenization/tokenizer.py +214 -0
  122. flowquery-1.0.0/src/tokenization/trie.py +124 -0
  123. flowquery-1.0.0/src/utils/__init__.py +6 -0
  124. flowquery-1.0.0/src/utils/object_utils.py +20 -0
  125. flowquery-1.0.0/src/utils/string_utils.py +113 -0
  126. flowquery-1.0.0/tests/test_extensibility.py +611 -0
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: flowquery
3
+ Version: 1.0.0
4
+ Summary: A declarative query language for data processing pipelines
5
+ Author: FlowQuery Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/microsoft/FlowQuery/flowquery-py
8
+ Project-URL: Repository, https://github.com/microsoft/FlowQuery/flowquery-py
9
+ Project-URL: Documentation, https://github.com/microsoft/FlowQuery/flowquery-py#readme
10
+ Project-URL: Issues, https://github.com/microsoft/FlowQuery/issues
11
+ Keywords: query,data-processing,pipeline,declarative
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
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: Topic :: Database :: Front-Ends
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: aiohttp>=3.8.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
27
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
28
+
29
+ # FlowQuery Python Implementation
30
+
31
+ This is the Python implementation of FlowQuery, a declarative query language for data processing pipelines.
32
+
33
+ ## Installation
34
+
35
+ ### From Source
36
+
37
+ ```bash
38
+ git clone https://github.com/microsoft/FlowQuery.git
39
+ cd FlowQuery/flowquery-py
40
+ pip install -e .
41
+ ```
42
+
43
+ ### With Development Dependencies
44
+
45
+ ```bash
46
+ pip install -e ".[dev]"
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ### Command Line Interface
52
+
53
+ After installation, you can start the interactive REPL:
54
+
55
+ ```bash
56
+ flowquery
57
+ ```
58
+
59
+ ### Using Conda (Alternative)
60
+
61
+ **Windows (PowerShell):**
62
+
63
+ ```powershell
64
+ cd flowquery-py
65
+ .\setup_env.ps1
66
+ conda activate flowquery
67
+ ```
68
+
69
+ **Linux/macOS:**
70
+
71
+ ```bash
72
+ cd flowquery-py
73
+ chmod +x setup_env.sh
74
+ ./setup_env.sh
75
+ conda activate flowquery
76
+ ```
77
+
78
+ The setup scripts automatically:
79
+
80
+ 1. Read the Python version from `pyproject.toml`
81
+ 2. Create a conda environment named `flowquery`
82
+ 3. Install the package with all dev dependencies
83
+
84
+ ## Requirements
85
+
86
+ - Python 3.10+ (defined in `pyproject.toml`)
87
+ - pytest (for running tests)
88
+ - pytest-asyncio (for async test support)
89
+ - aiohttp (for HTTP requests)
90
+
91
+ All dependencies are managed in `pyproject.toml`.
92
+
93
+ ## Programmatic Usage
94
+
95
+ ```python
96
+ import asyncio
97
+ from flowquery import Runner
98
+
99
+ runner = Runner("WITH 1 as x RETURN x + 1 as result")
100
+ asyncio.run(runner.run())
101
+ print(runner.results) # [{'result': 2}]
102
+ ```
103
+
104
+ ## Running Tests
105
+
106
+ ```bash
107
+ pytest tests/
108
+ ```
109
+
110
+ ## Project Structure
111
+
112
+ ```
113
+ flowquery-py/
114
+ ├── pyproject.toml # Dependencies & project config (single source of truth)
115
+ ├── setup_env.ps1 # Windows conda setup script
116
+ ├── setup_env.sh # Linux/macOS conda setup script
117
+ ├── README.md
118
+ ├── src/
119
+ │ ├── __init__.py # Main package entry point
120
+ │ ├── extensibility.py # Public API for custom functions
121
+ │ ├── compute/
122
+ │ │ └── runner.py # Query execution engine
123
+ │ ├── graph/
124
+ │ │ ├── node.py # Graph node representation
125
+ │ │ ├── relationship.py # Graph relationship representation
126
+ │ │ ├── pattern.py # Pattern matching
127
+ │ │ └── database.py # In-memory graph database
128
+ │ ├── io/
129
+ │ │ └── command_line.py # Interactive REPL
130
+ │ ├── parsing/
131
+ │ │ ├── parser.py # Main parser
132
+ │ │ ├── ast_node.py # AST node base class
133
+ │ │ ├── expressions/ # Expression types (numbers, strings, operators)
134
+ │ │ ├── functions/ # Built-in and custom functions
135
+ │ │ ├── operations/ # Query operations (WITH, RETURN, UNWIND, etc.)
136
+ │ │ ├── components/ # LOAD clause components
137
+ │ │ ├── data_structures/ # Arrays, objects, lookups
138
+ │ │ └── logic/ # CASE/WHEN/THEN/ELSE
139
+ │ ├── tokenization/
140
+ │ │ ├── tokenizer.py # Lexer
141
+ │ │ ├── token.py # Token class
142
+ │ │ └── ... # Token types and mappers
143
+ │ └── utils/
144
+ │ ├── string_utils.py # String manipulation utilities
145
+ │ └── object_utils.py # Object utilities
146
+ └── tests/
147
+ ├── test_extensibility.py
148
+ ├── compute/
149
+ │ └── test_runner.py
150
+ ├── graph/
151
+ │ ├── test_create.py
152
+ │ ├── test_data.py
153
+ │ └── test_match.py
154
+ ├── parsing/
155
+ │ ├── test_parser.py
156
+ │ ├── test_context.py
157
+ │ └── test_expression.py
158
+ └── tokenization/
159
+ ├── test_tokenizer.py
160
+ ├── test_token_mapper.py
161
+ └── test_trie.py
162
+ ```
163
+
164
+ ## Creating Custom Functions
165
+
166
+ ```python
167
+ from flowquery.extensibility import Function, FunctionDef
168
+
169
+ @FunctionDef({
170
+ "description": "Converts a string to uppercase",
171
+ "category": "string",
172
+ "parameters": [
173
+ {"name": "text", "description": "String to convert", "type": "string"}
174
+ ],
175
+ "output": {"description": "Uppercase string", "type": "string"}
176
+ })
177
+ class UpperCase(Function):
178
+ def __init__(self):
179
+ super().__init__("uppercase")
180
+ self._expected_parameter_count = 1
181
+
182
+ def value(self) -> str:
183
+ return str(self.get_children()[0].value()).upper()
184
+ ```
185
+
186
+ ## License
187
+
188
+ MIT License - see [LICENSE](LICENSE) for details.
189
+
190
+ ## Links
191
+
192
+ - [Homepage](https://github.com/microsoft/FlowQuery/flowquery-py)
193
+ - [Repository](https://github.com/microsoft/FlowQuery/flowquery-py)
194
+ - [Issues](https://github.com/microsoft/FlowQuery/issues)
@@ -0,0 +1,166 @@
1
+ # FlowQuery Python Implementation
2
+
3
+ This is the Python implementation of FlowQuery, a declarative query language for data processing pipelines.
4
+
5
+ ## Installation
6
+
7
+ ### From Source
8
+
9
+ ```bash
10
+ git clone https://github.com/microsoft/FlowQuery.git
11
+ cd FlowQuery/flowquery-py
12
+ pip install -e .
13
+ ```
14
+
15
+ ### With Development Dependencies
16
+
17
+ ```bash
18
+ pip install -e ".[dev]"
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ### Command Line Interface
24
+
25
+ After installation, you can start the interactive REPL:
26
+
27
+ ```bash
28
+ flowquery
29
+ ```
30
+
31
+ ### Using Conda (Alternative)
32
+
33
+ **Windows (PowerShell):**
34
+
35
+ ```powershell
36
+ cd flowquery-py
37
+ .\setup_env.ps1
38
+ conda activate flowquery
39
+ ```
40
+
41
+ **Linux/macOS:**
42
+
43
+ ```bash
44
+ cd flowquery-py
45
+ chmod +x setup_env.sh
46
+ ./setup_env.sh
47
+ conda activate flowquery
48
+ ```
49
+
50
+ The setup scripts automatically:
51
+
52
+ 1. Read the Python version from `pyproject.toml`
53
+ 2. Create a conda environment named `flowquery`
54
+ 3. Install the package with all dev dependencies
55
+
56
+ ## Requirements
57
+
58
+ - Python 3.10+ (defined in `pyproject.toml`)
59
+ - pytest (for running tests)
60
+ - pytest-asyncio (for async test support)
61
+ - aiohttp (for HTTP requests)
62
+
63
+ All dependencies are managed in `pyproject.toml`.
64
+
65
+ ## Programmatic Usage
66
+
67
+ ```python
68
+ import asyncio
69
+ from flowquery import Runner
70
+
71
+ runner = Runner("WITH 1 as x RETURN x + 1 as result")
72
+ asyncio.run(runner.run())
73
+ print(runner.results) # [{'result': 2}]
74
+ ```
75
+
76
+ ## Running Tests
77
+
78
+ ```bash
79
+ pytest tests/
80
+ ```
81
+
82
+ ## Project Structure
83
+
84
+ ```
85
+ flowquery-py/
86
+ ├── pyproject.toml # Dependencies & project config (single source of truth)
87
+ ├── setup_env.ps1 # Windows conda setup script
88
+ ├── setup_env.sh # Linux/macOS conda setup script
89
+ ├── README.md
90
+ ├── src/
91
+ │ ├── __init__.py # Main package entry point
92
+ │ ├── extensibility.py # Public API for custom functions
93
+ │ ├── compute/
94
+ │ │ └── runner.py # Query execution engine
95
+ │ ├── graph/
96
+ │ │ ├── node.py # Graph node representation
97
+ │ │ ├── relationship.py # Graph relationship representation
98
+ │ │ ├── pattern.py # Pattern matching
99
+ │ │ └── database.py # In-memory graph database
100
+ │ ├── io/
101
+ │ │ └── command_line.py # Interactive REPL
102
+ │ ├── parsing/
103
+ │ │ ├── parser.py # Main parser
104
+ │ │ ├── ast_node.py # AST node base class
105
+ │ │ ├── expressions/ # Expression types (numbers, strings, operators)
106
+ │ │ ├── functions/ # Built-in and custom functions
107
+ │ │ ├── operations/ # Query operations (WITH, RETURN, UNWIND, etc.)
108
+ │ │ ├── components/ # LOAD clause components
109
+ │ │ ├── data_structures/ # Arrays, objects, lookups
110
+ │ │ └── logic/ # CASE/WHEN/THEN/ELSE
111
+ │ ├── tokenization/
112
+ │ │ ├── tokenizer.py # Lexer
113
+ │ │ ├── token.py # Token class
114
+ │ │ └── ... # Token types and mappers
115
+ │ └── utils/
116
+ │ ├── string_utils.py # String manipulation utilities
117
+ │ └── object_utils.py # Object utilities
118
+ └── tests/
119
+ ├── test_extensibility.py
120
+ ├── compute/
121
+ │ └── test_runner.py
122
+ ├── graph/
123
+ │ ├── test_create.py
124
+ │ ├── test_data.py
125
+ │ └── test_match.py
126
+ ├── parsing/
127
+ │ ├── test_parser.py
128
+ │ ├── test_context.py
129
+ │ └── test_expression.py
130
+ └── tokenization/
131
+ ├── test_tokenizer.py
132
+ ├── test_token_mapper.py
133
+ └── test_trie.py
134
+ ```
135
+
136
+ ## Creating Custom Functions
137
+
138
+ ```python
139
+ from flowquery.extensibility import Function, FunctionDef
140
+
141
+ @FunctionDef({
142
+ "description": "Converts a string to uppercase",
143
+ "category": "string",
144
+ "parameters": [
145
+ {"name": "text", "description": "String to convert", "type": "string"}
146
+ ],
147
+ "output": {"description": "Uppercase string", "type": "string"}
148
+ })
149
+ class UpperCase(Function):
150
+ def __init__(self):
151
+ super().__init__("uppercase")
152
+ self._expected_parameter_count = 1
153
+
154
+ def value(self) -> str:
155
+ return str(self.get_children()[0].value()).upper()
156
+ ```
157
+
158
+ ## License
159
+
160
+ MIT License - see [LICENSE](LICENSE) for details.
161
+
162
+ ## Links
163
+
164
+ - [Homepage](https://github.com/microsoft/FlowQuery/flowquery-py)
165
+ - [Repository](https://github.com/microsoft/FlowQuery/flowquery-py)
166
+ - [Issues](https://github.com/microsoft/FlowQuery/issues)
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.4
2
+ Name: flowquery
3
+ Version: 1.0.0
4
+ Summary: A declarative query language for data processing pipelines
5
+ Author: FlowQuery Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/microsoft/FlowQuery/flowquery-py
8
+ Project-URL: Repository, https://github.com/microsoft/FlowQuery/flowquery-py
9
+ Project-URL: Documentation, https://github.com/microsoft/FlowQuery/flowquery-py#readme
10
+ Project-URL: Issues, https://github.com/microsoft/FlowQuery/issues
11
+ Keywords: query,data-processing,pipeline,declarative
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
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: Topic :: Database :: Front-Ends
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: aiohttp>=3.8.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
27
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
28
+
29
+ # FlowQuery Python Implementation
30
+
31
+ This is the Python implementation of FlowQuery, a declarative query language for data processing pipelines.
32
+
33
+ ## Installation
34
+
35
+ ### From Source
36
+
37
+ ```bash
38
+ git clone https://github.com/microsoft/FlowQuery.git
39
+ cd FlowQuery/flowquery-py
40
+ pip install -e .
41
+ ```
42
+
43
+ ### With Development Dependencies
44
+
45
+ ```bash
46
+ pip install -e ".[dev]"
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ### Command Line Interface
52
+
53
+ After installation, you can start the interactive REPL:
54
+
55
+ ```bash
56
+ flowquery
57
+ ```
58
+
59
+ ### Using Conda (Alternative)
60
+
61
+ **Windows (PowerShell):**
62
+
63
+ ```powershell
64
+ cd flowquery-py
65
+ .\setup_env.ps1
66
+ conda activate flowquery
67
+ ```
68
+
69
+ **Linux/macOS:**
70
+
71
+ ```bash
72
+ cd flowquery-py
73
+ chmod +x setup_env.sh
74
+ ./setup_env.sh
75
+ conda activate flowquery
76
+ ```
77
+
78
+ The setup scripts automatically:
79
+
80
+ 1. Read the Python version from `pyproject.toml`
81
+ 2. Create a conda environment named `flowquery`
82
+ 3. Install the package with all dev dependencies
83
+
84
+ ## Requirements
85
+
86
+ - Python 3.10+ (defined in `pyproject.toml`)
87
+ - pytest (for running tests)
88
+ - pytest-asyncio (for async test support)
89
+ - aiohttp (for HTTP requests)
90
+
91
+ All dependencies are managed in `pyproject.toml`.
92
+
93
+ ## Programmatic Usage
94
+
95
+ ```python
96
+ import asyncio
97
+ from flowquery import Runner
98
+
99
+ runner = Runner("WITH 1 as x RETURN x + 1 as result")
100
+ asyncio.run(runner.run())
101
+ print(runner.results) # [{'result': 2}]
102
+ ```
103
+
104
+ ## Running Tests
105
+
106
+ ```bash
107
+ pytest tests/
108
+ ```
109
+
110
+ ## Project Structure
111
+
112
+ ```
113
+ flowquery-py/
114
+ ├── pyproject.toml # Dependencies & project config (single source of truth)
115
+ ├── setup_env.ps1 # Windows conda setup script
116
+ ├── setup_env.sh # Linux/macOS conda setup script
117
+ ├── README.md
118
+ ├── src/
119
+ │ ├── __init__.py # Main package entry point
120
+ │ ├── extensibility.py # Public API for custom functions
121
+ │ ├── compute/
122
+ │ │ └── runner.py # Query execution engine
123
+ │ ├── graph/
124
+ │ │ ├── node.py # Graph node representation
125
+ │ │ ├── relationship.py # Graph relationship representation
126
+ │ │ ├── pattern.py # Pattern matching
127
+ │ │ └── database.py # In-memory graph database
128
+ │ ├── io/
129
+ │ │ └── command_line.py # Interactive REPL
130
+ │ ├── parsing/
131
+ │ │ ├── parser.py # Main parser
132
+ │ │ ├── ast_node.py # AST node base class
133
+ │ │ ├── expressions/ # Expression types (numbers, strings, operators)
134
+ │ │ ├── functions/ # Built-in and custom functions
135
+ │ │ ├── operations/ # Query operations (WITH, RETURN, UNWIND, etc.)
136
+ │ │ ├── components/ # LOAD clause components
137
+ │ │ ├── data_structures/ # Arrays, objects, lookups
138
+ │ │ └── logic/ # CASE/WHEN/THEN/ELSE
139
+ │ ├── tokenization/
140
+ │ │ ├── tokenizer.py # Lexer
141
+ │ │ ├── token.py # Token class
142
+ │ │ └── ... # Token types and mappers
143
+ │ └── utils/
144
+ │ ├── string_utils.py # String manipulation utilities
145
+ │ └── object_utils.py # Object utilities
146
+ └── tests/
147
+ ├── test_extensibility.py
148
+ ├── compute/
149
+ │ └── test_runner.py
150
+ ├── graph/
151
+ │ ├── test_create.py
152
+ │ ├── test_data.py
153
+ │ └── test_match.py
154
+ ├── parsing/
155
+ │ ├── test_parser.py
156
+ │ ├── test_context.py
157
+ │ └── test_expression.py
158
+ └── tokenization/
159
+ ├── test_tokenizer.py
160
+ ├── test_token_mapper.py
161
+ └── test_trie.py
162
+ ```
163
+
164
+ ## Creating Custom Functions
165
+
166
+ ```python
167
+ from flowquery.extensibility import Function, FunctionDef
168
+
169
+ @FunctionDef({
170
+ "description": "Converts a string to uppercase",
171
+ "category": "string",
172
+ "parameters": [
173
+ {"name": "text", "description": "String to convert", "type": "string"}
174
+ ],
175
+ "output": {"description": "Uppercase string", "type": "string"}
176
+ })
177
+ class UpperCase(Function):
178
+ def __init__(self):
179
+ super().__init__("uppercase")
180
+ self._expected_parameter_count = 1
181
+
182
+ def value(self) -> str:
183
+ return str(self.get_children()[0].value()).upper()
184
+ ```
185
+
186
+ ## License
187
+
188
+ MIT License - see [LICENSE](LICENSE) for details.
189
+
190
+ ## Links
191
+
192
+ - [Homepage](https://github.com/microsoft/FlowQuery/flowquery-py)
193
+ - [Repository](https://github.com/microsoft/FlowQuery/flowquery-py)
194
+ - [Issues](https://github.com/microsoft/FlowQuery/issues)
@@ -0,0 +1,124 @@
1
+ README.md
2
+ pyproject.toml
3
+ flowquery.egg-info/PKG-INFO
4
+ flowquery.egg-info/SOURCES.txt
5
+ flowquery.egg-info/dependency_links.txt
6
+ flowquery.egg-info/entry_points.txt
7
+ flowquery.egg-info/requires.txt
8
+ flowquery.egg-info/top_level.txt
9
+ src/__init__.py
10
+ src/__main__.py
11
+ src/extensibility.py
12
+ src/compute/__init__.py
13
+ src/compute/runner.py
14
+ src/graph/__init__.py
15
+ src/graph/data.py
16
+ src/graph/database.py
17
+ src/graph/hops.py
18
+ src/graph/node.py
19
+ src/graph/node_data.py
20
+ src/graph/node_reference.py
21
+ src/graph/pattern.py
22
+ src/graph/pattern_expression.py
23
+ src/graph/patterns.py
24
+ src/graph/physical_node.py
25
+ src/graph/physical_relationship.py
26
+ src/graph/relationship.py
27
+ src/graph/relationship_data.py
28
+ src/graph/relationship_match_collector.py
29
+ src/graph/relationship_reference.py
30
+ src/io/__init__.py
31
+ src/io/command_line.py
32
+ src/parsing/__init__.py
33
+ src/parsing/alias.py
34
+ src/parsing/alias_option.py
35
+ src/parsing/ast_node.py
36
+ src/parsing/base_parser.py
37
+ src/parsing/context.py
38
+ src/parsing/parser.py
39
+ src/parsing/token_to_node.py
40
+ src/parsing/components/__init__.py
41
+ src/parsing/components/csv.py
42
+ src/parsing/components/from_.py
43
+ src/parsing/components/headers.py
44
+ src/parsing/components/json.py
45
+ src/parsing/components/null.py
46
+ src/parsing/components/post.py
47
+ src/parsing/components/text.py
48
+ src/parsing/data_structures/__init__.py
49
+ src/parsing/data_structures/associative_array.py
50
+ src/parsing/data_structures/json_array.py
51
+ src/parsing/data_structures/key_value_pair.py
52
+ src/parsing/data_structures/lookup.py
53
+ src/parsing/data_structures/range_lookup.py
54
+ src/parsing/expressions/__init__.py
55
+ src/parsing/expressions/boolean.py
56
+ src/parsing/expressions/expression.py
57
+ src/parsing/expressions/expression_map.py
58
+ src/parsing/expressions/f_string.py
59
+ src/parsing/expressions/identifier.py
60
+ src/parsing/expressions/number.py
61
+ src/parsing/expressions/operator.py
62
+ src/parsing/expressions/reference.py
63
+ src/parsing/expressions/string.py
64
+ src/parsing/functions/__init__.py
65
+ src/parsing/functions/aggregate_function.py
66
+ src/parsing/functions/async_function.py
67
+ src/parsing/functions/avg.py
68
+ src/parsing/functions/collect.py
69
+ src/parsing/functions/function.py
70
+ src/parsing/functions/function_factory.py
71
+ src/parsing/functions/function_metadata.py
72
+ src/parsing/functions/functions.py
73
+ src/parsing/functions/join.py
74
+ src/parsing/functions/keys.py
75
+ src/parsing/functions/predicate_function.py
76
+ src/parsing/functions/predicate_sum.py
77
+ src/parsing/functions/rand.py
78
+ src/parsing/functions/range_.py
79
+ src/parsing/functions/reducer_element.py
80
+ src/parsing/functions/replace.py
81
+ src/parsing/functions/round_.py
82
+ src/parsing/functions/size.py
83
+ src/parsing/functions/split.py
84
+ src/parsing/functions/stringify.py
85
+ src/parsing/functions/sum.py
86
+ src/parsing/functions/to_json.py
87
+ src/parsing/functions/type_.py
88
+ src/parsing/functions/value_holder.py
89
+ src/parsing/logic/__init__.py
90
+ src/parsing/logic/case.py
91
+ src/parsing/logic/else_.py
92
+ src/parsing/logic/end.py
93
+ src/parsing/logic/then.py
94
+ src/parsing/logic/when.py
95
+ src/parsing/operations/__init__.py
96
+ src/parsing/operations/aggregated_return.py
97
+ src/parsing/operations/aggregated_with.py
98
+ src/parsing/operations/call.py
99
+ src/parsing/operations/create_node.py
100
+ src/parsing/operations/create_relationship.py
101
+ src/parsing/operations/group_by.py
102
+ src/parsing/operations/limit.py
103
+ src/parsing/operations/load.py
104
+ src/parsing/operations/match.py
105
+ src/parsing/operations/operation.py
106
+ src/parsing/operations/projection.py
107
+ src/parsing/operations/return_op.py
108
+ src/parsing/operations/unwind.py
109
+ src/parsing/operations/where.py
110
+ src/parsing/operations/with_op.py
111
+ src/tokenization/__init__.py
112
+ src/tokenization/keyword.py
113
+ src/tokenization/operator.py
114
+ src/tokenization/string_walker.py
115
+ src/tokenization/symbol.py
116
+ src/tokenization/token.py
117
+ src/tokenization/token_mapper.py
118
+ src/tokenization/token_type.py
119
+ src/tokenization/tokenizer.py
120
+ src/tokenization/trie.py
121
+ src/utils/__init__.py
122
+ src/utils/object_utils.py
123
+ src/utils/string_utils.py
124
+ tests/test_extensibility.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ flowquery = flowquery.io.command_line:main
@@ -0,0 +1,5 @@
1
+ aiohttp>=3.8.0
2
+
3
+ [dev]
4
+ pytest>=7.0.0
5
+ pytest-asyncio>=0.21.0
@@ -0,0 +1 @@
1
+ flowquery