Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

nbdev with fasthtml

未关闭
#1,502 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AnswerDotAI/nbdev 的其他 Issue

查看 AnswerDotAI/nbdev 的全部 Issue

相似的 Issue

更多 DevTools Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。