Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Python caches
__pycache__/
*.py[cod]
.pytest_cache

# Lighthouse Python module builds
dist/
python/lighthouse*.egg-info/
*.whl
53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ The planned work is:
## Getting up and running

For the time being, `lighthouse` depends on just the Python bindings for [`mlir`](https://github.com/llvm/eudsl/releases).
To install this dependency, obtain the [`uv`](https://docs.astral.sh/uv/getting-started/installation/#pypi) Python package manager and run the following in the root of the project:
To install this dependency along with `lighthouse` python package, obtain the [`uv`](https://docs.astral.sh/uv/getting-started/installation/#pypi) Python package manager and run the following in the root of the project:
```
$ uv venv # Create a .venv virtualenv
$ uv sync # Install the `mlir-python-bindings` dependency into the virtualenv
$ uv sync # Install the `mlir-python-bindings` and `lighthouse` into the virtualenv
$ uv sync --extra ingress-torch-cpu # Optionally install the dependencies for torch ingress
```

Expand All @@ -68,3 +68,52 @@ For vendor-specific versions of `torch` use the targets `ingress-torch-nvidia`,
</details>

To run the Python programs in this repo, either enter the virtual environment (`$ source .venv/bin/activate`) and execute a program _or_ execute each of the programs through `uv` (i.e. `$ uv run $EXE`), which will automatically run them inside the virtualenv.

## Installing Lighthouse as a Python package

You can install `lighthouse` as a Python package using `uv` or `pip`:

#### Installing via `uv`

If you've run the steps from the [Getting up and running](#getting-up-and-running) section,
you already have `lighthouse` installed in your virtual environment:

```
$ uv run python
Python 3.12.11 | (main, Jun 4 2025, 14:45:31) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lighthouse
>>> lighthouse.__version__
'0.1.0a1'
```

If you don't want to use the virtual environment created by `uv`, you can skip `uv venv; uv sync` steps and install Lighthouse in your current environment using:

```
$ source ../my_custom_venv/bin/activate # or conda activate my-venv
(my-venv) $ uv pip install . # installs Lighthouse along with its basic dependencies
(my-venv) $ uv pip install .[ingress_torch_cpu] # installs Lighthouse along with its torch-ingress dependencies
```

#### Installing via `pip`

If you don't want to use `uv` to install the package, you can install it directly with `pip`.
You'll need to specify the custom sources so `pip` can find all required dependencies (e.g., mlir-bindings). The sources are listed in the `pyproject.toml` file.

Here are some common installation examples:

1. Install Lighthouse only
```
pip install . \
--find-links https://llvm.github.io/eudsl/ \
--only-binary :all:
```

2. Install Lighthouse and torch-ingress dependencies
```
pip install .[ingress_torch_cpu] \
--find-links https://llvm.github.io/eudsl/ \
--find-links https://github.com/llvm/torch-mlir-release/releases/expanded_assets/dev-wheels \
--extra-index-url https://download.pytorch.org/whl \
--only-binary :all:
```
13 changes: 12 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "lighthouse"
version = "0.1.0a1"
dynamic = ["version"]
requires-python = ">=3.10,<3.13" # Bounds are due to torch-mlir's packaging
dependencies = [
"mlir-python-bindings==20251011+3af43e303",
Expand Down Expand Up @@ -62,3 +62,14 @@ explicit = true
name = "torch_mlir"
url = "https://github.com/llvm/torch-mlir-release/releases/expanded_assets/dev-wheels"
explicit = true

[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
where = ["python"]
include = ["lighthouse*"]

[tool.setuptools.dynamic]
version = {attr = "lighthouse.__version__"}
1 change: 1 addition & 0 deletions python/lighthouse/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.1.0a1"