forked from KxSystems/pykx
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chraberturas/pandas-api-nunique
- Loading branch information
Showing
54 changed files
with
2,572 additions
and
440 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Bug Fix | ||
|
||
- Please insert link to github issue here: | ||
|
||
## What is the bug? | ||
|
||
If possible please include a summary and reproducible use-case below: | ||
|
||
```python | ||
>>> (insert example here) | ||
``` | ||
|
||
## How does the change fix it? | ||
|
||
Include a short description outlining how your change fixes current behaviour | ||
|
||
## Code | ||
|
||
- [ ] Is code production ready (no stub/test functions, hardcoded IP/ tables/ hostnames, etc.)? | ||
|
||
## Testing | ||
|
||
- [ ] Have unit tests been created or existing ones updated to catch this bug in the future? | ||
- [ ] Has test coverage remained the same or improved? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Documentation template | ||
|
||
## What does this change introduce? | ||
|
||
## Checklist | ||
|
||
- [ ] Have you ensured that any changes to the documentation are correctly formatted, in particular are code snippets being correctly displayed? | ||
- [ ] If a new class has been added has a documentation stub `.md` file associated with it been created? | ||
- [ ] Have you ensured that any included hyperlinks are operating correctly? | ||
- [ ] If any documentation page has been created has it been added to `mkdocs.yml` | ||
- [ ] Have you checked your changes with a spell checker? (US English) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Feature | ||
|
||
- Please insert link to associated issue here: | ||
|
||
## What does this change introduce? | ||
|
||
## General | ||
|
||
- [ ] Has an example been added to demo the new feature? | ||
- [ ] Have existing examples been updated or tested? | ||
- [ ] Have you added any new Environment Variables/Configuration Options? If yes please tick the boxes below as applicable | ||
- [ ] Addition to reimporter logic within `src/pykx/pykx.q` and `src/pykx/reimporter.py` | ||
- [ ] Have updated the `src/pykx/util.py` logic which is used for environment variable | ||
- [ ] If there have been any dependency updates have they been reflected in all files? | ||
- [ ] pyproject.toml | ||
- [ ] docs/getting-started/installing.md | ||
- [ ] conda-recipe/meta.yaml | ||
- [ ] README.md | ||
- [ ] If any examples have been updated has it's associated `.zip` been updated | ||
|
||
## Code | ||
|
||
- [ ] Has all temporary code used during development been removed? | ||
- [ ] Has all commented out (unused) code been removed? | ||
- [ ] Where reasonable have you ensured there is no duplication of existing code? | ||
- [ ] If applicable for your use-case have you ensured that the code is performant? | ||
|
||
## Testing | ||
|
||
- [ ] Have unit tests been created or existing ones updated to test this new functionality? | ||
|
||
## Documentation | ||
|
||
- [ ] Has documentation been added for all public code? | ||
- [ ] Has a release note been included for the new feature? | ||
- [ ] Has any documentation which would benefit from this feature been updated to use the most up to date functionality? | ||
- [ ] If a new class has been added has a documentation stub `.md` file associated with it been created? | ||
- [ ] If any documentation page has been created has it been added to `mkdocs.yml` | ||
- [ ] Have you checked your changes with a spell checker? (US English) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Please go the the `Preview` tab and select the appropriate sub-template: | ||
|
||
* [Bug fix Pull Request](?expand=1&template=bug.md) | ||
* [Feature addition Pull Request](?expand=1&template=feature.md) | ||
* [Documentation addition Pull Request](?expand=1&template=documentation.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import asyncio | ||
import sys | ||
|
||
|
||
import pykx as kx | ||
|
||
port = 5000 | ||
if len(sys.argv)>1: | ||
port = int(sys.argv[1]) | ||
|
||
|
||
def qval_sync(query): | ||
res = kx.q.value(query) | ||
print("sync") | ||
print(f'{query}\n{res}\n') | ||
return res | ||
|
||
|
||
def qval_async(query): | ||
res = kx.q.value(query) | ||
print("async") | ||
print(f'{query}\n{res}\n') | ||
|
||
|
||
async def main(): | ||
# It is possible to add user validation by overriding the .z.pw function | ||
# kx.q.z.pw = lambda username, password: password == 'password' | ||
kx.q.z.pg = qval_sync | ||
kx.q.z.ps = qval_async | ||
async with kx.RawQConnection(port=port, as_server=True, conn_gc_time=20.0) as q: | ||
while True: | ||
await q.poll_recv_async() | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import pykx as kx | ||
|
||
import asyncio | ||
|
||
|
||
table = kx.q('([] a: 10?10; b: 10?10)') | ||
|
||
|
||
def assert_result(res): | ||
# assert message from q process has the correct schema to be appended to the table | ||
return type(res) is kx.LongVector and len(res) == 2 | ||
|
||
|
||
async def main_loop(q): | ||
global table | ||
while True: | ||
result = await q.poll_recv_async() | ||
if assert_result(result): | ||
print(f'Recieved new table row from q: {result}') | ||
table = kx.q.upsert(table, result) | ||
print(table) | ||
result = None | ||
|
||
|
||
async def main(): | ||
global table | ||
async with kx.RawQConnection(port=5001, event_loop=asyncio.get_event_loop()) as q: | ||
print('===== Initital Table =====') | ||
print(table) | ||
print('===== Initital Table =====') | ||
# Set the variable py_server on the q process pointing towards this processes IPC connection | ||
# We use neg to ensure the messages are sent async so no reply is expected from this process | ||
await q('py_server: neg .z.w') | ||
|
||
await main_loop(q) | ||
|
||
|
||
if __name__ == '__main__': | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.