Skip to content

Commit

Permalink
fix: build with poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
voznik committed Mar 20, 2024
1 parent 75ec3f3 commit 6d2296d
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 152 deletions.
43 changes: 30 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,21 @@
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"args": ["${relativeFile}"],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register"
],
"args": [
"${relativeFile}"
],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"skipFiles": ["<node_internals>/**", "node_modules/**"],
"skipFiles": [
"<node_internals>/**",
"node_modules/**"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
Expand All @@ -87,20 +96,28 @@
},
//
{
"name": "Python: Streamlit",
"type": "python",
"request": "launch",
"module": "streamlit",
"args": ["run", "${file}", "--server.headless=true", "--browser.gatherUsageStats=false"],
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"console": "integratedTerminal"
"name": "Python: Streamlit",
"type": "python",
"request": "launch",
"module": "streamlit",
"args": [
"run",
"${file}",
"--server.headless=true",
"--browser.gatherUsageStats=false"
],
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
"console": "integratedTerminal"
}
],
"inputs": [
{
"options": ["rxdb", "kinto"],
"options": [
"rxdb",
"kinto"
],
"id": "libName",
"type": "pickString",
"default": "rxdb",
Expand Down
63 changes: 60 additions & 3 deletions packages/streamlit-rxdb-dataframe/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,62 @@
<!-- An exception thrown inside a promise will not be caught by a nesting try block due to the asynchronous nature of execution.
# streamlit-rxdb-dataframe

Promises are designed to propagate errors to the next error handler or catch() block in the promise chain. Promises are asynchronous and operate outside of the normal call stack. When a Promise is created, it is added to the microtask queue, which is processed after the current call stack has completed. This means that the try-catch block surrounding the Promise will have already completed by the time the Promise is resolved or rejected. Therefore, any error occurring within the Promise will not be caught by the try-catch block.
Custom streamlit component connecting local browser indexedDB database as RxDB collection as dataframe

-->
## Usage

```python

todoSchema: Dict = json.load(open(os.path.join(data_dir, "todo.schema.json")))
# initial_docs: List = json.load(open(os.path.join(data_dir, "col.dump.json")))["docs"]
collection_config = {
"name": "todo",
"schema": todoSchema, # to auto load schema from remote url pass None
"localDocuments": True,
"options": {
# 'schemaUrl': 'assets/data/todo.schema.json',
# "initialDocs": initial_docs,
},
}

def on_change_dataframe(rxdb_state: RxDBSessionState):
print("RxDBDataframe component on_change call")
print("collection.info()", rxdb_state.info)
print("dataframe.head()", rxdb_state.dataframe.head())

df = rxdb_dataframe(
collection_config,
query=None,
with_rev=False,
on_change=on_change_dataframe,
)
st.dataframe(
df,
use_container_width=True,
hide_index=True,
column_config=st.session_state["rxdb"]["column_config"],
column_order=["title", "completed", "createdAt"],
)
```


## Run & Build

### Run

```bash
cd packages/streamlit-rxdb-dataframe/
poetry run streamlit run example.py
```

### Build

```bash
poetry build -o ../../dist/packages/streamlit-rxdb-dataframe
```

### Publish

```bash
poetry publish -r test-pypi --dist-dir ../../dist/packages/streamlit-rx
db-dataframe
```
Loading

0 comments on commit 6d2296d

Please sign in to comment.