nbdev with fasthtml
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 30/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- jupyter, jupyter-notebook, python
调研方向
首先使用 component.py 和 uv run python -m hao.component 命令复现报告中的行为,然后比较 Jupyter、导出的包和 nbdev_docs 中的路径解析。检查 static-file 示例和 nbdev_docs 的导入行为;当受支持的 fasthtml 工作流和 static-file 路径规则已记录,或兼容性差距已明确识别时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Should there be a way to use nbdev to develop a package that uses fasthtml?
I'm trying to port the fasthtml 3d-component example to run in nbdev to understand the framework but getting stuck on paths and importers
This is related to my bigger issue which is I can't figure out how to reference static files so that they resolve in Jupyter, exported python package and docs.
I can resolve Jupyter and exported python package, using the following to use .parent in the exported python file and .cwd in Jupyter but can't find any docs on how to rewrite file_path to support nbdev_docs (which crashes not being able to resolve this file).
try:
file_path = Path(__file__).parent/f"../nbs/static/data/csv/Mandarin vocab lists - hsk{config['hsk_level']}.csv"
except NameError:
file_path = Path.cwd()/f"static/data/csv/Mandarin vocab lists - hsk{config['hsk_level']}.csv"
vocab = pd.read_csv(file_path)
I'm suspecting that nbdev & fasthtml (or any ASGI service) aren't compatible because I can happily run exported files in my editable package
python -m hao.flashcards
but the ported 3d-components one (renamed https://github.com/AnswerDotAI/fasthtml-example/blob/main/3d-component/main.py to component.py) will start and then complain about the module as below
$ uv run python -m hao.component
Link: http://localhost:5001
INFO: Will watch for changes in these directories: ['/home/XXX/src/hao']
INFO: Uvicorn running on http://0.0.0.0:5001 (Press CTRL+C to quit)
INFO: Started reloader process [10395] using WatchFiles
ERROR: Error loading ASGI app. Could not import module "component".
Any advice?
- 主要语言
- Jupyter Notebook
- 星标
- 5.3k
- 派生
- 514
- 平均合并
- 2 天 30 分钟
- 30 天内合并 PR
- 8
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AnswerDotAI/nbdev 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
AnswerDotAI/nbdev#1596 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
AnswerDotAI/nbdev#1587 ·
-
难度 4/5 3-5 天 新手友好度 35/100
AnswerDotAI/nbdev#1584 ·
-
难度 3/5 1-2 天 新手友好度 35/100
AnswerDotAI/nbdev#1583 · 1 条评论 · 1 个 reaction ·
-
bug
难度 3/5 1-2 天 新手友好度 52/100
AnswerDotAI/nbdev#1581 ·
查看 AnswerDotAI/nbdev 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
danielmiessler/LifeOS#2242 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
-
module-request
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
testplan-item
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复