Skip to main content

SVG icon strings for ALS Computing — mirrors @als-computing/icons on npm

Project description

ALS Computing Icons

ALS Computing Icons is a collection of SVG icons exported from Figma, automatically optimized and published to both npm and PyPI on every push to main.

  • npm: @als-computing/icons
  • PyPI: als-computing-icons

Every icon is processed with SVGO and has black fills replaced with currentColor so you can tint them from CSS.


Table of Contents

  1. How the pipeline works
  2. Adding or updating icons
  3. One-time setup (do this once when forking / first deploying)
  4. Using the npm package
  5. Using the PyPI package
  6. Local development
  7. Folder structure
  8. Troubleshooting
  9. License

How the pipeline works

You drop SVGs into assets/
        │
        ▼
  git push to main
        │
        ▼
  GitHub Actions
        │
        ├─ npm run optimize   → optimized-assets/  (SVGO + currentColor)
        ├─ npm run build      → dist/              (JS/TS package)
        ├─ npm run build:python → python/als_computing_icons/__init__.py
        │
        ├─ If anything in dist/ changed:
        │     ├─ Bump patch version in package.json
        │     ├─ git commit + tag + push
        │     ├─ Publish to npm  (@als-computing/icons)
        │     ├─ Create GitHub Release
        │     └─ Publish to PyPI (als-computing-icons)
        │
        └─ Done — both packages now have the new icons

The version number is always kept in sync: whatever patch version npm bumps to, the Python package gets the exact same version.


Adding or updating icons

  1. Copy your .svg files into the assets/ folder.
  2. Commit and push to main.
  3. The GitHub Actions workflow runs automatically. No manual steps needed.

Tip: File names become Python/JS variable names. Spaces and special characters are replaced with underscores. For example, linear stage.svg becomes linear_stage.


One-time setup

Do these steps once when you first set up this repo (or fork it). After that, every push is fully automatic.


1. Create an npm Automation token

