causalens / dara Goto Github PK
View Code? Open in Web Editor NEWDara is a dynamic application framework designed for creating interactive web apps with ease, all in pure Python.
Home Page: https://dara.causalens.com
License: Apache License 2.0
Dara is a dynamic application framework designed for creating interactive web apps with ease, all in pure Python.
Home Page: https://dara.causalens.com
License: Apache License 2.0
What is a recommended way of adding @actions in the class pages?
I have my variables and derived variables initialised in the __init__
for full encapsulation but I am hitting a problem when trying to define an action
Have something like this:
class Page:
some_service: Service
variable: Variable
derived_variable: DerivedVariable
def __init__(self, some_service: Service):
self.some_service = some_service
self.variable = Variable(default="default")
self.derived_variable = DerivedVariable(
func=self.some_service.get_derived_variable,
variables=[self.variable],
)
@action
async def reset_variable(self, ctx: action.Ctx, resolving_stage, selected_transaction):
await ctx.update(variable=self.variable, value="")
It doesnt like that there is a self in the function...
Should it be something like this instead:
variable = Variable(default="default")
@action
async def reset_variable(ctx: action.Ctx, resolving_stage, selected_transaction):
await ctx.update(variable=self.variable, value="updated")
class Page:
some_service: Service
derived_variable: DerivedVariable
def __init__(self, some_service: Service):
self.some_service = some_service
self.derived_variable = DerivedVariable(
func=self.some_service.get_derived_variable,
variables=[variable],
)
Its a bit annoying that I have to keep Variable
and DerivedVariable
defined separetly
Select(
value=select_var,
# items=[Item(label=f'Choice {i}', value=f'{i}') for i in range(1, 10000)],
items=[f'Choice {i}' for i in range(1, 10000)],
multiselect=True,
searchable=True
)
When use the Select
component with a very large number of items (say, more than 10000 as I tested), the component seems very sluggish.
Whether using the items with or without Item()
have the very same sluggish effect.
my case of using large number of options in select:
a select for user to select stock, etf, idx symbols.
I have two different problems:
+ CategoryInfo : ObjectNotFound: (create-dara-app:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Successfully installed MarkupSafe-2.1.3 PyYAML-6.0.1 aiofiles-23.2.1 anyio-4.0.0 arrow-1.3.0 async-asgi-testclient-1.4.11 binaryornot-0.4.4 black-22.1.0 blue-0.9.1 bokeh-3.1.1 cai-causal-graph-0.2.6 certifi-2023.7.22 cffi-1.16.0 chardet-5.2.0 charset-normalizer-3.3.0 click-8.1.3 colorama-0.4.6 contourpy-1.1.1 cookiecutter-2.4.0 create-dara-app-1.3.0 croniter-1.4.1 cryptography-41.0.4 cycler-0.12.1 dara-components-1.3.0 dara-core-1.3.0 defusedxml-0.7.1 dill-0.3.7 et-xmlfile-1.1.0 exceptiongroup-1.1.3 fastapi-0.95.2 fastapi-vite-0.3.1 flake8-4.0.1 fonttools-4.43.1 h11-0.14.0 httpcore-0.18.0 httptools-0.6.0 httpx-0.25.0 idna-3.4 isort-5.12.0 jinja2-3.0.3 kiwisolver-1.4.5 markdown-it-py-3.0.0 matplotlib-3.8.0 mccabe-0.6.1 mdurl-0.1.2 multidict-6.0.4 mypy-extensions-1.0.0 networkx-3.1 numpy-1.26.0 odfpy-1.4.1 openpyxl-3.1.2 packaging-23.2 pandas-2.1.1 pathspec-0.11.2 pillow-10.0.1 platformdirs-3.11.0 plotly-5.14.1 prometheus-client-0.14.1 pyarrow-13.0.0 pycodestyle-2.8.0 pycparser-2.21 pydantic-1.10.13 pyflakes-2.4.0 pygments-2.16.1 pyjwt-2.8.0 pyparsing-3.1.1 python-dateutil-2.8.2 python-dotenv-0.19.2 python-multipart-0.0.5 python-slugify-8.0.1 pytz-2023.3.post1 pyxlsb-1.0.10 requests-2.31.0 responses-0.18.0 rich-13.6.0 scipy-1.11.3 seaborn-0.13.0 six-1.16.0 sniffio-1.3.0 starlette-0.27.0 tblib-1.7.0 tenacity-8.2.3 test-0.1.0 text-unidecode-1.3 toml-0.10.2 tomli-2.0.1 tornado-6.3.3 types-python-dateutil-2.8.19.14 typing-extensions-4.5.0 tzdata-2023.3 urllib3-2.0.6 uvicorn-0.22.0 watchfiles-0.20.0 websockets-11.0.3 xlrd-2.0.1 xyzservices-2023.10.0
MINGW64 /c/Code /dara $ create-dara-app
WARNING:create-dara-app:Poetry not found. Falling back to pip.
[1/2] project_name (Decision App): test
[2/2] author_name (Author <[email protected]>): test
Lots of ouput …, but successful.
username@computer MINGW64 /c/Code/dara/test$ source .venv/Scripts/activate
(.venv)
username@computer MINGW64 /c/Code/dara/test$ dara start
2023-10-10 15:53:25,993 WARNING uvicorn.error Current configuration will not reload as not all conditions are met, please refer to documentation.
Traceback (most recent call last):
File "C:\Tools\Python\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Tools\Python\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Code\dara\test.venv\Scripts\dara.exe_main.py", line 7, in
sys.exit(cli())
File "C:\Code\dara\test.venv\lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Code\dara\test.venv\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Code\dara\test.venv\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Code\dara\test.venv\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Code\dara\test.venv\lib\site-packages\click\core.py", line 760, in invoke
return _callback(*args, **kwargs)
File "C:\Code\dara\test.venv\lib\site-packages\dara\core\cli.py", line 140, in start
uvicorn.run(
File "C:\Code\dara\test.venv\lib\site-packages\uvicorn\main.py", line 578, in run
server.run()
File "C:\Code\dara\test.venv\lib\site-packages\uvicorn\server.py", line 61, in run
return asyncio.run(self.serve(sockets=sockets))
File "C:\Tools\Python\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Tools\Python\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Code\dara\test.venv\lib\site-packages\uvicorn\server.py", line 68, in serve
config.load()
File "C:\Code\dara\test.venv\lib\site-packages\uvicorn\config.py", line 473, in load
self.loaded_app = import_from_string(self.app)
File "C:\Code\dara\test.venv\lib\site-packages\uvicorn\importer.py", line 24, in import_from_string
raise exc from None
File "C:\Code\dara\test.venv\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string
module = importlib.import_module(module_str)
File "C:\Tools\Python\lib\importlib_init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Code\dara\test.venv\lib\site-packages\dara\core\main.py", line 44, in
from dara.core.internal.cgroup import get_cpu_count, set_memory_limit
File "C:\Code\dara\test.venv\lib\site-packages\dara\core\internal\cgroup.py", line 21, in
import resource
ModuleNotFoundError: No module named 'resource
I am working on a machine that does not have internet access.
When I load open the web address in a browser, it fails to load js packages from unpkg.com and code.jquery.com
Is there a way to configure it to load assets from a local location?
Hello,
I have followed all the steps of Github and looked at your tool.
However, it seems that there is nothing that can be applied and I was wondering about the exact purpose of your visualization when I cannot do anything using it?
Ouput from terminal on Windows 10 with the git bash shell:
C:\Users\DARA> create-dara-app
create-dara-app : The name "create-dara-app" was not recognized as the name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if the path is correct (if included), and repeat the process.
In line:1 character:1
+ CategoryInfo : ObjectNotFound: (create-dara-app:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
root@miop-HP-Convertible-x360-11-ab1XX:/home/miop/belajar/dara# python3 --version
Python 3.10.12
error this
root@miop-HP-Convertible-x360-11-ab1XX:/home/miop/belajar/dara# create-dara-app
[1/7] project_name (Decision App): mydara
[2/7] author_name (Author <[email protected]>):
Project generated. Running post-generation hooks...
/home/miop/belajar/dara/mydara
Installing dependencies...
Creating virtualenv mydara in /home/miop/belajar/dara/mydara/.venv
Updating dependencies
Resolving dependencies... (3.1s)
ConnectionError
('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
at /usr/local/lib/python3.10/dist-packages/requests/adapters.py:501 in send
497│ chunked=chunked,
498│ )
499│
500│ except (ProtocolError, OSError) as err:
→ 501│ raise ConnectionError(err, request=request)
502│
503│ except MaxRetryError as e:
504│ if isinstance(e.reason, ConnectTimeoutError):
505│ # TODO: Remove this in 3.0.0: see #2811
Error: Poetry install failed
ERROR:cookiecutter.generate:Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.