Skip to main content

Download ESM modules from npm and jsdelivr

Project description

download-esm

PyPI Changelog Tests License

Download ESM modules from npm and jsdelivr

Installation

Install this tool using pip:

pip install download-esm

Warning

This is alpha software. It works for downloading Observable Plot, but has not been tested against any other packages yet.

Your help welcome in testing this further!

Usage

To download Observable Plot and all of its dependencies as ECMAScript modules:

download-esm @observablehq/plot

This will download around 40 .js files to the current directory.

To put them in another directory, add that as an argument:

download-esm @observablehq/plot ./js

Each file will have any import and export statements rewritten as relative paths.

You can then use the library in your own HTML and JavaScript something like this:

<div id="myplot"></div>
<script type="module">
import * as Plot from "./js/observablehq-plot-0-6-6.js";
const plot = Plot.rectY(
    {length: 10000}, Plot.binX({y: "count"}, {x: Math.random})
).plot();
const div = document.querySelector("#myplot");
div.append(plot);
</script>

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd download-esm
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

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

download-esm-0.1a0.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

download_esm-0.1a0-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

Supported by

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