diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 642d5bb2..36148780 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,12 +29,11 @@ jobs: sed -i '//,//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 }} diff --git a/pyproject.toml b/pyproject.toml index 3acbaedf..3463796c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" } @@ -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"