Skip to content

Commit ab2913b

Browse files
QwlouseHackable Diffusion Authors
authored andcommitted
GitHub Actions workflow, and modernize hackable_diffusion build: replace requirements.txt with pyproject.toml
PiperOrigin-RevId: 890419375
1 parent 533e92c commit ab2913b

File tree

4 files changed

+129
-40
lines changed

4 files changed

+129
-40
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Unittests & Auto-publish
2+
3+
# Allow to trigger the workflow manually (e.g. when deps changes)
4+
on: [push, workflow_dispatch]
5+
6+
jobs:
7+
pytest-job:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
python-version: ['3.13']
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}
17+
cancel-in-progress: true
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
# Install deps
23+
- uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- run: pip --version
27+
- run: pip install --no-cache-dir -e .[dev]
28+
- run: pip freeze
29+
30+
# Run tests
31+
- name: Run core tests
32+
run: pytest -vv -n auto
33+
34+
# TODO(klausg): Add publish job to push to PyPI later

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,16 @@ The `notebooks/` directory contains several tutorials to get you started:
2525
## Installation
2626

2727
To install the necessary dependencies, you can use pip with the provided
28-
`requirements.txt` file:
28+
`pyproject.toml` file:
2929

3030
```bash
31-
pip install -r requirements.txt
31+
pip install -e .
32+
```
33+
34+
To install development dependencies (for running tests), use:
35+
36+
```bash
37+
pip install -e .[dev]
3238
```
3339

3440
This will install libraries such as JAX, Flax, and other utilities required to

pyproject.toml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[project]
2+
name = "hackable_diffusion"
3+
description = "Hackable Diffusion is a library for custom diffusion models."
4+
readme = "README.md"
5+
requires-python = ">=3.13"
6+
license = {file = "LICENSE"}
7+
authors = [{name = "hackable_diffusion authors"}]
8+
classifiers = [
9+
"Programming Language :: Python :: 3",
10+
"Programming Language :: Python :: 3 :: Only",
11+
"License :: OSI Approved :: Apache Software License",
12+
"Intended Audience :: Science/Research",
13+
]
14+
keywords = []
15+
16+
# pip dependencies of the project
17+
dependencies = [
18+
"absl-py",
19+
"aiofiles",
20+
"chex",
21+
"einops",
22+
"etils",
23+
"flax",
24+
"fsspec",
25+
"humanize",
26+
"immutabledict",
27+
"importlib_resources",
28+
"jax",
29+
"jaxtyping",
30+
"markdown-it-py",
31+
"mdurl",
32+
"ml_dtypes",
33+
"mock",
34+
"msgpack",
35+
"nest-asyncio",
36+
"numpy",
37+
"opt_einsum",
38+
"optax",
39+
"orbax-checkpoint",
40+
"protobuf",
41+
"psutil",
42+
"pygments",
43+
"pyyaml",
44+
"rich",
45+
"scipy",
46+
"simplejson",
47+
"tensorstore",
48+
"toolz",
49+
"treescope",
50+
"typeguard",
51+
"typing_extensions",
52+
"wadler_lindig",
53+
"zipp",
54+
"kauldron>=1.4.1",
55+
]
56+
57+
# This is set automatically by flit using `hackable_diffusion.__version__`
58+
dynamic = ["version"]
59+
60+
[project.urls]
61+
homepage = "https://github.com/google-research/hackable_diffusion"
62+
repository = "https://github.com/google-research/hackable_diffusion"
63+
64+
[project.optional-dependencies]
65+
# Development deps (unittest, linting, formating,...)
66+
dev = [
67+
"pytest",
68+
"pytest-xdist",
69+
"hypothesis==6.80.0",
70+
"pylint>=2.6.0",
71+
"pyink",
72+
]
73+
74+
[build-system]
75+
requires = ["flit_core >=3.8,<4"]
76+
build-backend = "flit_core.buildapi"
77+
78+
[tool.pyink]
79+
line-length = 80
80+
preview = true
81+
pyink-indentation = 2
82+
pyink-use-majority-quotes = true
83+
84+
[tool.flit.sdist]
85+
exclude = [
86+
"**/*_test.py",
87+
]

requirements.txt

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)