You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WRITING stage fails with ImportError: cannot import name 'get_style_files' from nanoresearch.templates #3
The WRITING stage fails during PDF compilation because latex_bib_figures.py imports get_style_files from nanoresearch.templates, but nanoresearch/templates/__init__.py does not define or export that symbol.
Error
ImportError: cannot import name 'get_style_files' from 'nanoresearch.templates' (D:\NanoResearch\nanoresearch\templates\__init__.py)
Stack trace
Traceback (most recent call last):
File "D:\NanoResearch\nanoresearch\pipeline\base_orchestrator.py", line 289, in _run_stage_with_retry
result = await agent.run(**inputs)
File "D:\NanoResearch\nanoresearch\agents\writing\writing_agent.py", line 373, in run
pdf_result = await self._compile_pdf(tex_path, template_format=template_format)
File "D:\NanoResearch\nanoresearch\agents\writing\latex_assembler.py", line 129, in _compile_pdf
self._copy_style_files(template_format)
File "D:\NanoResearch\nanoresearch\agents\writing\latex_bib_figures.py", line 467, in _copy_style_files
from nanoresearch.templates import get_style_files
ImportError: cannot import name 'get_style_files' from 'nanoresearch.templates' (D:\NanoResearch\nanoresearch\templates\__init__.py)
but nanoresearch/templates/__init__.py currently only exposes get_available_formats() and get_template_path().
In the current checkout, there are also no bundled .sty, .cls, or .bst files under nanoresearch/templates/, so the helper may have been removed or never implemented while the writing pipeline still expects it.
Steps to reproduce
Run a research job that reaches the WRITING stage.
Let the pipeline attempt PDF compilation.
The run fails when _copy_style_files() executes.
Expected behavior
The WRITING stage should either:
provide a get_style_files() helper in nanoresearch.templates, or
skip style-file copying when the selected template has no extra style resources.
Environment
Repo: OpenRaiser/NanoResearch
Local checkout commit: b7bdd0afb6d1cfb2fd460a561a8aefcba148d2cb
Root cause:get_style_files() was referenced in latex_bib_figures.py but never implemented in nanoresearch/templates/__init__.py.
Fix: Added get_style_files(format_name) to nanoresearch/templates/__init__.py. It scans the template directory for .sty, .cls, and .bst files and returns them as a list. When no style files are bundled (which is currently the case for all templates), it returns an empty list — so _copy_style_files() becomes a no-op instead of crashing.
Activity
YujunWu03 commentedon Mar 23, 2026
Hi @cqyzc99, thanks for the detailed report!
Root cause:
get_style_files()was referenced inlatex_bib_figures.pybut never implemented innanoresearch/templates/__init__.py.Fix: Added
get_style_files(format_name)tonanoresearch/templates/__init__.py. It scans the template directory for.sty,.cls, and.bstfiles and returns them as a list. When no style files are bundled (which is currently the case for all templates), it returns an empty list — so_copy_style_files()becomes a no-op instead of crashing.Will be pushed to main shortly. Please pull latest and verify. Thanks for catching this!
§3.5 Day 4 S4 cross-section three-way: writing comment injection + re…