shareddata 4.10.3__tar.gz → 6.83.4__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 (125) hide show
  1. shareddata-6.83.4/MANIFEST.in +2 -0
  2. shareddata-6.83.4/PKG-INFO +195 -0
  3. shareddata-6.83.4/README.md +149 -0
  4. shareddata-6.83.4/pyproject.toml +22 -0
  5. shareddata-6.83.4/setup.cfg +4 -0
  6. shareddata-6.83.4/setup.py +51 -0
  7. shareddata-6.83.4/src/SharedData/API/ServerGunicorn.py +162 -0
  8. shareddata-6.83.4/src/SharedData/API/ServerWaitress.py +62 -0
  9. shareddata-6.83.4/src/SharedData/API/__init__.py +135 -0
  10. shareddata-6.83.4/src/SharedData/API/auth.py +211 -0
  11. shareddata-6.83.4/src/SharedData/API/constants.py +31 -0
  12. shareddata-6.83.4/src/SharedData/API/routes/__init__.py +41 -0
  13. shareddata-6.83.4/src/SharedData/API/routes/cache.py +263 -0
  14. shareddata-6.83.4/src/SharedData/API/routes/collections.py +377 -0
  15. shareddata-6.83.4/src/SharedData/API/routes/metadata.py +355 -0
  16. shareddata-6.83.4/src/SharedData/API/routes/system.py +278 -0
  17. shareddata-6.83.4/src/SharedData/API/routes/tables.py +426 -0
  18. shareddata-6.83.4/src/SharedData/API/routes/timeseries.py +511 -0
  19. shareddata-6.83.4/src/SharedData/API/routes/workers.py +202 -0
  20. shareddata-6.83.4/src/SharedData/API/utils.py +345 -0
  21. shareddata-6.83.4/src/SharedData/CacheRedis.py +715 -0
  22. shareddata-6.83.4/src/SharedData/CollectionMongoDB.py +682 -0
  23. shareddata-6.83.4/src/SharedData/Database.py +28 -0
  24. shareddata-6.83.4/src/SharedData/Defaults.py +102 -0
  25. shareddata-6.83.4/src/SharedData/IO/AWSEC2.py +598 -0
  26. shareddata-6.83.4/src/SharedData/IO/AWSS3.py +430 -0
  27. shareddata-6.83.4/src/SharedData/IO/AutoDocstrings.py +602 -0
  28. shareddata-6.83.4/src/SharedData/IO/ClientAPI.py +3056 -0
  29. shareddata-6.83.4/src/SharedData/IO/ClientSocket.py +191 -0
  30. shareddata-6.83.4/src/SharedData/IO/ClientWebSocket.py +422 -0
  31. shareddata-6.83.4/src/SharedData/IO/LogHandlerAPI.py +114 -0
  32. shareddata-6.83.4/src/SharedData/IO/MongoDBClient.py +263 -0
  33. shareddata-6.83.4/src/SharedData/IO/SaveTables.py +58 -0
  34. shareddata-6.83.4/src/SharedData/IO/ServerSocket.py +261 -0
  35. shareddata-6.83.4/src/SharedData/IO/ServerWebSocket.py +586 -0
  36. shareddata-6.83.4/src/SharedData/IO/StreamsCache.py +149 -0
  37. shareddata-6.83.4/src/SharedData/IO/StreamsPersist.py +141 -0
  38. shareddata-6.83.4/src/SharedData/IO/SyncTable.py +547 -0
  39. shareddata-6.83.4/src/SharedData/IO/TunnelWebSocket.py +110 -0
  40. shareddata-6.83.4/src/SharedData/Logger.py +719 -0
  41. shareddata-6.83.4/src/SharedData/Metadata.py +555 -0
  42. shareddata-6.83.4/src/SharedData/MultiProc.py +520 -0
  43. shareddata-6.83.4/src/SharedData/OpenFIGI.py +228 -0
  44. shareddata-6.83.4/src/SharedData/Routines/BatchJob.py +88 -0
  45. shareddata-6.83.4/src/SharedData/Routines/Schedule.py +562 -0
  46. shareddata-6.83.4/src/SharedData/Routines/ScheduleMonitor.py +60 -0
  47. shareddata-6.83.4/src/SharedData/Routines/Scheduler.py +60 -0
  48. shareddata-6.83.4/src/SharedData/Routines/Worker.py +320 -0
  49. shareddata-6.83.4/src/SharedData/Routines/WorkerLib.py +1902 -0
  50. shareddata-6.83.4/src/SharedData/Routines/WorkerPool.py +536 -0
  51. shareddata-6.83.4/src/SharedData/SharedData.py +1677 -0
  52. shareddata-6.83.4/src/SharedData/SharedNumpy.py +2118 -0
  53. shareddata-6.83.4/src/SharedData/StreamKafka.py +778 -0
  54. shareddata-6.83.4/src/SharedData/Symbol.py +91 -0
  55. shareddata-6.83.4/src/SharedData/Table.py +2532 -0
  56. shareddata-6.83.4/src/SharedData/TableDisk.py +354 -0
  57. shareddata-6.83.4/src/SharedData/TableIndex.py +785 -0
  58. shareddata-6.83.4/src/SharedData/TableIndexJitFunctions.py +3501 -0
  59. shareddata-6.83.4/src/SharedData/TableIndexJitFunctionsManual.py +1760 -0
  60. shareddata-6.83.4/src/SharedData/TableIndexJitGenerate.py +604 -0
  61. shareddata-6.83.4/src/SharedData/TableIndexJitHash.py +41 -0
  62. shareddata-6.83.4/src/SharedData/TableIndexJitLoc.py +300 -0
  63. shareddata-6.83.4/src/SharedData/TimeSeriesDisk.py +1156 -0
  64. shareddata-6.83.4/src/SharedData/TimeseriesContainer.py +1137 -0
  65. shareddata-6.83.4/src/SharedData/Users.py +32 -0
  66. shareddata-6.83.4/src/SharedData/Utils.py +233 -0
  67. shareddata-6.83.4/src/SharedData/__init__.py +0 -0
  68. shareddata-6.83.4/src/SharedData/sharedmutexwin.pyd +0 -0
  69. shareddata-6.83.4/src/shareddata.egg-info/PKG-INFO +195 -0
  70. shareddata-6.83.4/src/shareddata.egg-info/SOURCES.txt +92 -0
  71. shareddata-6.83.4/src/shareddata.egg-info/requires.txt +28 -0
  72. shareddata-6.83.4/tests/test_api_collection.py +119 -0
  73. shareddata-6.83.4/tests/test_api_collection_loopback.py +164 -0
  74. shareddata-6.83.4/tests/test_api_table.py +201 -0
  75. shareddata-6.83.4/tests/test_api_table_schemaless.py +261 -0
  76. shareddata-6.83.4/tests/test_api_table_schemaless_extend.py +131 -0
  77. shareddata-6.83.4/tests/test_bson_last_pos_reuse.py +468 -0
  78. shareddata-6.83.4/tests/test_cache_redis.py +175 -0
  79. shareddata-6.83.4/tests/test_extend_rt.py +69 -0
  80. shareddata-6.83.4/tests/test_loc.py +149 -0
  81. shareddata-6.83.4/tests/test_metadata.py +0 -0
  82. shareddata-6.83.4/tests/test_read_write_tail.py +48 -0
  83. shareddata-6.83.4/tests/test_stream_loopback_async.py +169 -0
  84. shareddata-6.83.4/tests/test_timeseries.py +1137 -0
  85. shareddata-6.83.4/tests/test_timeseries_api.py +391 -0
  86. shareddata-6.83.4/tests/test_upsert_unordered_get_date_loc_d1.py +80 -0
  87. shareddata-6.83.4/tests/test_upsert_unordered_get_date_loc_m1.py +46 -0
  88. shareddata-6.83.4/tests/test_upsert_unordered_get_date_loc_m15.py +46 -0
  89. shareddata-6.83.4/tests/test_upsert_unordered_positions_m1.py +47 -0
  90. shareddata-4.10.3/MANIFEST.in +0 -1
  91. shareddata-4.10.3/PKG-INFO +0 -51
  92. shareddata-4.10.3/README.md +0 -28
  93. shareddata-4.10.3/pyproject.toml +0 -6
  94. shareddata-4.10.3/setup.cfg +0 -41
  95. shareddata-4.10.3/src/SharedData/AWSKinesis.py +0 -437
  96. shareddata-4.10.3/src/SharedData/AWSS3.py +0 -152
  97. shareddata-4.10.3/src/SharedData/DataFrame.py +0 -296
  98. shareddata-4.10.3/src/SharedData/Defaults.py +0 -58
  99. shareddata-4.10.3/src/SharedData/Logger.py +0 -94
  100. shareddata-4.10.3/src/SharedData/Metadata.py +0 -336
  101. shareddata-4.10.3/src/SharedData/MultiProc.py +0 -234
  102. shareddata-4.10.3/src/SharedData/RealTime.py +0 -196
  103. shareddata-4.10.3/src/SharedData/Routines/ReadLogs.py +0 -49
  104. shareddata-4.10.3/src/SharedData/Routines/Schedule.py +0 -443
  105. shareddata-4.10.3/src/SharedData/Routines/Scheduler.py +0 -51
  106. shareddata-4.10.3/src/SharedData/Routines/SendCommand.py +0 -26
  107. shareddata-4.10.3/src/SharedData/Routines/Server.py +0 -41
  108. shareddata-4.10.3/src/SharedData/Routines/Worker.py +0 -79
  109. shareddata-4.10.3/src/SharedData/Routines/WorkerLib.py +0 -634
  110. shareddata-4.10.3/src/SharedData/SharedData.py +0 -214
  111. shareddata-4.10.3/src/SharedData/SharedNumpy.py +0 -309
  112. shareddata-4.10.3/src/SharedData/Table.py +0 -812
  113. shareddata-4.10.3/src/SharedData/TableIndex.py +0 -350
  114. shareddata-4.10.3/src/SharedData/TableIndexJit.py +0 -1102
  115. shareddata-4.10.3/src/SharedData/TimeSeries.py +0 -375
  116. shareddata-4.10.3/src/SharedData/TimeseriesContainer.py +0 -411
  117. shareddata-4.10.3/src/SharedData/Utils.py +0 -42
  118. shareddata-4.10.3/src/shareddata.egg-info/PKG-INFO +0 -51
  119. shareddata-4.10.3/src/shareddata.egg-info/SOURCES.txt +0 -35
  120. shareddata-4.10.3/src/shareddata.egg-info/requires.txt +0 -12
  121. {shareddata-4.10.3 → shareddata-6.83.4}/LICENSE +0 -0
  122. {shareddata-4.10.3/src/SharedData/Routines → shareddata-6.83.4/src/SharedData/IO}/__init__.py +0 -0
  123. {shareddata-4.10.3/src/SharedData → shareddata-6.83.4/src/SharedData/Routines}/__init__.py +0 -0
  124. {shareddata-4.10.3 → shareddata-6.83.4}/src/shareddata.egg-info/dependency_links.txt +0 -0
  125. {shareddata-4.10.3 → shareddata-6.83.4}/src/shareddata.egg-info/top_level.txt +0 -0
