dot-agent / nextpy Goto Github PK
View Code? Open in Web Editor NEW๐คSelf-Modifying App Framework from the Future ๐ฎ
Home Page: https://nextpy.org
License: Apache License 2.0
๐คSelf-Modifying App Framework from the Future ๐ฎ
Home Page: https://nextpy.org
License: Apache License 2.0
Recreate the Streamlit roadmap page using Nextpy. This will serve as a practical demonstration of Nextpyโs performance in a real-world application scenario. Use this recreation as a benchmark to quantify the performance differences between Streamlit and Nextpy.
def index() -> xt.Component:
layout = xt.box(
# xt.title("Resume Search App"),
xt.file_uploader("Upload your resume", on_change=on_file_upload),
xt.text_input("Enter the text which you want to search: ", bind="search_text"),
xt.button("Search", on_click=search_resume),
xt.stack(
[xt.box(result, style={"margin_bottom": "10px"}) for result in xt.bind("search_results")]
),
)
return layout
May I kindly request that someone inform me of the appropriate attribute to upload the pdf or document file?
xt.box(
xt.center(xt.text("YAML-2-PYTHON",
# margin_top="20px",
font_size="39px",
text_align="center",
color="violet",
),),
xt.link(
xt.image(src="/github.svg",
height="57px",
width="57px",
text_align="center",
align_items="center",
justify_content="center",
flex_direction="column",
margin_left="98em",
),
is_external=True,
href="https://github.com/anirudh-hegde"
),
bg="black",
height="100%",
align_items="center",
justify_content="center",
),
I'm shocked to see the amount of similarity between the two frameworks:
https://github.com/reflex-dev/reflex-chat/blob/main/webui/webui/webui.py
https://github.com/dot-agent/nextpy/blob/main/app-examples/simple_chat/simple_chat/simple_chat.py
App
Class in app.py
for Enhanced Readability and MaintainabilityThe App
class in app.py
is central to our Nextpy application but currently handles an extensive range of functionalities, leading to complexity and potential maintainability issues. This issue aims to refactor App
by effectively leveraging existing modules (admin.py
, event.py
, state.py
) and improving code organization.
App
class is multifaceted, combining numerous functionalities which complicates the codebase.App
class to efficiently utilize admin.py
, event.py
, and state.py
.1. Integration with Existing Modules:
admin.py
, event.py
, and state.py
to offload respective functionalities from App
.App
that are already handled by these modules.2. Streamlining Event Handling:
App
using the structured approach defined in event.py
.App
and the event module for cleaner and more maintainable code.3. State Management Refinement:
state.py
, and modify App
to interact seamlessly with this module.App
.4. Admin Dashboard Integration Enhancement:
setup_admin_dash
) to a dedicated class within admin.py
.App
.5. Code Cleanup and Optimization:
App
.Step 1: Module Integration Review
App
and the modules (admin.py
, event.py
, state.py
), documenting the findings.Step 2: Event Handling Refinement
App
's event handling, aligning and integrating changes with event.py
.Step 3: State Management Enhancement
App
's state management in coordination with modifications in state.py
.Step 4: Admin Dashboard Integration Refinement
App
to admin.py
.Step 5: Code Cleanup and Refactoring
App
, focusing on simplification and optimization.Step 6: Testing and Validation
App
class.This issue aims to significantly enhance the Nextpy framework's app.py
file, focusing on structural improvements and efficient use of existing resources. The end goal is a more maintainable, clear, and efficient codebase that continues to deliver robust functionality.
The issue:
Logging in MultiagentManager currently uses print statements with a conditional variable passed as a parameter "debug" with the default value False. This is a temporary solution.
The solution:
Whenever the conditional variable "debug" is checked, simply store the current logging level in a variable, set current logging to DEBUG, log the statement, then set the logging level back to its original state. This way if a user has previously not set the logging, they do not need to manually do it in their code, they can simply pass "debug"=True. This is also helpful when you have multiple managers but you only want to debug one of them.
Currently, integrating certain Tailwind CSS plugins into Nextpy projects presents a significant challenge. This is primarily due to the limited customization options available within the tailwind.config.js
setup. This limitation hinders the ability to fully exploit the capabilities of the Tailwind CSS ecosystem, consequently restricting design and functionality enhancements in Nextpy projects.
Specific Challenges:
tailwind.config.js
.Suggested Solutions:
Template Customization:
tailwind.config.js.jinja2
) used in Nextpy.Custom Configuration Support:
tailwind.config.js
file.tailwind.css
.Expected Outcome:
Implementing these solutions will significantly improve the ease of integrating diverse Tailwind CSS plugins into Nextpy projects. This enhancement is anticipated to unlock more design and functionality options, aligning Nextpy more closely with the broader Tailwind CSS ecosystem and community practices.
def index() -> xt.Component:
layout = xt.form(xt.vstack(
xt.input(
placeholder="Paste YAML code here",
on_change=State.on_yaml_input_change,
width="30%",
height="300px",
), ),
xt.button("Convert to Python", on_click=State.handle_conversion),
xt.text(State.python_data, font_size="2em"),
spacing="1em",
align_items="center",
justify_content="center",
height="100vh",
)
return layout
when I type inside the input it shows
When I press enter it should go to next line
FROM python:3.8-alpine
WORKDIR /app
COPY Casper.py .
COPY requirements.txt .
RUN pip install -r requirements.txt
CMD["nextpy","init","&&","nextpy","run"]
When I try to build, it shows the error: ERROR: failed to solve: dockerfile parse error on line 7: unknown instruction: CMD["nextpy","run"]
xt.button(
# xt.link("https://github.com/anirudh-hegde", ),
# on_click=lambda : open_github),
xt.image(
src="/github.svg",
height="30px",
width="30px",
padding_right='1px',
target="https://github.com/anirudh-hegde"
),
),
It's time to upgrade Nextpy to Pydantic v2. This migration is crucial to leverage the latest performance improvements and ensure compatibility with other libraries that are also moving to Pydantic v2.
sqlmodel
might have compatibility issues that need to be addressed.ModelField
no longer exists). We need to find suitable alternatives or workarounds for these changes.We invite contributors to join in on this upgrade process. Whether you have experience with Pydantic internals or are new to it, your input and help would be valuable.
sqlmodel
Migrating to Pydantic v2 is an important step for the future of Nextpy. It ensures that our framework stays up-to-date with the latest advancements and continues to integrate smoothly within the broader Python ecosystem.
The current implementation of the GridX portfolio code, while functional and well-tested, presents a level of complexity that may be challenging for beginners to understand. To make the codebase more accessible, especially for those new to programming or the specific technologies used, a simplification is needed.
The goal of this feature request is to integrate SQLSync into the Nextpy framework. SQLSync is a collaborative, offline-first wrapper around SQLite, aimed at synchronizing web application state across various users, devices, and the edge. The integration of SQLSync will enable Nextpy to efficiently manage application state in a distributed environment, enhancing its capabilities in terms of data consistency, offline functionality, and real-time collaboration.
As we optimize our applications by shifting more processing to compile-time, we've observed a significant increase in compilation times. To address this, a potential rewrite of the compiler in Rust or Mojo is proposed, aiming to improve overall performance.
:3000 ERR_CONNECTION_REFUSED.
And I do not know why.
โโโ
Starting Nextpy App
Compiling: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 100% 15/15 0:00:00
Compiling takes time, but the compiled app is super fastโก:
โโโ
We could introduce @xt.method
decorator in Nextpy for defining event handlers within state classes. This feature is intended to enhance code readability, standardize the declaration of methods handling state changes, and align with AI code generation practices.
Currently, Nextpy requires methods within state classes to be defined directly, without specific decorators. This approach is functional but does not distinguish between regular methods and event handlers explicitly designed to modify the state.
The introduction of the @xt.method
decorator would allow developers to clearly mark methods in the state class as event handlers. This not only improves code readability but also aligns with AI code generation patterns, where such decorators are often included by default. It could also facilitate additional framework optimizations or checks.
For example:
@xt.method(ToDoState)
def delete_todo(state, todo):
state.todos.remove(todo)
run
command requires a predefined directory structure for execution.nextpy run
, regardless of the directory structure, similar to tools like Streamlit .1. Command Enhancement:
nextpy run
to primarily accept a file path:
-f
or --file
: Path to the target file (relative or absolute).-t
or --theme
: Optional theme (defaults to standard if not provided).2. Operational Logic:
.mdx
, .py
) and execute accordingly..mdx
files, use the default MDX viewer, or apply the specified theme..py
files, execute the script in an isolated or appropriate environment.3. Environment Independence:
4. Theme Integration and Default Viewer:
Run a File in Any Directory:
$ nextpy run -f /path/to/file.mdx
$ nextpy run -f ./relative/path/to/script.py
With Custom Theme:
$ nextpy run -f /path/to/file.mdx -t bespoke_theme
.any_directory
โโโ executed_file.mdx (or .py, etc.)
โโโ .web (if necessary for execution)
โโโ other_files_or_directories (unrelated to nextpy execution)
nextpy run
command.-f
or --file
) and an optional theme (-t
or --theme
)..mdx
, .py
).run
command in Typer to accept the file path as a primary argument..mdx
files, including using the default MDX viewer or the specified theme..py
files, ensuring they run correctly irrespective of the directory structure.xt.input()
component with a lambda function for handling events (e.g., on_input
).TypeError
related to JSON serialization of the lambda function.pyproject.toml
file to use groups for dependencies (https://python-poetry.org/docs/managing-dependencies/)requirements.txt
once we have a working poetry setupA 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.