Skip to content

Commit

Permalink
0.2.13, switch from setuptools to hatchling (#321)
Browse files Browse the repository at this point in the history
* setuptools => hatchling

* Exclude client source from published package

* Bump to 0.2.13
  • Loading branch information
brentyi authored Nov 8, 2024
1 parent 09292f0 commit 4ba52b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ jobs:
sed -i '/<!-- pypi-strip -->/,/<!-- \/pypi-strip -->/d' README.md
- name: Only bundle client build for PyPI release
run: |
# This sed command finds the line that immediately follows
# [tool.setuptools.package-data], then replaces instances of
# `client/**/*` with `client/build/**/*`.
sed -i=bak '/\[tool\.setuptools\.package-data\]/{n;s/"client\/\*\*\/\*"/"client\/build\/\*\*\/\*"/g;}' pyproject.toml
# This sed commands removes `, "client/**/.*"` from the package-data.
sed -i=bak '/\[tool\.setuptools\.package-data\]/{n;s/, "client\/\*\*\/\.\*"//g;}' pyproject.toml
# This should delete everything in src/viser/client except for the
# build folder.
mv src/viser/client/build ./__built_client
rm -rf src/viser/client/*
mv ./__built_client src/viser/client/build
- name: Build and publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
34 changes: 8 additions & 26 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build]
packages = ["src/viser"]
# .nodeenv can't be copied/moved without causing errors.
exclude = ["src/viser/client/.nodeenv", "src/viser/client/node_modules"]

[project]
name = "viser"
version = "0.2.12"
version = "0.2.13"
description = "3D visualization + Python"
readme = "README.md"
license = { text="MIT" }
Expand Down Expand Up @@ -57,29 +62,6 @@ examples = [
[project.urls]
"GitHub" = "https://github.com/nerfstudio-project/viser"

# <>
# Important: in the ./.github/workflows/publish.yml action, we have sed
# commands that assume the `viser = ...` line below directly follows
# `[tool.setuptools.package-data]`. We use this to remove the client source
# from PyPI builds.
#
# We should make sure that any modifications to the package-data list remain
# compatible with the sed commands!
#
# We keep the client source in by default to support things like pip
# installation via the Git URL, because build artifacts aren't
# version-controlled.
[tool.setuptools.package-data]
viser = ["py.typed", "*.pyi", "_icons/tabler-icons.zip", "client/**/*", "client/**/.*"]
# </>

[tool.setuptools.exclude-package-data]
# We exclude node_modules to prevent long build times for wheels when
# installing from source, eg via `pip install .`.
#
# https://github.com/nerfstudio-project/viser/issues/271
viser = ["**/node_modules/**"]

[project.scripts]
viser-dev-checks = "viser.scripts.dev_checks:entrypoint"

Expand Down

0 comments on commit 4ba52b4

Please sign in to comment.