-
-
Notifications
You must be signed in to change notification settings - Fork 539
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 dependabot/pip/ruff-0.6.3
- Loading branch information
Showing
521 changed files
with
545,559 additions
and
676,483 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 |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# Included Web Dependencies | ||
|
||
- vue: 3.3.6 ([MIT](https://opensource.org/licenses/MIT)) | ||
- quasar: 2.13.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- tailwindcss: 3.2.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- socket.io: 4.7.2 ([MIT](https://opensource.org/licenses/MIT)) | ||
- es-module-shims: 1.8.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- aggrid: 30.2.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- vue: 3.4.38 ([MIT](https://opensource.org/licenses/MIT)) | ||
- quasar: 2.16.9 ([MIT](https://opensource.org/licenses/MIT)) | ||
- tailwindcss: 3.4.10 ([MIT](https://opensource.org/licenses/MIT)) | ||
- socket.io: 4.7.5 ([MIT](https://opensource.org/licenses/MIT)) | ||
- es-module-shims: 1.10.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- aggrid: 32.1.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- codemirror: 6.0.1 ([MIT](https://opensource.org/licenses/MIT)) | ||
- echarts: 5.4.3 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0)) | ||
- echarts: 5.5.1 ([Apache-2.0](https://opensource.org/licenses/Apache-2.0)) | ||
- echarts-gl: 2.0.9 ([BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause)) | ||
- leaflet: 1.9.4 ([BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause)) | ||
- leaflet-draw: 1.0.4 ([MIT](https://opensource.org/licenses/MIT)) | ||
- mermaid: 10.5.1 ([MIT](https://opensource.org/licenses/MIT)) | ||
- nipplejs: 0.10.1 ([MIT](https://opensource.org/licenses/MIT)) | ||
- plotly: 2.27.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- three: 0.157.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- tween: 21.0.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- vanilla-jsoneditor: 0.18.10 ([ISC](https://opensource.org/licenses/ISC)) | ||
- mermaid: 11.0.2 ([MIT](https://opensource.org/licenses/MIT)) | ||
- nipplejs: 0.10.2 ([MIT](https://opensource.org/licenses/MIT)) | ||
- plotly: 2.35.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- three: 0.168.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- tween: 25.0.0 ([MIT](https://opensource.org/licenses/MIT)) | ||
- vanilla-jsoneditor: 0.23.8 ([ISC](https://opensource.org/licenses/ISC)) |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
langchain>=0.0.142 | ||
langchain>=0.2 | ||
langchain-community | ||
langchain_openai | ||
nicegui |
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,2 @@ | ||
node_modules/ | ||
package-lock.json |
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,30 @@ | ||
# Use Bundled Node Modules as Third-party Dependencies | ||
|
||
This example demonstrates how to use multiple third-party node modules as dependencies in a NiceGUI app. | ||
The app uses the [is-odd](https://www.npmjs.com/package/is-odd) node modules to check if a number is even or odd. | ||
We chose this package to demonstrate a very simple node module which has a dependency itself, | ||
namely the [is-number](https://www.npmjs.com/package/is-number) package. | ||
Using NPM, we can easily install both packages and bundle them into a single file which can be used in the app. | ||
The package.json file defines the is-odd dependency and some dev dependencies for bundling the node module, | ||
the webpack.config.js file specifies the entry point for the node module, | ||
and number_checker.js as well as number_checker.py define a new UI element to be used in the NiceGUI app main.py. | ||
|
||
1. First, install all third-party node modules (assuming you have NPM installed): | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
This will create a node_modules directory containing the is-odd and is-number modules as well as some dev dependencies. | ||
|
||
2. Now bundle the node module: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
3. Finally, you can run the app as usual: | ||
|
||
```bash | ||
python3 main.py | ||
``` |
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,19 @@ | ||
#!/usr/bin/env python3 | ||
from number_checker import NumberChecker | ||
|
||
from nicegui import ui | ||
|
||
|
||
@ui.page('/') | ||
def page(): | ||
number_checker = NumberChecker() | ||
number = ui.number(value=42.0) | ||
|
||
async def check(): | ||
even = await number_checker.is_even(number.value) | ||
ui.notify(f'{number.value} is {"even" if even else "odd"}') | ||
|
||
ui.button('Check', on_click=check) | ||
|
||
|
||
ui.run() |
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,13 @@ | ||
export default { | ||
async mounted() { | ||
await import("is-odd"); | ||
}, | ||
methods: { | ||
isOdd(number) { | ||
return isOdd(number); | ||
}, | ||
isEven(number) { | ||
return !isOdd(number); | ||
}, | ||
}, | ||
}; |
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,19 @@ | ||
from nicegui import ui | ||
|
||
|
||
class NumberChecker(ui.element, component='number_checker.js', dependencies=['dist/is-odd.js']): | ||
|
||
def __init__(self) -> None: | ||
"""NumberChecker | ||
A number checker based on the `is-odd <https://www.npmjs.com/package/is-odd>`_ NPM package. | ||
""" | ||
super().__init__() | ||
|
||
async def is_odd(self, number: int) -> bool: | ||
"""Check if a number is odd.""" | ||
return await self.run_method('isOdd', number) | ||
|
||
async def is_even(self, number: int) -> bool: | ||
"""Check if a number is even.""" | ||
return await self.run_method('isEven', number) |
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,15 @@ | ||
{ | ||
"scripts": { | ||
"build": "webpack --config webpack.config.js" | ||
}, | ||
"dependencies": { | ||
"is-odd": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.24.5", | ||
"@babel/preset-env": "^7.24.5", | ||
"babel-loader": "^9.1.3", | ||
"webpack": "^5.91.0", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
} |
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,26 @@ | ||
const path = require("path"); | ||
|
||
module.exports = { | ||
entry: "is-odd/index.js", | ||
mode: "development", | ||
output: { | ||
path: path.resolve(__dirname, "dist"), | ||
filename: "is-odd.js", | ||
library: "isOdd", | ||
libraryTarget: "umd", | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: "babel-loader", | ||
options: { | ||
presets: ["@babel/preset-env"], | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
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,2 @@ | ||
node_modules/ | ||
package-lock.json |
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,20 @@ | ||
# Use Node Modules as Third-party Dependencies | ||
|
||
This example demonstrates how to use third-party node modules as dependencies in a NiceGUI app. | ||
The app uses the [signature_pad](https://www.npmjs.com/package/signature_pad) node module to create a signature pad. | ||
In package.json, the signature_pad module is listed as a dependency, | ||
while signature_pad.js and signature_pad.py define the new UI element which can be used in main.py. | ||
|
||
1. First, install the third-party node modules (assuming you have NPM installed): | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
This will create a node_modules directory containing the signature_pad module. | ||
|
||
2. Now you can run the app as usual: | ||
|
||
```bash | ||
python3 main.py | ||
``` |
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,9 @@ | ||
#!/usr/bin/env python3 | ||
from signature_pad import SignaturePad | ||
|
||
from nicegui import ui | ||
|
||
pad = SignaturePad().classes('border') | ||
ui.button('Clear', on_click=pad.clear) | ||
|
||
ui.run() |
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 @@ | ||
{ | ||
"dependencies": { | ||
"signature_pad": "^4.1.7" | ||
} | ||
} |
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,16 @@ | ||
import SignaturePad from "signature_pad"; | ||
|
||
export default { | ||
template: "<canvas></canvas>", | ||
props: { | ||
options: Array, | ||
}, | ||
mounted() { | ||
this.pad = new SignaturePad(this.$el, this.options); | ||
}, | ||
methods: { | ||
clear() { | ||
this.pad.clear(); | ||
}, | ||
}, | ||
}; |
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,20 @@ | ||
from typing import Dict, Optional | ||
|
||
from nicegui import ui | ||
|
||
|
||
class SignaturePad(ui.element, | ||
component='signature_pad.js', | ||
dependencies=['node_modules/signature_pad/dist/signature_pad.min.js']): | ||
|
||
def __init__(self, options: Optional[Dict] = None) -> None: | ||
"""SignaturePad | ||
An element that integrates the `Signature Pad library <https://szimek.github.io/signature_pad/>`_. | ||
""" | ||
super().__init__() | ||
self._props['options'] = options or {} | ||
|
||
def clear(self): | ||
"""Clear the signature.""" | ||
self.run_method('clear') |
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.