Skip to content

Commit

Permalink
feat: README
Browse files Browse the repository at this point in the history
  • Loading branch information
nikirg committed Oct 25, 2024
1 parent 89c8fba commit 5a1f726
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

**LazyFast** is a lightweight Python library for building modern, component-based web interfaces using FastAPI. It handles server-side logic in Python, with interactive elements like inputs and buttons triggering server-side component reloads for dynamic state updates.

<p align="center">
<img src="img/todo_list.gif" alt="todo_list" width="49%" style="display:inline-block;">
<img src="img/live_search.gif" alt="live_search" width="49%" style="display:inline-block;">
</p>


**Ideal for Python developers who:**
- Have basic HTML and CSS knowledge and want to build web interfaces without learning complex frontend frameworks like React, Angular, or Vue.

Expand All @@ -32,6 +38,10 @@
5. **State Management**
- Use a state manager to trigger component reloads for a reactive user experience.

<p align="center">
<img src="img/user_form.gif" alt="todo_list" width="60%" style="display:inline-block;">
</p>

## Installation

To install LazyFast, use pip:
Expand Down
2 changes: 1 addition & 1 deletion examples/live_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def head_renderer():

@router.page("/", head_renderer=head_renderer)
def root():
with tags.div(class_="container mt-6"):
with tags.div(class_="container mt-6 px-3"):
LiveSearch()


Expand Down
5 changes: 3 additions & 2 deletions examples/user_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ async def view(self, users: list[User] = Depends(get_user_by_group)):
with tags.tr():
tags.th("ID")
tags.th("Name")
tags.th("Group")

with tags.tbody():
for user in users:
with tags.tr():
tags.td(user.id)
tags.td(user.name)

tags.td(user.group)

@router.component(id="Demo")
class Demo(Component):
Expand Down Expand Up @@ -151,7 +152,7 @@ def head_renderer():

@router.page("/", head_renderer=head_renderer)
async def root():
with tags.div(class_="container mt-6"):
with tags.div(class_="container mt-6 px-3"):
with tags.div(class_="grid"):
with tags.div(class_="cell"):
with tags.div(class_="box"):
Expand Down
Binary file added img/live_search.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/todo_list.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/user_form.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions lazyfast/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,10 @@ def print_in_frame(text: str):
if response.status == 200:
data = json.loads(response.read())
pypi_version = data["info"]["version"]
github_repo = data["info"]["home_page"]

if pypi_version == current_version:
if pypi_version != current_version:
print_in_frame(
f"Welcome to {name} {current_version} | Version is up to date | {github_repo}"
f"LazyFast | new version available: ({current_version} -> {pypi_version})."
)
else:
print_in_frame(
f"Welcome to {name} {current_version} | Update available: {pypi_version} | {github_repo}"
)


check_library_version()

0 comments on commit 5a1f726

Please sign in to comment.