Skip to content

Conversation

@allenwang28
Copy link
Contributor

Summary:
Migrates Monarch to use uv and rely more on pyproject.toml.

  • Migrate static package metadata from setup.py to pyproject.toml
  • Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
    • Note, for some reason uv does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
    • Users can install with PyTorch nightly via: $ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128
  • Make torch optional with auto-detection and graceful degradation when not available
    • We need this because uv will first run setup.py to identify any dependencies etc., but fails if torch isn't installed. uv will then install torch in a secondary pass, then finally run the setup.py script.
    • This also allows us to avoid needing to build with --no-build-isolation.
  • Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
  • Create separate monarch_hyperactor_bin crate to isolate binaries from extension-module feature.
    • Without this, monarch_hyperactor would always build as "python-embed" mode, when it itself is technically a python-extension.
  • add a uv.lock file which ...
  • Adds a .python-version so uv would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

Differential Revision: D89229505

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 16, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 16, 2025

@allenwang28 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D89229505.

allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

TODO:
- will need to remove some of the requirements.txt after we make sure that the CI is working

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

TODO:
- will need to remove some of the requirements.txt after we make sure that the CI is working

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

TODO:
- will need to remove some of the requirements.txt after we make sure that the CI is working

Differential Revision: D89229505
allenwang28 added a commit to allenwang28/monarch-1 that referenced this pull request Dec 16, 2025
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

TODO:
- will need to remove some of the requirements.txt after we make sure that the CI is working

Differential Revision: D89229505
Summary:
Pull Request resolved: meta-pytorch#2148

Migrates Monarch to use `uv` and rely more on `pyproject.toml`.

- Migrate static package metadata from setup.py to pyproject.toml
- Add uv-specific configuration for PyTorch stable builds with multiple CUDA versions (cu128, cu124, cu121, cpu)
  - Note, for some reason `uv` does not play nicely with PyTorch nightly so we pin it to stable. Logs: P2082930246. Haven't looked into this yet.
  - Users can install with PyTorch nightly via: `$ uv sync --extra tensor --extra-index-url https://download.pytorch.org/whl/nightly/cu128`
- Make torch optional with auto-detection and graceful degradation when not available
  - We need this because `uv` will first run `setup.py` to identify any dependencies etc., but fails if torch isn't installed. `uv` will then install torch in a secondary pass, then finally run the setup.py script.
  - This also allows us to avoid needing to build with `--no-build-isolation`.
- Use PyO3's extension-module feature liberally to avoid libpython linking issues in Python extensions
- Create separate `monarch_hyperactor_bin` crate to isolate binaries from `extension-module` feature.
  - Without this, `monarch_hyperactor` would always build as "`python-embed`" mode, when it itself is technically a `python-extension`.
- add a uv.lock file which ...
- Adds a .python-version so `uv` would default to Python 3.12. Without it it defaults to Python 3.10 because we support >=3.10 but this modernizes a bit more.

TODO:
- will need to remove some of the requirements.txt after we make sure that the CI is working

Differential Revision: D89229505
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant