Run RequireJS (r.js) from Python without requiring Node or Rhino. Leverages PyMiniRacer plus a minimal JS environment to make r.js think it’s running in node.
Usage
python-requirejs is available via PyPI:
pip install requirejs
API
import requirejs
requirejs.optimize(
appDir=".",
baseUrl="js/",
modules=[{
"name": "main",
}]
dir="../build",
)
Hopefully, all of the available build options for r.js will Just Work. If you find any discrepancies, please open a ticket to let us know.
This library is meant to be a drop-in replacement for node r.js -o app.build.json, and is tested by comparing its output with that command. However, since the optimize API is being called as a function, you may need to set the working directory explicitly to avoid any unexpected differences in how relative paths are computed:
import requirejs
import json
with open('app/app.build.json') as f:
config = json.load(f)
requirejs.optimize(
config,
working_directory="app/" # Unique to python-requirejs
)
Metadata
Release files for requirejs 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| requirejs-0.2.2.tar.gz | 237.1 kB | Without provenance | Details for requirejs-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| requirejs-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for requirejs-0.2.2-py3-none-any.whl |
Total release size: 477.6 kB
Release files / requirejs-0.2.2.tar.gz
| Download URL | requirejs-0.2.2.tar.gz |
|---|---|
| Size | 237.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c90fc1ebf197048531c9bb1f039c994f3bd97f6cd834a04d581af6f52c6427d
|
|
BLAKE2b-256 checksum How to use checksums |
351480ecdd3e22b213701963d5dbafc3cab31551dcd53bfc4f998b97c406b347
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
|
Release files / requirejs-0.2.2-py3-none-any.whl
| Download URL | requirejs-0.2.2-py3-none-any.whl |
|---|---|
| Size | 240.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c883b0fa45820c649e4d3f7336fd7de405040b39fbd1e0fe4b8696bf015ccf4
|
|
BLAKE2b-256 checksum How to use checksums |
07ccb7cf1923188433c5aeb82bebadcba2ebd78fcb4389c12d5c77e8c7cd106f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
|
Security for requirejs 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.