You need this so GitHub Actions can publish to npm without triggering a one-time password (OTP) prompt. A regular "Publish" token will fail with EOTP in CI — Automation tokens are specifically designed to skip OTP.

  1. Log in at npmjs.com.
  2. Click your profile picture (top-right) → Access Tokens.
  3. Click Generate New Token → choose Granular Access Token.
    • Token name: anything, e.g. github-actions-publish
    • Expiration: set to your preference (365 days is common)
    • Packages and scopes: select Read and write
    • Select packages: choose @als-computing/icons (or leave as "all packages" before first publish — the package won't exist yet)
    • Organizations: grant access to als-computing
    • Leave everything else as default
  4. Click Generate Token and copy it immediately — you won't see it again.

Important: If you see a Classic Token option, choose Automation as the type. The key setting is that the token must bypass OTP/2FA for CI to work.


2. Create a PyPI API token

First-time publishing requires an account-scoped token because the project doesn't exist yet on PyPI. After the first successful publish you can optionally narrow it to just the als-computing-icons project.

  1. Log in at pypi.org.
  2. Click your username (top-right) → Account settings.
  3. Scroll to API tokens → click Add API token.
    • Token name: anything, e.g. github-actions
    • Scope: Entire account (for the first publish; change to project-scoped after)
  4. Click Create token and copy it immediately — it starts with pypi-.

3. Add both tokens to GitHub Secrets

  1. Go to your GitHub repository.
  2. Click Settings (top menu bar of the repo, not your profile).
  3. In the left sidebar: Secrets and variablesActions.
  4. Click New repository secret and add each one:
Secret name Value
NPM_TOKEN The npm Automation token you copied in step 1
PYPI_TOKEN The PyPI API token you copied in step 2

Secret names must match exactly — the workflow references them as ${{ secrets.NPM_TOKEN }} and ${{ secrets.PYPI_TOKEN }}.


4. Allow Actions to write to the repo

The workflow bumps the version, commits dist/ and package.json, and pushes a git tag. GitHub blocks this by default.

  1. In your repo, go to SettingsActionsGeneral.
  2. Scroll to Workflow permissions.
  3. Select Read and write permissions.
  4. Check Allow GitHub Actions to create and approve pull requests (optional but harmless).
  5. Click Save.

Using the npm package

npm install @als-computing/icons
// ESM
import { motor, cluster } from '@als-computing/icons';

// CommonJS
const { motor } = require('@als-computing/icons');

// Render in React
<span dangerouslySetInnerHTML={{ __html: motor }} style={{ color: 'red' }} />

Using the PyPI package

pip install als-computing-icons
from als_computing_icons import motor, cluster

# Each variable is the raw SVG string
print(motor)  # <svg xmlns="http://www.w3.org/2000/svg" ...>...</svg>

Rendering in a Jupyter notebook:

from IPython.display import HTML
from als_computing_icons import motor

HTML(f'<span style="color: steelblue; font-size: 48px">{motor}</span>')

Rendering in a Dash / Panel app:

import dash_dangerously_set_inner_html as ddsih
from als_computing_icons import motor

ddsih.DangerouslySetInnerHTML(motor)

Local development

# Install JS dependencies
npm install

# Optimize SVGs (assets/ → optimized-assets/)
npm run optimize

# Build the JS/TS package (optimized-assets/ → dist/)
npm run build

# Build the Python package (optimized-assets/ → python/als_computing_icons/__init__.py)
npm run build:python

# Build and package the Python wheel locally
cd python && python3 -m build

Folder structure

assets/                   ← DROP YOUR SVGs HERE
optimized-assets/         ← auto-generated by `npm run optimize`
dist/                     ← auto-generated JS/TS package output
python/
  pyproject.toml          ← Python package config (hatchling)
  als_computing_icons/
    __init__.py           ← auto-generated, one variable per icon
    py.typed              ← PEP 561 type marker
scripts/
  optimize-svg.js         ← SVGO pass; replaces black → currentColor
  build.js                ← generates dist/ (JS/TS)
  build_python.js         ← generates python/als_computing_icons/__init__.py
  sync-assets.js          ← optional Figma sync helper
.github/workflows/
  build-and-publish.yml   ← the main CI pipeline
package.json

Troubleshooting

Error Cause Fix
npm error code EOTP npm token is a Publish token, not Automation Re-create the npm token as Automation type (step 1 above)
403 Forbidden on PyPI Token is project-scoped but project doesn't exist yet Use an Entire account scoped token for the first publish
HttpError: Resource not accessible by integration Actions don't have write permission Enable Read and write permissions in repo Settings → Actions → General
optimized-assets/ missing or empty SVGs weren't committed to assets/ Add .svg files to assets/ and push
Python variable name clash Two SVG files sanitise to the same identifier Rename one of the source files to make names unique

License

MIT © ALS Computing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

als_computing_icons-0.1.50.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

als_computing_icons-0.1.50-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file als_computing_icons-0.1.50.tar.gz.

File metadata

  • Download URL: als_computing_icons-0.1.50.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for als_computing_icons-0.1.50.tar.gz
Algorithm Hash digest
SHA256 a0b6d97fddb07030842facfcce35fd0b6e22894ebd86692774ba9c27e0f0ae60
MD5 aba7d5932b669d07a8c9b98e1a0c5e5f
BLAKE2b-256 078c45ac3b7bc2b82629c4313fbf328e06b74f7f3fa8cee6aaf24901271a7b09

See more details on using hashes here.

File details

Details for the file als_computing_icons-0.1.50-py3-none-any.whl.

File metadata

File hashes

Hashes for als_computing_icons-0.1.50-py3-none-any.whl
Algorithm Hash digest
SHA256 476f6861fbc740e425083b377903bfc3c2f87be92551743427db45699a8f22c5
MD5 9a71e3582bff00c524af8ae7a9588525
BLAKE2b-256 7169e855a6026563f4a417d1af55a8ddc629c9544170da2aa63baf78ccf662f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page