@@ -0,0 +1,2 @@
1
+ include src/SharedData/sharedmutexwin.pyd
2
+ include src/SharedData/IO/apidocs.yml
@@ -0,0 +1,195 @@
1
+ Metadata-Version: 2.4
2
+ Name: shareddata
3
+ Version: 6.83.4
4
+ Summary: Memory Mapped / Shared Memory Database with S3 repository
5
+ Classifier: Programming Language :: Python :: 3
6
+ Classifier: License :: OSI Approved :: MIT License
7
+ Classifier: Operating System :: OS Independent
8
+ Requires-Python: >=3.9, <3.13
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: ipykernel==6.23.3
12
+ Requires-Dist: boto3==1.26.160
13
+ Requires-Dist: python-json-logger==2.0.7
14
+ Requires-Dist: python-dotenv==1.0.1
15
+ Requires-Dist: pandas<3,>=2.2
16
+ Requires-Dist: scipy==1.14.0
17
+ Requires-Dist: numpy==1.26.2
18
+ Requires-Dist: numba==0.59.1
19
+ Requires-Dist: XlsxWriter==3.1.2
20
+ Requires-Dist: openpyxl==3.1.2
21
+ Requires-Dist: tqdm==4.65.0
22
+ Requires-Dist: cffi==1.17.1
23
+ Requires-Dist: tzlocal==5.0.1
24
+ Requires-Dist: websockets==12.0
25
+ Requires-Dist: cryptography==41.0.7
26
+ Requires-Dist: lz4==4.3.3
27
+ Requires-Dist: flask==3.0.0
28
+ Requires-Dist: waitress==3.0.0
29
+ Requires-Dist: requests==2.31.0
30
+ Requires-Dist: flasgger==0.9.7.1
31
+ Requires-Dist: pymongo==4.8.0
32
+ Requires-Dist: setuptools==74.1.2
33
+ Requires-Dist: filelock==3.18.0
34
+ Requires-Dist: gunicorn==23.0.0
35
+ Requires-Dist: confluent-kafka==2.10.0
36
+ Requires-Dist: aiokafka==0.12.0
37
+ Requires-Dist: aiohttp==3.12.13
38
+ Requires-Dist: redis==6.2.0
39
+ Dynamic: classifier
40
+ Dynamic: description
41
+ Dynamic: description-content-type
42
+ Dynamic: license-file
43
+ Dynamic: requires-dist
44
+ Dynamic: requires-python
45
+ Dynamic: summary
46
+
47
+ # SharedData
48
+
49
+ A comprehensive ultrafast Python library for financial data.
50
+
51
+ ## 📖 Table of Contents
52
+
53
+ - [🏗️ Core Features](#-core-features)
54
+ - [⚡ Quick Start](#-quick-start)
55
+ - [🔧 Configuration](#-configuration)
56
+ - [🚀 Advanced Usage](#-advanced-usage)
57
+ - [🔄 Development & Documentation](#-development--documentation)
58
+ - [📄 License](#-license)
59
+ - [🤝 Contributing](#-contributing)
60
+
61
+ ## 🏗️ Core Features
62
+
63
+ SharedData provides a comprehensive set of features for high-performance financial data management:
64
+
65
+ - **🗃️ Database Schema & Indexing** - Optimized schemas for financial data types
66
+ - **🌐 Storage & Integration** - Multi-storage support (Local, S3, MongoDB, Redis)
67
+ - **📈 Performance & Scalability** - Parallel processing and advanced querying
68
+ - **📊 Data Containers** - Tables, Collections, Time Series, Streams, Cache, Metadata
69
+ - **⚡ Multiprocessing & Parallel Computing** - Sophisticated parallel processing library
70
+ - **🤖 Distributed Worker System** - Automated task execution and job scheduling
71
+ - **📋 Comprehensive Logging System** - Enterprise-grade logging with multiple destinations
72
+ - **🌐 Remote API Client** - REST API for remote data access and operations
73
+
74
+ **📚 [Read the complete Core Features guide →](docs/CORE_FEATURES.md)**
75
+
76
+ ## ⚡ Quick Start
77
+
78
+ Get up and running with SharedData in minutes:
79
+
80
+ ### Installation
81
+
82
+ ```bash
83
+ # Create virtual environment
84
+ python -m venv venv
85
+ source venv/bin/activate
86
+
87
+ # Install SharedData
88
+ pip install -r requirements.txt
89
+ pip install -e .
90
+ ```
91
+
92
+ ### Basic Usage
93
+
94
+ ```python
95
+ import pandas as pd
96
+ from SharedData.SharedData import SharedData
97
+
98
+ # Initialize SharedData
99
+ shdata = SharedData(__file__, user='master')
100
+
101
+ # Quick example - Tables
102
+ dates = pd.date_range('2025-01-01', '2025-01-10', freq='D')
103
+ symbols = ['AAPL', 'GOOGL', 'MSFT']
104
+ idx = pd.MultiIndex.from_product([dates, symbols], names=['date', 'symbol'])
105
+ df = pd.DataFrame({'price': 100, 'volume': 1000}, index=idx)
106
+
107
+ # Write and read data
108
+ tbl = shdata.table('MarketData', 'D1', 'TEST', 'PRICES', value=df)
109
+ tbl.write()
110
+ data = tbl.loc['2025-01-05':, 'AAPL'] # Fast symbol lookup
111
+ print(f"Retrieved {data.shape[0]} rows")
112
+ ```
113
+
114
+ **📚 [Read the complete Quick Start guide →](docs/QUICK_START.md)**
115
+
116
+ ## 🔧 Configuration
117
+
118
+ Configure SharedData with environment variables for your specific needs:
119
+
120
+ ```bash
121
+ # Required Variables
122
+ SHAREDDATA_SECRET_KEY="your-secret-key"
123
+ SHAREDDATA_TOKEN="your-auth-token"
124
+ AWS_ACCESS_KEY_ID="your-aws-access-key"
125
+ S3_BUCKET="s3://your-bucket-name"
126
+ MONGODB_HOST="your-mongodb-host"
127
+ SHAREDDATA_ENDPOINT="http://your-server:port"
128
+ ```
129
+
130
+ **📚 [Read the complete Configuration guide →](docs/CONFIGURATION.md)**
131
+
132
+ ## 🚀 Advanced Usage
133
+
134
+ For power users and complex scenarios:
135
+
136
+ - **Advanced Data Operations** - Complex queries and aggregations
137
+ - **Performance Optimization** - Memory management and parallel processing
138
+ - **Distributed Computing** - Worker pools and distributed data processing
139
+ - **Custom Extensions** - Custom data containers and worker types
140
+ - **Production Deployment** - High availability and monitoring
141
+ - **Monitoring & Debugging** - Performance profiling and health checks
142
+
143
+ **📚 [Read the complete Advanced Usage guide →](docs/ADVANCED_USAGE.md)**
144
+
145
+ ## 🔄 Development & Documentation
146
+
147
+ For developers contributing to SharedData:
148
+
149
+ ### Building Documentation
150
+
151
+ ```bash
152
+ # Generate documentation from docstrings
153
+ make gitea
154
+
155
+ # Alternative methods
156
+ python generate_docs.py
157
+ python update_docs.py
158
+ make all
159
+ ```
160
+
161
+ ### Running Tests
162
+
163
+ ```bash
164
+ python -m pytest tests/
165
+ ```
166
+
167
+ **📚 [Read the complete Development guide →](docs/DEVELOPMENT.md)**
168
+
169
+ ## 📄 License
170
+
171
+ See [LICENSE](LICENSE) file for details.
172
+
173
+ ## 🤝 Contributing
174
+
175
+ 1. Fork the repository
176
+ 2. Create a feature branch
177
+ 3. Make your changes
178
+ 4. Update documentation: `make gitea`
179
+ 5. Submit a pull request
180
+
181
+ **📚 [Read the complete Contributing guide →](docs/DEVELOPMENT.md#contributing-guidelines)**
182
+
183
+ ---
184
+
185
+ ## 📚 Documentation Index
186
+
187
+ - **[🏗️ Core Features](docs/CORE_FEATURES.md)** - Comprehensive overview of all SharedData capabilities
188
+ - **[⚡ Quick Start](docs/QUICK_START.md)** - Get started with SharedData in minutes
189
+ - **[🔧 Configuration](docs/CONFIGURATION.md)** - Complete configuration reference
190
+ - **[🚀 Advanced Usage](docs/ADVANCED_USAGE.md)** - Advanced patterns and optimization
191
+ - **[🔄 Development](docs/DEVELOPMENT.md)** - Contributing and development guidelines
192
+
193
+ ---
194
+
195
+ [⬆️ Back to top](#shareddata)
@@ -0,0 +1,149 @@
1
+ # SharedData
2
+
3
+ A comprehensive ultrafast Python library for financial data.
4
+
5
+ ## 📖 Table of Contents
6
+
7
+ - [🏗️ Core Features](#-core-features)
8
+ - [⚡ Quick Start](#-quick-start)
9
+ - [🔧 Configuration](#-configuration)
10
+ - [🚀 Advanced Usage](#-advanced-usage)
11
+ - [🔄 Development & Documentation](#-development--documentation)
12
+ - [📄 License](#-license)
13
+ - [🤝 Contributing](#-contributing)
14
+
15
+ ## 🏗️ Core Features
16
+
17
+ SharedData provides a comprehensive set of features for high-performance financial data management:
18
+
19
+ - **🗃️ Database Schema & Indexing** - Optimized schemas for financial data types
20
+ - **🌐 Storage & Integration** - Multi-storage support (Local, S3, MongoDB, Redis)
21
+ - **📈 Performance & Scalability** - Parallel processing and advanced querying
22
+ - **📊 Data Containers** - Tables, Collections, Time Series, Streams, Cache, Metadata
23
+ - **⚡ Multiprocessing & Parallel Computing** - Sophisticated parallel processing library
24
+ - **🤖 Distributed Worker System** - Automated task execution and job scheduling
25
+ - **📋 Comprehensive Logging System** - Enterprise-grade logging with multiple destinations
26
+ - **🌐 Remote API Client** - REST API for remote data access and operations
27
+
28
+ **📚 [Read the complete Core Features guide →](docs/CORE_FEATURES.md)**
29
+
30
+ ## ⚡ Quick Start
31
+
32
+ Get up and running with SharedData in minutes:
33
+
34
+ ### Installation
35
+
36
+ ```bash
37
+ # Create virtual environment
38
+ python -m venv venv
39
+ source venv/bin/activate
40
+
41
+ # Install SharedData
42
+ pip install -r requirements.txt
43
+ pip install -e .
44
+ ```
45
+
46
+ ### Basic Usage
47
+
48
+ ```python
49
+ import pandas as pd
50
+ from SharedData.SharedData import SharedData
51
+
52
+ # Initialize SharedData
53
+ shdata = SharedData(__file__, user='master')
54
+
55
+ # Quick example - Tables
56
+ dates = pd.date_range('2025-01-01', '2025-01-10', freq='D')
57
+ symbols = ['AAPL', 'GOOGL', 'MSFT']
58
+ idx = pd.MultiIndex.from_product([dates, symbols], names=['date', 'symbol'])
59
+ df = pd.DataFrame({'price': 100, 'volume': 1000}, index=idx)
60
+
61
+ # Write and read data
62
+ tbl = shdata.table('MarketData', 'D1', 'TEST', 'PRICES', value=df)
63
+ tbl.write()
64
+ data = tbl.loc['2025-01-05':, 'AAPL'] # Fast symbol lookup
65
+ print(f"Retrieved {data.shape[0]} rows")
66
+ ```
67
+
68
+ **📚 [Read the complete Quick Start guide →](docs/QUICK_START.md)**
69
+
70
+ ## 🔧 Configuration
71
+
72
+ Configure SharedData with environment variables for your specific needs:
73
+
74
+ ```bash
75
+ # Required Variables
76
+ SHAREDDATA_SECRET_KEY="your-secret-key"
77
+ SHAREDDATA_TOKEN="your-auth-token"
78
+ AWS_ACCESS_KEY_ID="your-aws-access-key"
79
+ S3_BUCKET="s3://your-bucket-name"
80
+ MONGODB_HOST="your-mongodb-host"
81
+ SHAREDDATA_ENDPOINT="http://your-server:port"
82
+ ```
83
+
84
+ **📚 [Read the complete Configuration guide →](docs/CONFIGURATION.md)**
85
+
86
+ ## 🚀 Advanced Usage
87
+
88
+ For power users and complex scenarios:
89
+
90
+ - **Advanced Data Operations** - Complex queries and aggregations
91
+ - **Performance Optimization** - Memory management and parallel processing
92
+ - **Distributed Computing** - Worker pools and distributed data processing
93
+ - **Custom Extensions** - Custom data containers and worker types
94
+ - **Production Deployment** - High availability and monitoring
95
+ - **Monitoring & Debugging** - Performance profiling and health checks
96
+
97
+ **📚 [Read the complete Advanced Usage guide →](docs/ADVANCED_USAGE.md)**
98
+
99
+ ## 🔄 Development & Documentation
100
+
101
+ For developers contributing to SharedData:
102
+
103
+ ### Building Documentation
104
+
105
+ ```bash
106
+ # Generate documentation from docstrings
107
+ make gitea
108
+
109
+ # Alternative methods
110
+ python generate_docs.py
111
+ python update_docs.py
112
+ make all
113
+ ```
114
+
115
+ ### Running Tests
116
+
117
+ ```bash
118
+ python -m pytest tests/
119
+ ```
120
+
121
+ **📚 [Read the complete Development guide →](docs/DEVELOPMENT.md)**
122
+
123
+ ## 📄 License
124
+
125
+ See [LICENSE](LICENSE) file for details.
126
+
127
+ ## 🤝 Contributing
128
+
129
+ 1. Fork the repository
130
+ 2. Create a feature branch
131
+ 3. Make your changes
132
+ 4. Update documentation: `make gitea`
133
+ 5. Submit a pull request
134
+
135
+ **📚 [Read the complete Contributing guide →](docs/DEVELOPMENT.md#contributing-guidelines)**
136
+
137
+ ---
138
+
139
+ ## 📚 Documentation Index
140
+
141
+ - **[🏗️ Core Features](docs/CORE_FEATURES.md)** - Comprehensive overview of all SharedData capabilities
142
+ - **[⚡ Quick Start](docs/QUICK_START.md)** - Get started with SharedData in minutes
143
+ - **[🔧 Configuration](docs/CONFIGURATION.md)** - Complete configuration reference
144
+ - **[🚀 Advanced Usage](docs/ADVANCED_USAGE.md)** - Advanced patterns and optimization
145
+ - **[🔄 Development](docs/DEVELOPMENT.md)** - Contributing and development guidelines
146
+
147
+ ---
148
+
149
+ [⬆️ Back to top](#shareddata)
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=42",
4
+ "wheel"
5
+ ]
6
+ build-backend = "setuptools.build_meta"
7
+
8
+ [tool.pytest.ini_options]
9
+ # Configure pytest to suppress asyncio warnings
10
+ asyncio_default_fixture_loop_scope = "function"
11
+ pythonpath = ["src"]
12
+ filterwarnings = [
13
+ "ignore::pytest.PytestDeprecationWarning",
14
+ "ignore::pytest.PytestReturnNotNoneWarning"
15
+ ]
16
+ # Add markers for test categories
17
+ markers = [
18
+ "crud: marks tests as CRUD operations",
19
+ "mutex: marks tests as mutex functionality tests",
20
+ "multiprocess: marks tests as multi-process operations",
21
+ "integration: marks tests as integration tests"
22
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,51 @@
1
+ import sys
2
+ from setuptools import setup, find_packages
3
+
4
+ install_requires = [
5
+ 'ipykernel==6.23.3',
6
+ 'boto3==1.26.160',
7
+ 'python-json-logger==2.0.7',
8
+ 'python-dotenv==1.0.1',
9
+ 'pandas>=2.2,<3',
10
+ 'scipy==1.14.0',
11
+ 'numpy==1.26.2',
12
+ 'numba==0.59.1',
13
+ 'XlsxWriter==3.1.2',
14
+ 'openpyxl==3.1.2',
15
+ 'tqdm==4.65.0',
16
+ 'cffi==1.17.1',
17
+ 'tzlocal==5.0.1',
18
+ 'websockets==12.0',
19
+ 'cryptography==41.0.7',
20
+ 'lz4==4.3.3',
21
+ 'flask==3.0.0',
22
+ 'waitress==3.0.0',
23
+ 'requests==2.31.0',
24
+ 'flasgger==0.9.7.1',
25
+ 'pymongo==4.8.0',
26
+ 'setuptools==74.1.2',
27
+ 'filelock==3.18.0',
28
+ 'gunicorn==23.0.0',
29
+ 'confluent-kafka==2.10.0',
30
+ 'aiokafka==0.12.0',
31
+ 'aiohttp==3.12.13',
32
+ 'redis==6.2.0',
33
+ ]
34
+
35
+ setup(
36
+ name='shareddata',
37
+ version='6.83.4',
38
+ description='Memory Mapped / Shared Memory Database with S3 repository',
39
+ long_description=open('README.md').read(),
40
+ long_description_content_type='text/markdown',
41
+ classifiers=[
42
+ 'Programming Language :: Python :: 3',
43
+ 'License :: OSI Approved :: MIT License',
44
+ 'Operating System :: OS Independent',
45
+ ],
46
+ packages=find_packages(where='src'),
47
+ package_dir={'': 'src'},
48
+ python_requires='>=3.9, <3.13',
49
+ install_requires=install_requires,
50
+ include_package_data=True,
51
+ )
@@ -0,0 +1,162 @@
1
+ """
2
+ SharedData API Server - Production Entry Point (Gunicorn)
3
+
4
+ This module provides the production server for the SharedData API using Gunicorn.
5
+ For development/testing, use ServerAPI.py which runs with Waitress.
6
+
7
+ Usage:
8
+ python -m SharedData.API.ServerGunicorn [--host HOST] [--port PORT] [--nproc NPROC] [--nthreads NTHREADS]
9
+ """
10
+ from __future__ import annotations
11
+
12
+ import argparse
13
+ import os
14
+ import sys
15
+ import threading
16
+ import time
17
+ from gunicorn.app.base import BaseApplication
18
+
19
+ from SharedData.Logger import Logger
20
+ Logger.connect('SharedData.API.ServerGunicorn')
21
+
22
+ from SharedData.API import create_app
23
+
24
+ # Create Flask app at module level for Gunicorn
25
+ flask_app = create_app()
26
+
27
+
28
+ class GunicornEmbedded(BaseApplication):
29
+ """
30
+ A Gunicorn application wrapper that runs Gunicorn within the current Python interpreter.
31
+
32
+ This class allows embedding Gunicorn server functionality directly into a Python process,
33
+ enabling programmatic control over Gunicorn configuration and execution without spawning
34
+ a separate Gunicorn process.
35
+
36
+ Attributes:
37
+ _wsgi_app: The WSGI application to be served by Gunicorn.
38
+ _options: A dictionary of Gunicorn configuration options.
39
+
40
+ Example:
41
+ GunicornEmbedded(flask_app, {"bind": "0.0.0.0:8002", "workers": 4}).run()
42
+ """
43
+ def __init__(self, wsgi_app, options: dict[str, str | int]):
44
+ """
45
+ Initializes the instance with a WSGI application and configuration options.
46
+
47
+ Parameters:
48
+ wsgi_app: The WSGI application callable to be wrapped or used.
49
+ options: A dictionary of Gunicorn configuration options.
50
+ """
51
+ self._wsgi_app = wsgi_app
52
+ self._options = options or {}
53
+ super().__init__()
54
+
55
+ def load_config(self):
56
+ """
57
+ Loads configuration settings from a dictionary of options into the Gunicorn configuration.
58
+
59
+ For each key-value pair in the provided options, this method sets the corresponding
60
+ configuration value in the Gunicorn configuration object, provided that the key is valid.
61
+ """
62
+ for key, value in self._options.items():
63
+ if key in self.cfg.settings and value is not None:
64
+ self.cfg.set(key.lower(), value)
65
+
66
+ def load(self):
67
+ """
68
+ Returns the WSGI application instance.
69
+
70
+ Returns:
71
+ The WSGI application instance stored in this object.
72
+ """
73
+ return self._wsgi_app
74
+
75
+
76
+ def parse_cli():
77
+ """
78
+ Parse CLI arguments when running as a stand-alone script.
79
+
80
+ Returns:
81
+ Parsed arguments namespace.
82
+ """
83
+ p = argparse.ArgumentParser(
84
+ description="Run SharedData API with embedded Gunicorn"
85
+ )
86
+ p.add_argument("--host", default="0.0.0.0", help="Listen address")
87
+ p.add_argument("--port", type=int, default=8002, help="Listen port")
88
+ p.add_argument("--nproc", type=int, default=4,
89
+ help="Number of Gunicorn worker processes")
90
+ p.add_argument("--nthreads", type=int, default=8,
91
+ help="Number of request threads *per* worker (gthread)")
92
+ p.add_argument("--timeout", type=int, default=120,
93
+ help="Hard kill after N seconds")
94
+ p.add_argument("--log-level", default="warning")
95
+ return p.parse_args()
96
+
97
+
98
+ def send_heartbeat():
99
+ """
100
+ Sends periodic heartbeat signals to indicate that the routine is running.
101
+
102
+ The function waits for an initial 15 seconds before logging a start message.
103
+ It then enters an infinite loop where it logs a debug heartbeat message every
104
+ 15 seconds to signal ongoing activity.
105
+ """
106
+ heartbeat_interval = 15
107
+ time.sleep(15)
108
+ Logger.log.info('ROUTINE STARTED!')
109
+ while True:
110
+ Logger.log.debug('#heartbeat#')
111
+ time.sleep(heartbeat_interval)
112
+
113
+
114
+ def start_background_threads():
115
+ """
116
+ Starts a background daemon thread that continuously emits heartbeat metrics.
117
+ """
118
+ heartbeat_thread = threading.Thread(target=send_heartbeat, daemon=True)
119
+ heartbeat_thread.start()
120
+
121
+
122
+ def main():
123
+ """
124
+ Entry point for the application. Parses command-line arguments, starts necessary
125
+ background helper threads, configures Gunicorn server options based on the parsed
126
+ arguments, and launches the Gunicorn server embedded within the process to serve
127
+ the Flask application.
128
+ """
129
+ args = parse_cli()
130
+
131
+ # Launch in-process helper threads
132
+ start_background_threads()
133
+
134
+ # Assemble Gunicorn config
135
+ gunicorn_opts = {
136
+ "bind": f"{args.host}:{args.port}",
137
+ "workers": args.nproc,
138
+ "worker_class": "gthread",
139
+ "threads": args.nthreads,
140
+ "timeout": args.timeout,
141
+ "graceful_timeout": 30,
142
+ "preload_app": False,
143
+ "accesslog": None,
144
+ "errorlog": "-",
145
+ "loglevel": args.log_level,
146
+ "max_requests": 5000, # recycle workers → tame leaks
147
+ "max_requests_jitter": 500,
148
+ "limit_request_line": 8190, # 8190 is HTTP/1.1 spec max
149
+ }
150
+
151
+ # Block here; Gunicorn handles signals and will exit cleanly
152
+ GunicornEmbedded(flask_app, gunicorn_opts).run()
153
+
154
+
155
+ if __name__ == "__main__":
156
+ # Basic env-var sanity checks
157
+ required_env = ("SHAREDDATA_SECRET_KEY", "SHAREDDATA_TOKEN")
158
+ missing = [v for v in required_env if v not in os.environ]
159
+ if missing:
160
+ sys.exit(f"Missing environment variables: {', '.join(missing)}")
161
+
162
+ main()
@@ -0,0 +1,62 @@
1
+ """
2
+ SharedData API Server - Development Entry Point
3
+
4
+ This module provides the development server for the SharedData API.
5
+ For production, use ServerHttp.py which runs with Gunicorn.
6
+
7
+ Usage:
8
+ python -m SharedData.API.ServerWaitress [--host HOST] [--port PORT]
9
+ """
10
+
11
+ import os
12
+ import sys
13
+ import argparse
14
+
15
+ from waitress import serve
16
+
17
+ from SharedData.Logger import Logger
18
+
19
+
20
+ def parse_args():
21
+ """Parse command line arguments."""
22
+ parser = argparse.ArgumentParser(description='SharedData API Development Server')
23
+ parser.add_argument('--host', type=str, default='0.0.0.0',
24
+ help='Host to bind to (default: 0.0.0.0)')
25
+ parser.add_argument('--port', type=int, default=8002,
26
+ help='Port to bind to (default: 8002)')
27
+ parser.add_argument('--threads', type=int, default=4,
28
+ help='Number of worker threads (default: 4)')
29
+ return parser.parse_args()
30
+
31
+
32
+ def validate_environment():
33
+ """Validate required environment variables are set."""
34
+ required_env = ('SHAREDDATA_SECRET_KEY', 'SHAREDDATA_TOKEN')
35
+ missing = [v for v in required_env if v not in os.environ]
36
+ if missing:
37
+ sys.exit(f"Missing environment variables: {', '.join(missing)}")
38
+
39
+
40
+ def main():
41
+ """Main entry point for the development server."""
42
+ # Validate environment
43
+ validate_environment()
44
+
45
+ # Parse arguments
46
+ args = parse_args()
47
+
48
+ # Setup logging
49
+ Logger.connect('SharedData.API.ServerWaitress')
50
+ Logger.log.info(f'Starting SharedData API development server on {args.host}:{args.port}')
51
+
52
+ # Import and create app (after logging is setup)
53
+ from SharedData.API import create_app
54
+ app = create_app()
55
+
56
+ # Run with Waitress (production-quality WSGI server)
57
+ Logger.log.info(f'Server ready - http://{args.host}:{args.port}')
58
+ serve(app, host=args.host, port=args.port, threads=args.threads)
59
+
60
+
61
+ if __name__ == '__main__':
62
+ main()