Skip to content

Instantly share code, notes, and snippets.

View EmbraceLife's full-sized avatar
🎯
FastHTML 3rd week

深度碎片 EmbraceLife

🎯
FastHTML 3rd week
View GitHub Profile

Let's explore these two approaches together.

You: The first approach is to learn how to use the library effectively without diving into the source code. You’d focus on mastering the API, understanding how to combine functions and classes, and getting your web app up and running quickly. The goal is to have a working product as soon as possible. What’s wrong with that?

Me: Nothing inherently wrong, but let’s think about what you might miss out on. By not understanding the source code, you’re relying entirely on the documentation and examples. What happens if you hit a limitation or a bug in the library? How would you troubleshoot or extend the library to meet your needs if you don’t understand its inner workings?

You: That’s a valid point, but in practice, I can get a lot done without needing to understand the source code. If I hit a limitation, I could always look into the source code then or even seek help from the community or maintainers. Why should I spend time understanding the entire code

import ast
import re
from pathlib import Path
from inspect import signature
from fastcore.utils import *
from fastcore.meta import delegates
def _get_tree(mod):
return parse(getsource(mod))
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/07_meta.ipynb.
# %% auto 0
__all__ = ['test_sig', 'FixSigMeta', 'PrePostInitMeta', 'AutoInit', 'NewChkMeta', 'BypassNewMeta', 'empty2none', 'anno_dict',
'use_kwargs_dict', 'use_kwargs', 'delegates', 'method', 'funcs_kwargs']
# %% ../nbs/07_meta.ipynb
from .imports import *
from .test import *
from contextlib import contextmanager
You are an expert in understanding and explaining the source code of the py2pyi module from the fastcore library. You excel at solving problems by adding new functions or adjusting existing classes or functions within the library. Your role is to guide a user who is new to the fastcore library and unfamiliar with the py2pyi module.
When presented with a problem, please follow these steps:
1. Adopt a beginner's perspective:
- Start by clearly defining the problem in simple terms, as if explaining to someone with no prior knowledge.
- Explain the goal of the solution and why it's important.
- Identify and describe the main difficulties that prevent beginners from easily solving the problem.
- Use analogies or real-world examples to make complex concepts more relatable.
INFO: ('127.0.0.1', 57277) - "WebSocket /live-reload" [accepted]
INFO: connection open
INFO: 127.0.0.1:57273 - "GET /toggle/3 HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Users/Natsume/mambaforge/envs/fasthtml/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Natsume/mambaforge/envs/fasthtml/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
return await self.app(scope, receive, send)

Web Application: what does it take

What it is like before fasthtml

Front-end Development

Programming Languages:

  • HTML: Structures web pages.
  • CSS: Styles web pages.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EmbraceLife
EmbraceLife / setup_conda.sh
Created May 15, 2022 04:49
The final step to get mamba ready: init the mamba
#!/usr/bin/env bash
set -eou pipefail
# case "$OSTYPE" in
# darwin*)
# case $(uname -m) in
# arm64) DOWNLOAD=https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-arm64.sh; ;;
# *) DOWNLOAD=https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-x86_64.sh; ;;
# esac ;;
# linux*) DOWNLOAD=https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh; ;;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>d3-selection</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
@EmbraceLife
EmbraceLife / d3-selection.md
Last active November 16, 2019 07:52
d3-selection
<title>d3-selection</title>