diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 253e0ff..92c885f 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -58,11 +58,16 @@ jobs: - run: python -m pip install build - name: Build sdist run: pipx run build --sdist + - name: Build sdist for cmd + run: cd cmd && pipx run build - uses: actions/upload-artifact@v4 with: name: cibw-sdist path: dist/*.tar.gz - + - uses: actions/upload-artifact@v4 + with: + name: cibw-cmd + path: cmd/dist/* upload_pypi: needs: [build_wheels, build_sdist] runs-on: ubuntu-latest diff --git a/README.md b/README.md index ce32373..3e89b64 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,12 @@ pip install nodejs-wheel ``` +If you don't need command line interface (CLI), install only `nodejs-wheel-binaries`, which is a direct dependency of `nodejs-wheel`. + +```sh +pip install nodejs-wheel-binaries +``` + The package requires Python 3.7 and above. The project is powered by [scikit-build-core](https://github.com/scikit-build/scikit-build-core) and [cibuildwheel](https://github.com/pypa/cibuildwheel). diff --git a/cmd/README.md b/cmd/README.md new file mode 120000 index 0000000..32d46ee --- /dev/null +++ b/cmd/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/cmd/pyproject.toml b/cmd/pyproject.toml new file mode 100644 index 0000000..1188d50 --- /dev/null +++ b/cmd/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["setuptools", "setuptools_scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "nodejs-wheel" +dynamic = ["version", "dependencies"] +description = "unoffical Node.js package" +authors = [ + {name = "Jinzhe Zeng", email = "jinzhe.zeng@rutgers.edu"}, +] +license = {file = "LICENSE"} +classifiers = [ + "Programming Language :: Python :: 3", + "Development Status :: 5 - Production/Stable", + "Environment :: Console", +] +requires-python = ">=3.7" +readme = "README.md" +keywords = ["nodejs"] + +[project.urls] +repository = "https://github.com/njzjz/nodejs-wheel" + +[project.scripts] +node = "nodejs_wheel.executable:node" +npm = "nodejs_wheel.executable:npm" +npx = "nodejs_wheel.executable:npx" + +[tool.setuptools_scm] +root = ".." diff --git a/cmd/setup.py b/cmd/setup.py new file mode 100644 index 0000000..e8e15b1 --- /dev/null +++ b/cmd/setup.py @@ -0,0 +1,12 @@ +from setuptools import setup +from setuptools_scm import Configuration, _get_version + +config = Configuration.from_file("pyproject.toml") +version = _get_version(config) +assert version is not None + +setup( + install_requires=[ + f"nodejs-wheel=={version}", + ], +) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 56c5358..0885bb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["scikit-build-core>=0.3.0"] build-backend = "scikit_build_core.build" [project] -name = "nodejs-wheel" +name = "nodejs-wheel-binaries" dynamic = ["version"] description = "unoffical Node.js package" authors = [ @@ -24,11 +24,6 @@ keywords = ["nodejs"] [project.urls] repository = "https://github.com/njzjz/nodejs-wheel" -[project.scripts] -node = "nodejs_wheel.executable:node" -npm = "nodejs_wheel.executable:npm" -npx = "nodejs_wheel.executable:npx" - [tool.scikit-build] wheel.install-dir = "nodejs_wheel" wheel.py-api = "py2.py3" @@ -44,5 +39,6 @@ metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" [tool.cibuildwheel] build = ["cp311-*"] skip = ["*-win32", "*-manylinux_i686", "*-musllinux*"] -build-verbosity = "1" +build-verbosity = 1 +before-test = ["pip install --no-deps cmd/"] test-command = "node -h && npm --version && npx --version"