Skip to content

Make it possible to access the Weaver as a pure Python import without needing to run a Docassemble server#956

Merged
nonprofittechy merged 7 commits intomainfrom
558-use-as-package
Feb 8, 2026
Merged

Make it possible to access the Weaver as a pure Python import without needing to run a Docassemble server#956
nonprofittechy merged 7 commits intomainfrom
558-use-as-package

Conversation

@nonprofittechy
Copy link
Member

Fix #558

Going to open this as a draft first. This was already helpful for me this week; I used it within Codex to generate some predictable AssemblyLine code as the basis for Codex to then finish up the job. But I want to make sure the API is solid before merging.

A logical next step is to refactor the Python code in various places in the YAML code and invoke the same pathways from the Python module instead, but I think that's best for a separate PR.

Copy link
Contributor

@BryceStevenWilley BryceStevenWilley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only big concern is FieldDefinition getting rid of most of the typing in place for fields.

Comment on lines 3042 to 3049
def _ensure_current_question_package(package_name: str = "ALWeaver") -> None:
try:
current_question = docassemble.base.functions.this_thread.current_question
except Exception:
return
if not current_question:
docassemble.base.functions.this_thread.current_question = type("", (), {})()
docassemble.base.functions.this_thread.current_question.package = package_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just to get around docassemble needing a server to be running? What do we call that ends up using this?

Copy link
Member Author

@nonprofittechy nonprofittechy Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Might be an artifact from the this_thread bug [that I solved better by upgrading to latest AssemblyLine]. I'll look more closely

nonprofittechy and others added 3 commits February 4, 2026 19:47
Co-authored-by: Bryce Willey <bryce.willey@suffolk.edu>
@nonprofittechy nonprofittechy marked this pull request as ready for review February 8, 2026 15:07
@nonprofittechy nonprofittechy merged commit 5d481b8 into main Feb 8, 2026
7 of 8 checks passed
@nonprofittechy nonprofittechy deleted the 558-use-as-package branch February 8, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make a stable API for the weaver that can be invoked by other packages

3 participants