{ "info": { "author": "Tommy Yu", "author_email": "tommy.yu@auckland.ac.nz", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: Plugins", "Framework :: Setuptools Plugin", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: POSIX :: BSD", "Operating System :: POSIX :: Linux", "Programming Language :: JavaScript", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Build Tools", "Topic :: System :: Software Distribution", "Topic :: Utilities" ], "description": "calmjs.rjs\n==========\n\nPackage for the integration of `RequireJS`__ into a Python environment\nvia the `Calmjs framework`__, to provide a reproducible workflow for the\ngeneration of deployable artifacts from JavaScript source code provided\nby Python packages in conjunction with standard JavaScript or `Node.js`_\npackages sourced from |npm|_ or other similar package repositories.\n\n.. __: http://requirejs.org/\n.. __: https://pypi.python.org/pypi/calmjs\n.. image:: https://travis-ci.org/calmjs/calmjs.rjs.svg?branch=2.0.1\n :target: https://travis-ci.org/calmjs/calmjs.rjs\n.. image:: https://ci.appveyor.com/api/projects/status/jbta6dfdynk5ke59/branch/2.0.1?svg=true\n :target: https://ci.appveyor.com/project/metatoaster/calmjs-rjs/branch/2.0.1\n.. image:: https://coveralls.io/repos/github/calmjs/calmjs.rjs/badge.svg?branch=2.0.1\n :target: https://coveralls.io/github/calmjs/calmjs.rjs?branch=2.0.1\n\n.. |AMD| replace:: AMD (Asynchronous Module Definition)\n.. |bower| replace:: ``bower``\n.. |calmjs| replace:: ``calmjs``\n.. |calmjs.bower| replace:: ``calmjs.bower``\n.. |calmjs.rjs| replace:: ``calmjs.rjs``\n.. |calmjs.dev| replace:: ``calmjs.dev``\n.. |npm| replace:: ``npm``\n.. |r.js| replace:: ``r.js``\n.. |requirejs| replace:: ``requirejs``\n.. _AMD: https://github.com/amdjs/amdjs-api/blob/master/AMD.md\n.. _bower: https://bower.io/\n.. _calmjs: https://pypi.python.org/pypi/calmjs\n.. _calmjs.bower: https://pypi.python.org/pypi/calmjs.bower\n.. _calmjs.dev: https://pypi.python.org/pypi/calmjs.dev\n.. _Node.js: https://nodejs.org/\n.. _npm: https://www.npmjs.com/\n.. _requirejs: https://www.npmjs.com/package/requirejs\n\n\nIntroduction\n------------\n\nWeb applications can be created using any language, however the\ninteractive front-end user interfaces they provide ultimately rely on\nsome form of JavaScript. Python web application frameworks or systems\nthat provide frontend functionalities that bridge the backend have\nadopted the usage of `Node.js`_ for testing the JavaScript code that\nthey may provide, with |npm|_ (or |bower|_) being the package manager\nfor the acquisition of JavaScript packages required for the associated\nfunctionality. This often resulted in the separation of what would have\nbeen a single set of package dependency configuration into multiple\ndifferent sets; often this also resulted in the package being fractured\ninto two parts to fit in with the distribution channels being used (PyPI\nvs npm and others).\n\nThis outcome ends up being problematic for Python package management due\nto the increase in difficulty in the propagation of the package's\nversion and dependency information across all relevant package\nmanagement channels in a consistent, portable and reproducible manner\nfor downstream packages and their users. The other issue is that the\nconfiguration files used for asset management or artifact generation is\noften coupled tightly to the system at hand, making it rather difficult\nfor their downstream package to reuse these configurations to generate\na combined artifacts that work also with their other upstream packages\nin a consistent manner.\n\nSome other package managers attempt to solve this by being utterly\ngeneric, however they lack the awareness of locally available Python\npackages (such as Python wheels already installed in the local\nenvironment not being understood by Bower), thus build processes that\ninvolve Bower often end up relying on public infrastructure, and options\nto move it to a private infrastructure or even reuse locally available\nartifacts/packages require extra configurations which negate the\nbenefits offered by these systems. Also, these build scripts are\ntightly coupled to a specific project which are not portable.\n\nThe goal of the Calmjs framework is to bring this separation back\ntogether by providing the method to expose JavaScript sources included\nwith Python packages, with this package, |calmjs.rjs|, to provide the\nfacilities to produce deployable artifacts from those exported source\nfiles, plus the other declared external bundles to be sourced from |npm|\nor other related Node.js package management systems.\n\n\nFeatures\n--------\n\nHow |calmjs.rjs| works\n~~~~~~~~~~~~~~~~~~~~~~\n\nThe Calmjs framework provides the framework to allow Python packages to\ndeclare the dependencies they need against |npm| based packages for the\nJavaScript code they provide, and also the system that allow Python\npackages to declare which of their modules export JavaScript sources\nthat can be reused.\n\nThe utility included with |calmjs.rjs| provide the means to consume\nthose declarations, treating the JavaScript files as both source and\ncompilation target, with the final deployable artifact(s) being produced\nthrough |r.js| from the |requirejs|_ package.\n\nCurrently, the source files could be written in both AMD and CommonJS\nmodule formats, although the CommonJS format is recommended due to their\nwide support under most systems, and that |calmjs.rjs| provides\ntranspilation and configuration generation utilities that processes the\nJavaScript source code into a form that is compatible with the |r.js|\noptimizer. However, the ``exports`` statement in the source file should\nbe not part of ``module.exports`` for the mean time. The AMD headers\nand footers can be absent too, as the ``calmjs rjs`` transpiler will add\nthe appropriate headers and footers needed (for example, have\n``require`` be imported from the correct source, or for mapping\n``exports`` to ``module.exports``) so that the final script will be\nusable for the target platform or format.\n\nThe resulting sources will be placed in a build directory, along with\nall the declared bundled sources acquired from the Node.js package\nmanagers or repositories. A build file will then be generated that will\ninclude all the relevant sources as selected to enable the generation of\nthe final artifact file through |r.js|. These can then be deployed to\nthe appropriate environment, or the whole above process can be included\nas part of the functionality of the Python backend at hand.\n\nUltimately, the goal of |calmjs.rjs| is to ease the integration and\ninteractions between of client-side JavaScript with server-side Python,\nby simplifying the task of building, shipping and deployment of the two\nset of sources in one shared package and environment. The Calmjs\nframework provides the linkage between these two environment and the\ntools provided by there will assist with the setup of a common,\nreproducible local Node.js environments.\n\nFinally, for quality control, this package has integration with\n|calmjs.dev|, which provides the tools needed to set up the test\nenvironment and harnesses for running of JavaScript tests that are part\nof the Python packages for the associated JavaScript code. However,\nthat package is not declared as a direct dependency, as not all use\ncases will require the availability of that package. Please refer to\ninstallation section for details.\n\nDo note, in the initial implementation, the JavaScript source file\nsupported by this framework loosely follows certain definitions that\nonly mimic what ES6 intends to provide (as outlined earlier). Even with\nthis, as a consequence of treating JavaScript within the Python package\nas a source file for the compilation target which is the deployable\nartifact file, the input source files and exported paths generated by\n|calmjs.rjs| are NOT meant for direct consumption of web clients such as\nweb browsers. The produced artifact from this framework will be usable\nthrough the AMD API.\n\n\nInstallation\n------------\n\nIt is recommended that the local environment already have Node.js and\n|npm| installed at the very minimum to enable the installation of\n|requirejs|, if it hasn't already been installed and available. Also,\nthe version of Python must be either 2.7 or 3.3+; PyPy is supported,\nwith PyPy3 version 5.2.0-alpha1 must be used due to a upstream package\nfailing to function in the currently stable PyPy3 version 2.4.\n\nTo install |calmjs.rjs| into a given Python environment, it may be\ninstalled directly from PyPI with the following command:\n\n.. code:: sh\n\n $ pip install calmjs.rjs\n\nInstalling/using RequireJS with calmjs\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo establish a development/build environment for a Python package with\nthe support for |r.js| through |calmjs.rjs| in the current working\ndirectory (e.g. for a project), the following command may be executed:\n\n.. code:: sh\n\n $ calmjs npm --install calmjs.rjs\n\nWhile running ``npm install requirejs`` (along with other related\npackages declared by |calmjs.rjs| that it needs from |npm|) will achieve\nthe same effect, do note the Calmjs framework makes it possible for\n|npm| dependencies to be propagated down to dependent packages; such\nthat if a Python package that have declared |calmjs.rjs| as a dependency\n(either through ``install_requires`` or an ``extras_require`` in its\n``setup.py``) may have its complete set of dependencies on |npm| be\ninstalled using the following command (assuming the package is named\n``example.package``:\n\n.. code:: sh\n\n $ calmjs npm --install example.package\n\nAll standard JavaScript and Node.js dependencies for ``example.package``\nwill now be installed into the current directory through the relevant\ntools. This process will also install all the other dependencies\nthrough |npm| or |requirejs| that other Python packages depended on by\n``example.package`` have declared.\n\nFor further details about how this all works can be found in the\ndocumentation for |calmjs|_. Otherwise, please continue on to the\n`usage`_ section.\n\nAlternative installation methods (advanced users)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nDevelopment is still ongoing with |calmjs.rjs|, for the latest features\nand bug fixes, the development version can be installed through git like\nso:\n\n.. code:: sh\n\n $ pip install calmjs\n $ pip install git+https://github.com/calmjs/calmjs.rjs.git#egg=calmjs.rjs\n\nAlternatively, the git repository can be cloned directly and execute\n``python setup.py develop`` while inside the root of the source\ndirectory.\n\nKeep in mind that |calmjs| MUST be available before the ``setup.py``\nwithin the |calmjs.rjs| source tree is executed, for it needs the\n``package_json`` writing capabilities in |calmjs|. Alternatively,\nplease execute ``python setup.py egg_info`` if any message about\n``Unknown distribution option:`` is noted during the invocation of\n``setup.py``.\n\nAs |calmjs| is declared as both namespace and package, there are certain\nlow-level setup that is required on the working Python environment to\nensure that all modules within can be located correctly. However,\nversions of ``setuptools`` earlier than `v31.0.0`__ does not create the\nrequired package namespace declarations when a package is installed\nusing this development installation method when mixed with ``pip\ninstall`` within the same namespace. As a result, inconsistent import\nfailures can happen for any modules under the |calmjs| namespace. As an\nexample:\n\n.. __: https://setuptools.readthedocs.io/en/latest/history.html#v31-0-0\n\n.. code:: python\n\n >>> import calmjs.rjs\n Traceback (most recent call last):\n File \"\", line 1, in \n ImportError: No module named 'calmjs.rjs'\n >>> import calmjs.base\n >>> import calmjs.rjs\n >>>\n\nIf this behavior (and workaround) is undesirable, please ensure the\ninstallation of all |calmjs| related packages follow the same method\n(i.e. either ``python setup.py develop`` for all packages, or using the\nwheels acquired through ``pip``), or upgrade ``setuptools`` to version\n31 or greater and reinstall all affected packages.\n\nTesting the installation\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nFinally, to verify for the successful installation of |calmjs.rjs|, the\nincluded tests may be executed through this command:\n\n.. code:: sh\n\n $ python -m unittest calmjs.rjs.tests.make_suite\n\nHowever, if the steps to install external Node.js dependencies to the\ncurrent directory was followed, the current directory may be specified\nas the ``CALMJS_TEST_ENV`` environment variable. Under POSIX compatible\nshells this may be executed instead from within that directory:\n\n.. code:: sh\n\n $ CALMJS_TEST_ENV=. python -m unittest calmjs.rjs.tests.make_suite\n\nDo note that if the |calmjs.dev| package is unavailable, a number of\ntests will be skipped. To avoid this, either install that package\nseparately, or install |calmjs.rjs| using its extras dependencies\ndeclaration like so:\n\n.. code:: sh\n\n $ pip install calmjs.rjs[dev]\n\n\nUsage\n-----\n\nTo generate a RequireJS artifact from packages that have JavaScript code\nexposed through the Calmjs module registry system that are already\ninstalled into the current environment, simply execute the following\ncommand:\n\n.. code:: sh\n\n $ calmjs rjs example.package\n\nThe following sections in this document will provide an overview on how\nto enable the JavaScript module export feature for a given Python\npackage through the Calmjs module registry system, however a more\nthorough description on this topic may be found in the README provided\nby the |calmjs|_ package, under the section `Export JavaScript code from\nPython packages`__.\n\n.. __: https://pypi.python.org/pypi/calmjs/#export-javascript-code-from-python-packages\n\nDeclaring JavaScript exports for Python\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nAny exposed JavaScript code through the ``calmjs.module`` registry will\nbe picked up and compiled into a working RequireJS artifact. For\nexample, given the following entry points for that registry defined by a\npackage named ``example``:\n\n.. code:: ini\n\n [calmjs.module]\n example = example\n\nThis is the most basic declaration that works for packages that share\nthe same name as the import location provided.\n\nThe following is am example for packages that have nested submodules\n(called ``example.lib`` and ``example.app``):\n\n.. code:: ini\n\n [calmjs.module]\n example.lib = example.lib\n example.app = example.app\n\nWhile the import locations declared looks exactly like a Python module\n(as per the rules of a Python entry point), the ``calmjs.module``\nregistry will present them using the CommonJS/ES6 style import paths\n(i.e. ``'example/lib'`` and ``'example/app'``), so users of that need\nthose JavaScript modules to be sure they ``require`` those strings.\n\nPlease also note that the default source extractor will extract all\nJavaScript files within those directories. Finally, as a consequence of\nhow the imports are done, it is recommended that no relative imports are\nto be used.\n\nIf the package at hand does not directly declare its dependency on\n|calmjs|, an explicit ``calmjs_module_registry=['calmjs.module']`` may\nneed to be declared in the ``setup`` function for the package to ensure\nthat this default module registry will be used to acquire the JavaScript\nsources from.\n\nPutting this together, the ``setup.py`` file should contain the\nfollowing:\n\n.. code:: Python\n\n setup(\n name='example',\n # ... plus other declarations\n # This is one of the recommended options, even though the\n # project will not be importing from Calmjs.\n license='gpl',\n install_requires=[\n 'calmjs>=3.0.0,<4',\n 'calmjs.rjs>=2.0.0,<3',\n # plus other installation requirements\n ],\n # If the usage of the GPL is impossible for the project, or\n # declaring a direct dependency on calmjs packages is impossible\n # for the project for whatever other reasons (even though the\n # project itself will NOT be required to include/import ANY code\n # from the calmjs namespace), setup_requires may be used instead\n # of install_requires, and the following should also be included\n # as well:\n package_json={\n \"devDependencies\": {\n \"requirejs\": \"~2.1.17\",\n }\n },\n calmjs_module_registry=['calmjs.module'],\n # the entry points are required to allow calmjs to pick this up\n entry_points=\"\"\"\n [calmjs.module]\n example = example\n example.lib = example.lib\n example.app = example.app\n \"\"\",\n )\n\nFor the construction of the RequireJS artifact, the command ``calmjs\nrjs`` will automatically extract all relevant source files from the\ndependencies of the selected Python package(s) into a temporary build\ndirectory, where the build manifest will also be generated for the\ninvocation of ``r.js`` to construct the artifact. An example run:\n\n.. code:: sh\n\n $ calmjs rjs example\n\n Tracing dependencies for: /home/user/example.js\n\n /home/user/example.js\n ----------------\n /tmp/tmp_build/build/example/lib/form.js\n /tmp/tmp_build/build/example/lib/ui.js\n /tmp/tmp_build/build/example/lib/main.js\n /tmp/tmp_build/build/example/app/index.js\n\nAs the build process used by |calmjs.rjs| is done in a separate build\ndirectory, all imports through the Node.js module system must be\ndeclared as ``extras_calmjs``. For instance, if ``example/app/index``\nneed to use the ``jquery`` and ``underscore`` modules like so:\n\n.. code:: JavaScript\n\n var $ = require('jquery'),\n _ = require('underscore');\n\nIt will need to declare the target location sourced from |npm| plus the\npackage_json for the dependencies, it will need to declare this in its\n``setup.py``:\n\n.. code:: Python\n\n setup(\n # ...\n package_json={\n \"dependencies\": {\n \"jquery\": \"~3.1.0\",\n \"underscore\": \"~1.8.0\",\n },\n },\n extras_calmjs = {\n 'node_modules': {\n 'jquery': 'jquery/dist/jquery.js',\n 'underscore': 'underscore/underscore.js',\n },\n },\n )\n\nOnce that is done, rerun ``python setup.py egg_info`` to write the\nfreshly declared metadata into the package's egg-info directory, so that\nit can be used from within the environment. ``calmjs npm --install``\ncan now be invoked to install the |npm| dependencies into the current\ndirectory; to permit |calmjs.rjs| to find the required files sourced\nfrom |npm| to put into the build directory for ``r.js`` to locate them.\n\nThe resulting calmjs run may then end up looking something like this:\n\n.. code:: sh\n\n $ calmjs rjs example\n\n Tracing dependencies for: /home/user/example.js\n\n /home/user/example.js\n ----------------\n /tmp/tmp_build/build/jquery.js\n /tmp/tmp_build/build/underscore.js\n /tmp/tmp_build/build/example/lib/form.js\n /tmp/tmp_build/build/example/lib/ui.js\n /tmp/tmp_build/build/example/lib/main.js\n /tmp/tmp_build/build/example/app/index.js\n\n\nThe transpiler will add the appropriate boilerplates and thus the\n``require`` statements through |requirejs| will import from\n``node_modules`` if the extras_calmjs have been declared. However,\nthere are cases where the desired artifact should only contain the\nsources from the Python package without the extras or vice versa (due to\nthe library being available via another deployed artifact), this is\nsupported by the ``empty:`` scheme by ``r.js``, and to enable it for\n``calmjs rjs`` it can be done like so:\n\n.. code:: sh\n\n $ calmjs rjs example --bundlepath-method empty --export-filename main.js\n\n Tracing dependencies for: /home/user/main.js\n\n /home/user/main.js\n ----------------\n /tmp/tmp_build/build/example/lib/form.js\n /tmp/tmp_build/build/example/lib/ui.js\n /tmp/tmp_build/build/example/lib/main.js\n /tmp/tmp_build/build/example/app/index.js\n\n $ calmjs rjs example --sourcepath-method empty --export-filename deps.js\n\n Tracing dependencies for: /home/user/deps.js\n\n /home/user/deps.js\n ----------------\n /tmp/tmp_build/build/jquery.js\n /tmp/tmp_build/build/underscore.js\n\nThe above example shows the generation of two separate artifacts, one\ncontaining just the sources from the Python package ``example`` that had\nbeen declared in the ``calmjs.module`` registry, and the other contains\nonly the external extra sources.\n\nIf the above triggers a dependency trace error for |r.js|, there is a\nlast resort ``--empty`` flag that can be applied; do note that this\ncompletely disables the trace functionality for |r.js| as this initiates\na similar trace process to locate all the imported module names for\nstubbing them out with the ``empty:`` scheme within the generated\nconfiguration file. Ensure that the modules required by the resulting\nartifact has all its required modules provided elsewhere.\n\nThe explicit ``extras_calmjs`` declaration also supports the usage\nthrough ``bower`` (supported via |calmjs.bower|_); instead of using\n``node_modules`` as the key, ``bower_components`` should be used\ninstead.\n\nAlternative registries aside from ``calmjs.module`` can be specified\nwith the ``--source-registry`` flag. Assuming there are registries in\nthe current environment registered as ``myreg1`` and ``myreg2`` and the\n``example`` package has registered sources to both of them, the command\nto build a bundle from both those registries into one artifact can be\ntriggered like so:\n\n.. code:: sh\n\n $ calmjs rjs --source-registry=myreg1,myreg2 example\n\nHandling of RequireJS loader plugins\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe AMD system as defined by RequireJS has the concept of loader\nplugins, where the module name provided may be suffixed with a ``!`` as\narguments for handling by the plugin. As the string provided after is\nopaque to the |requirejs| system as a whole and thus handled directly by\nthe preceding plugin, the resources that it need will be specific to the\nplugin itself. As it may load resources through the |requirejs| system,\nany paths that require configuration will need to be done.\n\nTo account for this issue, |calmjs.rjs| introduces the concept of loader\nplugin handlers and a registry system for dealing with this. A given\n``RJSToolchain`` will have a default loader plugin registry assigned,\nbut this can be overridden by specifying a custom identifier (overriding\nthe default ``'calmjs.rjs.loader_plugin'``) for the registry to be used,\nwhich will allow the handling of very customized loaders for a given\nproject. Please refer to the ``calmjs.rjs.registry`` module for more\ndetails on how this is constructed and set up for usage.\n\nBy default, the ``text`` handler is registered to the default loader\nplugin registry, which should cover the most common use case encountered\nby the |calmjs| framework. Do note that packages are still required to\ndeclare their (dev)dependencies in their ``package_json`` to the plugin,\nideally with a well constrained version, so to ensure a consistent build\nexperience for all end users.\n\nTesting standalone, finalized RequireJS artifacts\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nAMD artifacts generated using the standard ``calmjs rjs`` toolchain\nruntime may be tested using the ``calmjs karma`` runtime provided by the\n``calmjs.dev`` package. Given a finalized ``example.js`` that\nimplements the features provided by the ``example`` package, the\nartifact may be tested with the tests provided by the ``example``\npackage using the following command:\n\n.. code:: sh\n\n $ calmjs karma run \\\n -t calmjs.rjs \\\n --artifact=example.js \\\n example\n\nThe above command invokes the standalone Karma runner using the\n``calmjs.rjs`` settings to test against the ``example.js`` artifact\nfile, using the tests provided by the ``example`` package. The test\nexecution is similar to the one during the development process.\n\nDeclare prebuilt JavaScript artifacts for Python packages\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nFinally, to complete the Python package deployment story, the process\nshould include the automatic generation and inclusion of the JavaScript\nartifacts in the resulting Python wheel. This can be achieved by\nspecifying an entry in the ``calmjs.artifacts`` registry, with the key\nbeing the filename of the artifact and the value being the import\nlocation to a builder. A default builder function provided at\n``calmjs.rjs.artifact:complete_rjs`` will enable the generation of a\ncomplete RequireJS artifact for the Python package. For example:\n\n.. code:: ini\n\n [calmjs.artifacts]\n example.package.rjs.js = calmjs.rjs.artifact:complete_rjs\n\nOnce those entry points are installed, running ``calmjs artifact build\nexample.package`` will make use of the RequireJS toolchain and build the\nartifact at ``example.package.rjs.js`` inside the ``calmjs_artifacts``\ndirectory within the metadata directory for ``example.package``.\nAlternatively, for solution more integrated with ``setuptools``, the\n``setup`` function in ``setup.py`` should also enable the\n``build_calmjs_artifacts`` flag such that ``setup.py build`` will also\ntrigger the building process. This is useful for automatically\ngenerating and including the artifact as part of the wheel building\nprocess. Consider this ``setup.py``:\n\n.. code:: Python\n\n setup(\n name='example.package',\n # ... other required fields truncated\n build_calmjs_artifacts=True,\n entry_points=\"\"\"\n # ... other entry points truncated\n [calmjs.module]\n example.package = example.package\n\n [calmjs.artifacts]\n example.package.rjs.js = calmjs.rjs.artifact:complete_rjs\n \"\"\",\n )\n\nBuilding the wheel using ``setup.py`` may result in something like this.\nNote that the execution of ``r.js`` was part of the process and that the\nmetadata (egg-info) directory was then built into the wheel.\n\n.. code::\n\n $ python setup.py bdist_wheel\n running bdist_wheel\n running build\n ...\n running build_calmjs_artifacts\n automatically picked registries ['calmjs.module'] for sourcepaths\n using loaderplugin registry 'calmjs.rjs.loader_plugin'\n ...\n /src/example.package.egg-info/calmjs_artifacts/example.package.rjs.js\n ----------------\n /tmp/tmpm_2jf151/build/example/package/index.js\n ...\n running install_egg_info\n Copying src/example.package.egg-info to build/.../wheel/example.package...\n running install_scripts\n creating build/.../wheel/example.package-1.0.dist-info/WHEEL\n\nFor testing the package artifact, the following entry point should also\nbe specified under the ``calmjs.artifacts.tests`` registry, such that\nrunning ``calmjs artifact karma example.package`` will execute the\nJavaScript tests declared by ``example.package`` against the artifacts\nthat were declared in ``calmjs.artifacts``.\n\n.. code:: ini\n\n [calmjs.artifacts.tests]\n example.package.rjs.js = calmjs.rjs.artifact:test_complete_rjs\n\nTroubleshooting\n---------------\n\nThe following are some known issues with regards to this package and its\nintegration with other Python/Node.js packages.\n\nWhen calling ``calmjs rjs`` on a package, got ``ENOENT``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nTypically this is caused by source files from the source package or\nregistry invoking ``require`` a JavaScript module that is not available\nin the build directory. One possible cause through the ``calmjs``\nframework is that the Python package failed to declare ``extras_calmjs``\nthat it might require, or that explicit map method and/or source\nregistry that was selected did not result in all required sources be\nloaded into the build directory.\n\nIf the missing source files are intended, applying the ``--empty`` or\nthe ``-e`` flag to the ``rjs`` tool will stub out all the missing\nmodules from the bundle; do note that this will result in the generated\nartifact bundle not having all the required modules for its execution.\nThe resulting artifact bundle should be used in conjunction with the\nother artifact bundles that provide the result of the required\ndependencies.\n\nRJSRuntimeError: unable to locate 'r.js'\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis means the current Node.js environment is missing the requirejs\npackage from |npm|; either install it manually with it or through\n|calmjs| on this package. If a given Python package is required to use\nrequirejs to generate the package, its ``package_json`` should declare\nthat, or declare dependency on ``calmjs.rjs``.\n\nUserWarning: Unknown distribution option:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nDuring setup and installation using the development method, if this\nwarning message is shown, please ensure the egg metadata is correctly\ngenerated by running ``python setup.py egg_info`` in the source\ndirectory, as the package |calmjs| was not available when the setup\nscript was initially executed.\n\n\nContribute\n----------\n\n- Issue Tracker: https://github.com/calmjs/calmjs.rjs/issues\n- Source Code: https://github.com/calmjs/calmjs.rjs\n\n\nLegal\n-----\n\nThe |calmjs.rjs| package is part of the calmjs project.\n\nThe calmjs project is copyright (c) 2016 Auckland Bioengineering\nInstitute, University of Auckland. |calmjs.rjs| is licensed under the\nterms of the GPLv2 or later.\n\nChangelog\n=========\n\n2.0.1 (2018-05-03)\n------------------\n\n- Update the export_target production and usage of working_dir to be\n inline with what is expected by ``calmjs-3.1.0``. [\n `#3 `_\n ]\n\n2.0.0 (2018-01-12)\n------------------\n\n- Support for ``calmjs-3.0.0`` features and breaking changes.\n- Loader plugin framework migrated upstream; downstream packages that\n make use of them should no longer declare explicit entries in\n ``extras_calmjs`` to permit wider portability.\n- Removed usage of ``slimit`` in favor of the capabilities now provided\n by ``calmjs`` and ``calmjs.parse``.\n- The flags for the ``calmjs rjs`` runtime have been changed to remove\n some naming confusion, mainly due to sourcemap and also to maintain\n consistency with other ``calmjs`` tools.\n\n - ``--bundle-map-method`` is deprecated in favor for\n ``--bundlepath-method``; will be fully removed by 3.0.0\n - ``--source-map-method`` is deprecated in favor for\n ``--sourcepath-method``; will be fully removed by 3.0.0\n\n- Provide a generic package-level artifact builder for the\n ``calmjs.artifacts`` registry along with the respective tester for the\n ``calmjs.artifacts.tests`` registry.\n\n1.0.2 (2017-05-22)\n------------------\n\n- Corrected the issue where plugins that have been unmapped using the\n ``empty:`` scheme triggering ``FileNotFoundError``.\n\n1.0.1 (2017-01-27)\n------------------\n\n- Load the non-test files in deps also, instead as part of the tests to\n avoid automatic inclusion.\n- Test files should start with the name test as per convention.\n\n1.0.0 (2016-11-18)\n------------------\n\n- Initial implementation that brings in the support of the production of\n AMD artifacts (bundles) from JavaScript sources included with Python\n packages (along with their declared dependencies through ``npm`` or\n other supported tools) through the calmjs framework.\n- Enabled the ``calmjs rjs`` tool entry point.\n- Also provide integration with ``calmjs.dev`` by correcting the correct\n hooks so that this package can be used as an advice package for the\n execution of tests against artifacts generated through this package.\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/calmjs/calmjs.rjs", "keywords": "", "license": "gpl", "maintainer": "", "maintainer_email": "", "name": "calmjs.rjs", "package_url": "https://pypi.org/project/calmjs.rjs/", "platform": "", "project_url": "https://pypi.org/project/calmjs.rjs/", "project_urls": { "Homepage": "https://github.com/calmjs/calmjs.rjs" }, "release_url": "https://pypi.org/project/calmjs.rjs/2.0.1/", "requires_dist": [ "calmjs (<4,>=2.0.0)", "calmjs.parse (<2,>=1.0.0)", "calmjs.dev (<2,>=1.0.2); extra == 'dev'" ], "requires_python": "", "summary": "Package for the integration of RequireJS into a Python environment via the Calmjs framework, to provide a reproducible workflow for the generation of deployable artifacts from JavaScript source code provided by Python packages in conjunction with standard JavaScript or Node.js packages sourced from npm or other similar package repositories.", "version": "2.0.1" }, "last_serial": 3829412, "releases": { "0.0": [], "1.0.0": [ { "comment_text": "", "digests": { "md5": "f4b02a4aa8e2dc33cc053e1b71d9e15e", "sha256": "730dacefd2874233e86b2176aed3e4dfcd3d780ee4f2ffca4b0a169d1ac980dd" }, "downloads": -1, "filename": "calmjs.rjs-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f4b02a4aa8e2dc33cc053e1b71d9e15e", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 71987, "upload_time": "2016-11-18T14:42:50", "url": "https://files.pythonhosted.org/packages/43/51/abe86243665881b0a0ea1dcc8d069403b7f1899cb6b88185040679c39e57/calmjs.rjs-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8d32b3b82b8249b0fee64ba391cadaee", "sha256": "0610a66f1399affb9f64a6990953eb4db0fd11dba06cc09e71cd52382bd4e552" }, "downloads": -1, "filename": "calmjs.rjs-1.0.0.tar.gz", "has_sig": false, "md5_digest": "8d32b3b82b8249b0fee64ba391cadaee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 62711, "upload_time": "2016-11-19T03:53:27", "url": "https://files.pythonhosted.org/packages/01/2b/e0f3995caee7a5f3598f390fc6c2a1880bfb124e3951a146992277c32bc2/calmjs.rjs-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "6dcdc3713e5501db2115f268bae55d96", "sha256": "3eaaca5c92c487fda2e35783f5fc317dbf09c8fae2d4bdf878d65614e81967c0" }, "downloads": -1, "filename": "calmjs.rjs-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6dcdc3713e5501db2115f268bae55d96", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 73550, "upload_time": "2017-01-27T02:27:38", "url": "https://files.pythonhosted.org/packages/9a/96/a28e803cdc5def13511d08d9962f1ef1f6777d571383c33e0292d27dccfd/calmjs.rjs-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e3cf37f2f884ad177aa93f3abc1c9248", "sha256": "2b2832ce350fa97700bfe592afb6b76dc63d36720574afb4ccac620bd413b2d1" }, "downloads": -1, "filename": "calmjs.rjs-1.0.1.zip", "has_sig": false, "md5_digest": "e3cf37f2f884ad177aa93f3abc1c9248", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 84346, "upload_time": "2017-01-27T02:27:41", "url": "https://files.pythonhosted.org/packages/9c/c3/f458f759f11703480930d62ce1c09735a15b5bcb4fa43475850267e42757/calmjs.rjs-1.0.1.zip" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "11528daa74e06c06ad5d96b0ce27253b", "sha256": "e65cfeea964b4108454f1925f8006d7c2c3145668ff2a79d81862a1723a0effa" }, "downloads": -1, "filename": "calmjs.rjs-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "11528daa74e06c06ad5d96b0ce27253b", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 74184, "upload_time": "2017-05-22T09:05:04", "url": "https://files.pythonhosted.org/packages/a5/97/49140303f6fa078d1bd0d8f09ac6e229062650ce6d856499577b383e6a83/calmjs.rjs-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "831e656ad4858c86f5d8abe3fbfb2c19", "sha256": "83f9098d9b165fa70cdd723bdd97702b9bb22df9442710886ccd4aa4d793c43a" }, "downloads": -1, "filename": "calmjs.rjs-1.0.2.zip", "has_sig": false, "md5_digest": "831e656ad4858c86f5d8abe3fbfb2c19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 85104, "upload_time": "2017-05-22T09:05:01", "url": "https://files.pythonhosted.org/packages/90/0d/821cfe51eb8f7e9913d452295cd9474fc57fc3091e47bd9328877209d439/calmjs.rjs-1.0.2.zip" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "481c106661c8f55e857e1b020600b9f7", "sha256": "9c65777cc8086b075568ee6ea577c245245eb2eacdf922954355e73381962cdf" }, "downloads": -1, "filename": "calmjs.rjs-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "481c106661c8f55e857e1b020600b9f7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 78503, "upload_time": "2018-01-12T07:13:29", "url": "https://files.pythonhosted.org/packages/be/de/a7b69ce7e6ef84b7029a2fa7a257762e101eeb968acba17b26298852f413/calmjs.rjs-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e3f68867ec81a84c3b4a4877aeb5afc5", "sha256": "2436bea717fd66f1f35a2862493f8bdfb1ee7e293c22e6510290be62fb47fcb7" }, "downloads": -1, "filename": "calmjs.rjs-2.0.0.zip", "has_sig": false, "md5_digest": "e3f68867ec81a84c3b4a4877aeb5afc5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 91805, "upload_time": "2018-01-12T07:13:32", "url": "https://files.pythonhosted.org/packages/ef/82/1c7abd8149e247a93084cfe591fceaee05308ea81d678827bfff0dfc8768/calmjs.rjs-2.0.0.zip" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "1b4a1ae3b2d975e144bcba1b3bc74d00", "sha256": "91f5d0a5191f9ff4f063960495fafb8f4d2c9da415d1d13710e36d67ce0d504d" }, "downloads": -1, "filename": "calmjs.rjs-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1b4a1ae3b2d975e144bcba1b3bc74d00", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 67478, "upload_time": "2018-05-03T03:06:49", "url": "https://files.pythonhosted.org/packages/ac/63/7c45280d4a8db9a625fbba3b453c973c7cdc666768ffb7f7b098c41f328a/calmjs.rjs-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9b97028b1fac5442635bfa43499877a", "sha256": "e2b507da36c52a5042621f56ba2aad24ab0f7e34eee11c6b2e4935c4700310ff" }, "downloads": -1, "filename": "calmjs.rjs-2.0.1.zip", "has_sig": false, "md5_digest": "c9b97028b1fac5442635bfa43499877a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 92208, "upload_time": "2018-05-03T03:06:52", "url": "https://files.pythonhosted.org/packages/80/56/2085e2c26005b3d6bbca34743b57f9931a56e9f2c9b9db000a955d53fcc1/calmjs.rjs-2.0.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1b4a1ae3b2d975e144bcba1b3bc74d00", "sha256": "91f5d0a5191f9ff4f063960495fafb8f4d2c9da415d1d13710e36d67ce0d504d" }, "downloads": -1, "filename": "calmjs.rjs-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1b4a1ae3b2d975e144bcba1b3bc74d00", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 67478, "upload_time": "2018-05-03T03:06:49", "url": "https://files.pythonhosted.org/packages/ac/63/7c45280d4a8db9a625fbba3b453c973c7cdc666768ffb7f7b098c41f328a/calmjs.rjs-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9b97028b1fac5442635bfa43499877a", "sha256": "e2b507da36c52a5042621f56ba2aad24ab0f7e34eee11c6b2e4935c4700310ff" }, "downloads": -1, "filename": "calmjs.rjs-2.0.1.zip", "has_sig": false, "md5_digest": "c9b97028b1fac5442635bfa43499877a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 92208, "upload_time": "2018-05-03T03:06:52", "url": "https://files.pythonhosted.org/packages/80/56/2085e2c26005b3d6bbca34743b57f9931a56e9f2c9b9db000a955d53fcc1/calmjs.rjs-2.0.1.zip" } ] }