Skip to content

Commit

Permalink
feat: add a package without CLI (#25)
Browse files Browse the repository at this point in the history
Fix #23.

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Apr 26, 2024
1 parent 6354cd7 commit 3f5b8f9
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
1 change: 1 addition & 0 deletions cmd/README.md
31 changes: 31 additions & 0 deletions cmd/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"},
]
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 = ".."
12 changes: 12 additions & 0 deletions cmd/setup.py
Original file line number Diff line number Diff line change
@@ -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}",
],
)
10 changes: 3 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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"
Expand All @@ -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"

0 comments on commit 3f5b8f9

Please sign in to comment.