This guide explains how to publish Claw Wallet packages to npm and PyPI.
- Create an npm account at npmjs.com
- Enable 2FA on your npm account for security
- Verify your email address
- Create a PyPI account at pypi.org
- Create an API token at pypi.org/manage/account/token/
- Save the token securely - you'll only see it once!
cd claw-wallet/agent-wallet-service
npm loginYou'll be prompted for:
- Username
- Password
- OTP (if 2FA is enabled)
# Check what will be published
npm pack --dry-run
# This shows all files that will be includednpm test# For public packages
npm publish --access public
# For scoped packages (if using @claw-wallet/sdk)
npm publishnpm view claw-wallet-sdkcd claw-wallet/agent-wallet-service-python
pip install build twinepython -m buildThis creates:
dist/claw_wallet-0.2.0.tar.gz(source distribution)dist/claw_wallet-0.2.0-py3-none-any.whl(wheel)
twine check dist/*First time (using token):
twine upload dist/*When prompted:
- Username:
__token__(literally this string) - Password: Your PyPI API token (starts with
pypi-)
Or use environment variable:
export TWINE_USERNAME=__token__
export TWINE_PASSWORD=pypi-xxxxx...
twine upload dist/*pip index versions claw-walletOr visit: https://pypi.org/project/claw-wallet/
Create .github/workflows/publish-npm.yml:
name: Publish to npm
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
working-directory: agent-wallet-service
run: npm ci
- name: Run tests
working-directory: agent-wallet-service
run: npm test
- name: Publish
working-directory: agent-wallet-service
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}Create .github/workflows/publish-pypi.yml:
name: Publish to PyPI
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: pip install build twine
- name: Build package
working-directory: agent-wallet-service-python
run: python -m build
- name: Publish to PyPI
working-directory: agent-wallet-service-python
run: twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}Add these secrets in your repository settings:
| Secret | Description |
|---|---|
NPM_TOKEN |
npm access token (create at npmjs.com) |
PYPI_TOKEN |
PyPI API token (create at pypi.org) |
We follow SemVer:
MAJOR.MINOR.PATCH(e.g.,0.2.0)- MAJOR: Breaking changes
- MINOR: New features (backwards compatible)
- PATCH: Bug fixes
npm:
# Patch release (0.2.0 -> 0.2.1)
npm version patch
# Minor release (0.2.0 -> 0.3.0)
npm version minor
# Major release (0.2.0 -> 1.0.0)
npm version majorPython: Manually update version in:
pyproject.tomlclaw_wallet/__init__.py(__version__)
- Update version numbers
- Update CHANGELOG.md
- Run all tests
- Build and check distribution
- Create git tag:
git tag v0.2.0 - Push tag:
git push origin v0.2.0 - Publish to npm
- Publish to PyPI
- Create GitHub release
npm login # Login to npm
npm pack --dry-run # Preview package contents
npm publish --access public # Publish public package
npm unpublish pkg@version # Unpublish (within 72 hours)
npm deprecate pkg@version # Deprecate a versionpython -m build # Build the package
twine check dist/* # Check distribution
twine upload dist/* # Upload to PyPI
twine upload --repository testpypi dist/* # Test PyPITest publishing without affecting the real index:
# Register at test.pypi.org
# Upload to TestPyPI
twine upload --repository testpypi dist/*
# Install from TestPyPI
pip install --index-url https://test.pypi.org/simple/ claw-wallet- Ensure you're logged in:
npm whoami - Check if package name is taken:
npm view claw-wallet-sdk - For scoped packages, verify you own the scope
- Use
__token__as username (not your PyPI username) - Ensure token starts with
pypi- - Check token hasn't expired
- Choose a different name
- Use a scope:
@your-org/claw-wallet-sdk
- You cannot re-upload the same version
- Bump the version number and try again