Python wrapper package for precompiled Bootstrap assets
Description
A trivial change to make the precompiled CSS and JS files available for Python projects.
Motivation & Context
The motivation behind this change is to avoid having to manually update the assets (CSS + JS) in my FastAPI application. By integrating these assets as a dependency, users will always have access to the latest version automatically.
Type of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Refactoring (non-breaking change)
- [ ] Breaking change (fix or feature that would change existing functionality)
Checklist
- [x] I have read the contributing guidelines
- [x] My code follows the code style of the project (using
npm run lint) - [x] My change introduces changes to the documentation
- [x] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] All new and existing tests passed
Live previews
pip install git+https://github.com/MaximilianClemens/bootstrap.git
( pip install git+https://github.com/twbs/bootstrap.git ) # when accepted
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from pathlib import Path
import importlib.metadata
app = FastAPI()
# Retrieve the distribution information for the 'bootstrap' package.
dist = importlib.metadata.distribution("bootstrap")
# Locate the static assets installed as package data.
static_path = Path(dist.locate_file("bootstrap/dist"))
app.mount("/bootstrap", StaticFiles(directory=str(static_path)), name="bootstrap")
Related issues
A trivial change to make the precompiled CSS and JS files available for Python projects.
Trivial perhaps, but adding it here means we're maintaining it. I'm not so sure about adding this to our project at this point. Could this be a separate repo and dependency that consumes the upstream project? I'd be happy to see that in the @twbs org.
Closing as a won't fix/implement—thanks though!