Registry / web-framework / pygaljs

pygaljs

JSON →
library1.0.2pypypi✓ verified 87d ago

Pygaljs is a Python package designed to provide static assets (JavaScript, CSS, fonts, etc.) for the pygal.js JavaScript charting library. It acts as a wrapper, making these web assets easily discoverable and servable within Python-based web applications. The current version is 1.0.2, and its release cadence is infrequent, with the last release in April 2020, indicating a stable but not actively developed state.

pip install pygaljs
INSTALL
IMPORT
SIG · PYGALJS
P
pygaljs
web-frameworkpythonv1.0.2
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pygaljs
import pygaljs
The primary import is for the top-level package. Individual charting components are not imported from here as pygaljs provides static assets for a JavaScript library, not a Python charting API.

The `pygaljs` library is primarily an asset provider for the `pygal.js` JavaScript charting library. The most common 'use case' in Python code is to programmatically locate the installation path of these static assets so that a web framework can serve them. This example demonstrates how to find the root directory of the installed package and a likely location for its JavaScript and CSS files.

import os import pygaljs # The pygaljs package primarily provides static assets. # Its main utility in Python code is often to determine the path # to these assets for serving them in a web framework. # Get the base directory of the installed pygaljs package package_root = os.path.dirname(pygaljs.__file__) print(f"Pygaljs package root: {package_root}") # Example of how you might construct a path to a specific asset (e.g., JavaScript file) # Note: The exact subdirectory structure depends on the pygal.js assets it bundles. # A common pattern for such packages is to have a 'static' or 'dist' directory. # This path might vary; typically, you'd look for a 'static' or 'dist' folder. # For pygaljs, the assets are often directly under 'pygaljs/pygaljs/'. # Checking the GitHub repository (https://github.com/ionelmc/python-pygaljs) # shows assets like 'pygal-2.0.x.min.js' directly under 'pygaljs/pygaljs'. pygaljs_assets_dir = os.path.join(package_root, 'pygaljs') print(f"Pygaljs assets directory (potential): {pygaljs_assets_dir}") # Verify if the directory exists and list some contents (for demonstration) if os.path.exists(pygaljs_assets_dir): print("Contents of pygaljs assets directory (first 5 files):") for i, item in enumerate(os.listdir(pygaljs_assets_dir)): if i >= 5: break print(f" - {item}") else: print(f"Warning: {pygaljs_assets_dir} does not exist. Asset location might differ.") # In a web framework (e.g., Flask, Django), you would configure # a static file handler to serve files from `pygaljs_assets_dir`. # For example, in Flask: # app.static_folder = os.path.join(os.path.dirname(pygaljs.__file__), 'pygaljs')
Debug
Known issues
gotchaPygaljs provides assets for a JavaScript library (`pygal.js`), it is not a Python charting library itself. You cannot create charts directly by calling functions from `pygaljs` in Python.
fix
If you intend to generate charts directly in Python, consider libraries like `pygal` (the Python charting library) or `matplotlib`, `plotly`, etc. `pygaljs` is for providing the frontend assets if you're using `pygal.js` in a web context.
affects: 1.0.x
gotchaThe exact subdirectory structure where `pygal.js` assets (JavaScript, CSS) are stored within the `pygaljs` package might not be immediately obvious or explicitly documented. This can lead to issues when configuring static file serving in web frameworks.
fix
Inspect the installed `pygaljs` package directory (e.g., `os.path.dirname(pygaljs.__file__)`) to confirm the asset layout. Common subdirectories are 'static' or a direct package subfolder with the library name, like 'pygaljs/pygaljs/'.
affects: 1.0.x
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pygaljs'
The `pygaljs` package is not installed in the active Python environment.
fix
Run `pip install pygaljs` in your terminal to install the package.
Attempting to create a chart like: pygaljs.Line().add('series', [1, 2, 3]) results in AttributeError: module 'pygaljs' has no attribute 'Line'
`pygaljs` is an asset package for a JavaScript library, not a Python charting API. It does not expose charting classes or functions directly.
fix
Use the `pygal` Python library (note: `pygal` not `pygaljs`) for generating SVG charts from Python, or use `pygal.js` (the JavaScript library) on the frontend if you are serving its assets via `pygaljs`.
Upgrade
Version history
1.0.2latest on PyPI · released Apr 3, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Resources
pygaljs — pip install pygaljs · libregistry