Skip to content

Conversation

@bobleesj
Copy link
Collaborator

@bobleesj bobleesj commented Jan 11, 2026

What this PR does

Closes #105

Please see the comment #105 (comment) on suggested mono folder structure and benefits

  quantem/
  ├── pyproject.toml         # Depends on quantem-widget
  ├── src/quantem/           # Main package
  ├── widget/                # Separate PyPI package
  │   ├── pyproject.toml
  │   ├── package.json
  │   ├── js/               
  │   └── src/quantem/widget/
  └── .github/workflows/
      ├── deploy.yml         # Main → PyPI (v0.1.7)
      └── deploy-widget.yml  # Widget → PyPI (v0.0.1)

Core quantem dev experience:

Case 1. I'm not a widget developer:

$ uv sync
$ uv run python -c "from quantem.widget import show4dstem"
  ModuleNotFoundError: No module named 'quantem.widget'

Case 2. I'm a widget developer:

$ uv sync --all-packages
$ cd widget
$ npm install
$ npm run dev

Start developing:

154dc330-67a3-4bbf-a2be-4a54fde167d5

What PR reviewer(s) should do

Please review the PR and merge.

  • Documentation (e.g., tutorials, examples, README) has been updated.

I will add subsequent PRs adding the widgets (react code and GitHub CI next).

Notebook:

widget_demo.ipynb

Copy link
Collaborator Author

@bobleesj bobleesj left a comment

Choose a reason for hiding this comment

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

@gvarnavi this is ready for review.

@gvarnavi gvarnavi marked this pull request as draft January 11, 2026 08:32
@gvarnavi
Copy link
Collaborator

gvarnavi commented Jan 11, 2026

Thanks @bobleesj -- this looks good! Reviewed and checked uv workspace works well.

However, this doesn't answer the question of whether it solves our js/python bundling issues just yet. It'd be good to add a minimal working react widget to test before we merge this.

@bobleesj bobleesj marked this pull request as ready for review January 11, 2026 21:00
@bobleesj
Copy link
Collaborator Author

@gvarnavi ready for review - PR comment above updated

Copy link
Collaborator

@gvarnavi gvarnavi left a comment

Choose a reason for hiding this comment

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

Nice, very clean framework! Left some minor comments for future-proofing.

Comment on lines 16 to 17
packages = ["src/quantem"]
artifacts = ["src/quantem/widget/static/*"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't these be?

packages = ["src/quantem/widget"]
artifacts = ["src/quantem/widget/static/**"]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For namespace package, packages = ["src/quantem"], this is correct. I've tested using Test PyPI:

mamba create -n qt-widget-env python=3.12
mamba activate qt-widget-env
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ quantem.widget
Screenshot 2026-01-12 at 7 26 19 AM

Ref: https://test.pypi.org/project/quantem.widget/

And yes, added ** under artifacts.

Copy link
Collaborator Author

@bobleesj bobleesj left a comment

Choose a reason for hiding this comment

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

@gvarnavi Thanks George for the very detailed review. Please see the main commit made here: 8c9206d and it's working after I've uplaoded against that of TestPyPI: https://test.pypi.org/project/quantem.widget/

Comment on lines 16 to 17
packages = ["src/quantem"]
artifacts = ["src/quantem/widget/static/*"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For namespace package, packages = ["src/quantem"], this is correct. I've tested using Test PyPI:

mamba create -n qt-widget-env python=3.12
mamba activate qt-widget-env
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ quantem.widget
Screenshot 2026-01-12 at 7 26 19 AM

Ref: https://test.pypi.org/project/quantem.widget/

And yes, added ** under artifacts.

@gvarnavi
Copy link
Collaborator

Great, thanks!

The only remaining thing is to automate the PyPi deployment using the stored PYPI_TOKEN. It's not immediately obvious to me how best to do that, since our current workflows are all branch-based, but we could maybe figure this out with the first release.

@bobleesj
Copy link
Collaborator Author

@gvarnavi yeah, I think once we have some useful features in the widget, we can start thinking of deployment things more in details. Created an issue above just to track things and re-visit later.

@gvarnavi gvarnavi merged commit 64c4b46 into electronmicroscopy:dev Jan 12, 2026
4 checks passed
@bobleesj bobleesj deleted the quantem.widget branch January 12, 2026 15:54
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.

discussion: whether to add "Widget" module in quantem

2 participants