Skip to main content

A Python wrapper to distribute Bootstrap CSS/JS assets

Project description

bootstrap-wrapper

Python Wrapper for Bootstrap CSS/JavaScript Assets

Overview

This repository automatically syncs with the latest Bootstrap distribution files from the official Bootstrap repository and packages them for easy distribution via Python's packaging system.

✨ NEW: Now installable as a Python package!

pip install bootstrap-wrapper==5.3.8

Bootstrap Assets

This repository automatically syncs with the latest Bootstrap distribution files from the official Bootstrap repository.

Installation & Usage

Install from PyPI (Recommended)

pip install bootstrap-wrapper==5.3.8

Usage in Web Frameworks

FastAPI Example:

from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
import bootstrap_wrapper

app = FastAPI()

# Get Bootstrap assets path
static_path = bootstrap_wrapper.get_bootstrap_dir()

# Mount Bootstrap static files
app.mount("/bootstrap", StaticFiles(directory=str(static_path)), name="bootstrap")

# Access Bootstrap at:
# http://localhost:8000/bootstrap/css/bootstrap.min.css
# http://localhost:8000/bootstrap/js/bootstrap.bundle.min.js

Flask Example:

from flask import Flask, send_from_directory
import bootstrap_wrapper

app = Flask(__name__)

BOOTSTRAP_PATH = bootstrap_wrapper.get_bootstrap_dir()

@app.route('/bootstrap/<path:filename>')
def bootstrap_static(filename):
    return send_from_directory(str(BOOTSTRAP_PATH), filename)

Django Example:

# In settings.py
import bootstrap_wrapper

BOOTSTRAP_STATIC_ROOT = bootstrap_wrapper.get_bootstrap_dir()

STATICFILES_DIRS = [
    BOOTSTRAP_STATIC_ROOT,
]

Automatic Updates

  • Schedule: The Bootstrap assets are automatically updated weekly on Mondays at 09:00 UTC
  • Manual Trigger: You can manually trigger an update by running the "Sync Bootstrap Dist" workflow
    • Force Update: Use the force_update option to force an update even if the version is the same
  • Auto-Merge: When a new Bootstrap version is available, the workflow automatically:
    1. Creates a pull request with the updated files
    2. Auto-merges the PR (no manual review required)
    3. Creates a git tag matching the Bootstrap version (e.g., 5.3.8)
    4. Creates a GitHub release automatically
    5. Triggers PyPI publishing via the existing publish workflow

Bootstrap Files

The Bootstrap distribution files are stored in the bootstrap/ directory:

  • bootstrap/css/ - Bootstrap CSS files (minified and source)
  • bootstrap/js/ - Bootstrap JavaScript files (minified and source)
  • bootstrap/version.txt - Current Bootstrap version

Workflow

The sync process uses the GitHub Actions workflow located at .github/workflows/sync-bootstrap-dist.yml which:

  1. Checks the latest Bootstrap release via GitHub API
  2. Compares with the current version in bootstrap/version.txt
  3. Downloads and extracts the official Bootstrap dist ZIP if an update is needed
  4. Creates a pull request with the updated files
  5. Auto-merges the pull request immediately (no manual review required)
  6. Creates a git tag matching the Bootstrap version for PyPI releases
  7. Creates a GitHub release automatically
  8. Triggers PyPI package publishing through the existing publish workflow

Development

Run the example script to see usage examples:

python example_usage.py

Publishing to PyPI

The project is automatically published to PyPI as bootstrap-wrapper when:

  1. A new GitHub release is created
  2. The GitHub Actions workflow runs successfully

For manual publishing (if needed):

# Install build tools
pip install build twine

# Build the package
python -m build

# Upload to PyPI (requires API token)
twine upload dist/*

Note: The package uses trusted publishing via GitHub Actions, so manual uploads should generally not be necessary.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Bootstrap itself is also licensed under the MIT License.

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

bootstrap_wrapper-5.3.8.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

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

bootstrap_wrapper-5.3.8-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file bootstrap_wrapper-5.3.8.tar.gz.

File metadata

  • Download URL: bootstrap_wrapper-5.3.8.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bootstrap_wrapper-5.3.8.tar.gz
Algorithm Hash digest
SHA256 21a70ff99a21bff5c178f54d83cf7a6b860ee6b7c0beb961f28b97b9c25880df
MD5 ab8499c32c102b420efb40ecdf91f3d2
BLAKE2b-256 bd2c138b4a26dbcdbd2682596a68502a87aa2de08df9b2012242def6c6c821d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for bootstrap_wrapper-5.3.8.tar.gz:

Publisher: publish.yml on MaximilianClemens/python-bootstrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bootstrap_wrapper-5.3.8-py3-none-any.whl.

File metadata

File hashes

Hashes for bootstrap_wrapper-5.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ee5eb60c3a479ff71d5812cd6e14d3ba9dc88b65aa75cc1548d3ea282c7a5819
MD5 fac41d12e571a571cee1c89f2e8f4e2b
BLAKE2b-256 1ec111048287b1fef9814dee61f6fa3dde51078c6a1082324b9255e4783c27a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for bootstrap_wrapper-5.3.8-py3-none-any.whl:

Publisher: publish.yml on MaximilianClemens/python-bootstrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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