Skip to content

Commit

Permalink
setup pypi ci/cd (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Duanyll authored Dec 15, 2024
1 parent ba619aa commit 1ce6239
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 8 deletions.
117 changes: 117 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/rectified-flow # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/rectified-flow

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

<img src="assets/logo_new2.png" alt="Logo" style="width: 75%; height: auto;">
<img src="https://github.com/lqiang67/rectified-flow/blob/main/assets/logo_new2.png?raw=true" alt="Logo" style="width: 75%; height: auto;">

[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Blog](https://img.shields.io/badge/blog-blue)](https://rectifiedflow.github.io)
Expand All @@ -9,7 +9,7 @@

______________________________________________________________________

<img src="assets/header.png" alt="Header" style="width: 100%; height: auto;">
<img src="https://github.com/lqiang67/rectified-flow/blob/main/assets/header.png?raw=true" alt="Header" style="width: 100%; height: auto;">
</div>


Expand Down Expand Up @@ -50,8 +50,13 @@ Whether you are a researcher exploring the frontiers of generative modeling, a s

# Installation

Please run the following commands in the given order to install the dependency.
You can install the `rectified-flow` package using `pip`:

```
pip install rectified-flow
```

Alternatively, you can install the package from source. Please run the following commands in the given order to install the dependency.

```
conda create -n rf python=3.10
Expand Down
4 changes: 3 additions & 1 deletion rectified_flow/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
name = "rectified_flow"
name = "rectified_flow"

from .rectified_flow import RectifiedFlow
8 changes: 6 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Please update setup.py when modifying this file

accelerate>=1.2.0
clip==0.2.0
clip@https://github.com/openai/CLIP/tarball/master#egg=clip-1.0.0
diffusers>=0.31.0
matplotlib==3.9.3
matplotlib>=3.9.3
numpy
packaging
Pillow
Expand All @@ -13,3 +15,5 @@ timm>=1.0.12
torch>=2.5.0
torchvision>=0.20.0
tqdm
ipykernel
nbformat>=4.2.0
21 changes: 19 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

setup(
name="rectified-flow",
version="0.1.0",
version="1.0.1",
description="A PyTorch implementation of Rectified Flow and its variants.",
long_description=long_description,
long_description_content_type="text/markdown",
author="Qiang Liu, Runlong Liao, Bo Liu, Xixi Hu",
author_email="[email protected]",
author_email="[email protected]",
url="https://github.com/lqiang67/rectified-flow",
packages=find_packages(),
python_requires=">=3.10",
Expand All @@ -20,4 +20,21 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
install_requires=[
"accelerate>=1.2.0",
"openai-clip==1.0.1",
"diffusers>=0.31.0",
"matplotlib>=3.9.3",
"numpy",
"packaging",
"Pillow",
"plotly",
"scikit_learn",
"scipy",
"sympy",
"timm>=1.0.12",
"torch>=2.5.0",
"torchvision>=0.20.0",
"tqdm"
]
)

0 comments on commit 1ce6239

Please sign in to comment.