diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 453b91b..28bdaaf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,33 +14,35 @@ jobs: permissions: contents: write pull-requests: read - + steps: - name: Checkout code uses: actions/checkout@v4 - + with: + fetch-depth: 0 # Need full history for git operations + - name: Validate confirmation run: | if [ "${{ github.event.inputs.confirm }}" != "publish" ]; then echo "โŒ Must type 'publish' to confirm release" exit 1 fi - + - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' - + python-version: "3.10" + - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install requests build twine toml - + python -m pip install --upgrade uv twine toml requests + - name: Configure Git run: | git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" - + - name: Run release script env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index b1e96ac..25ab5e7 100644 --- a/Makefile +++ b/Makefile @@ -97,6 +97,22 @@ test: ensure-pytest $(PYTHON) -m pytest # โœ… Tests completed + +# Run uv build and check dist sizes for optimized user installs +.PHONE: build +build: + rm -rf dist/mflux-* + # fresh build + uv build + # check the artifact sizes - we expect < 1MB + du -sh dist/* + # create a temp directory for extraction + # then find/list the largest 5 files - we should not see image artifacts + @TEMP_DIR=$$(mktemp -d -t mflux-dist) && \ + mkdir -p "$$TEMP_DIR/this-build" && \ + tar -xzf dist/mflux-*.tar.gz -C "$$TEMP_DIR/this-build" && \ + find "$$TEMP_DIR/this-build" -type f -exec du -h {} \; | sort -rh | head -n 5 + # Clean up .PHONY: clean clean: diff --git a/pyproject.toml b/pyproject.toml index b235cee..bbd5eb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,21 @@ [build-system] -requires = ["setuptools>=42", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["uv_build>=0.7.19,<0.8.0"] +build-backend = "uv_build" + +[tool.uv.build-backend] +default-excludes = true # __pycache__, *.pyc, and *.pyo +source-exclude = [ + # documentation assets were 27MB on 2025-07-05 + "**/assets/**", + # dreambooth examples ~=5MB on 2025-07-05 + "**/dreambooth/_example/images/**", + # loss pdf/tex does not need to be distributed + "**/optimization/_loss_derivation/**", +] [project] name = "mflux" -version = "0.9.1" +version = "0.9.2" description = "A MLX port of FLUX based on the Huggingface Diffusers implementation." readme = "README.md" keywords = ["diffusers", "flux", "mlx"] @@ -74,9 +85,6 @@ mflux-upscale = "mflux.upscale:main" mflux-lora-library = "mflux.lora_library:main" mflux-completions = "mflux.completions.install:main" -[tool.setuptools.packages.find] -where = ["src"] -include = ["mflux*"] [tool.ruff] line-length = 120 diff --git a/scripts/release.py b/scripts/release.py index 25e458c..c1e2a9f 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -175,12 +175,6 @@ class ReleaseManager: return result def build_package(self): - # Install build dependencies - self.run_command( - [sys.executable, "-m", "pip", "install", "--upgrade", "pip", "build", "twine"], - "Installing build dependencies", - ) - # Clean dist directory to ensure fresh build import shutil @@ -190,7 +184,8 @@ class ReleaseManager: print("๐Ÿงน Cleaned dist/ directory") # Build the package - self.run_command([sys.executable, "-m", "build"], "Building package") + self.run_command([sys.executable, "-m", "uv", "--version"], "Verify 'uv build' version") + self.run_command([sys.executable, "-m", "uv", "build"], "Building package with 'uv build'") def verify_package(self): """Run *twine check* to verify that README / long_description renders on PyPI."""