Python with a Node.js-like module system.
Project description
Node.py
Node.py is a Python runtime compatible with CPython 2.7 and 3.3 – 3.6. It provides a separate but superior import mechanism for modules, bringing dependency management and ease of deployment for Python applications up to par with other languages, without virtualenvs.
Node.py is inspired by Node.js.
nppm is Node.py's package manager that allows you to install and manage standard Python packages (using Pip under the hood) as well as Node.py packages without the hazzle of virtual environments. nppm is a powerful tool for deploying Node.py applications and command-line tools. You can find the nppm repository here.
Usage Example
Node.py allows you to write very modular Python applications with module
import semantics that are more easily trackable. It also does not have the
concept of a separate __main__ module as standard Python does. Any valid
Python script is a valid Node.py script.
$ ls
app.py models.py nodepy.json
$ head app.py
import flask
import * from './models' # Node.py special syntax
require('werkzeug-reloader-patch').install() # Node.py require() function
app = flask.Flask('myapp')
# ...
$ cat nodepy.json
{
"name": "myapp",
"pip_dependencies": {
"Flask": ">=1.0.2",
"pony": ">=0.7.3"
},
"dependencies": {
"werkzeug-reloader-patch": "^0.0.7"
}
}
$ nppm install
$ nodepy app
... Starting Flask server at localhost:8000
Installation
Node.py is available from PyPI as nodepy-runtime. The Python version that
you install it into will also be the Python version that you will use in your
Node.py code.
Tip: Add the
--userflag if you don't want to install Node.py system-wide.
$ pip install nodepy-runtime
There are multiple ways of installing nppm. The suggested method is to
use the remote install script. If you want to install a specific version,
pass the Git ref as an argument (eg. develop or v2.0.2). If you don't
specify a tag, the highest tagged version will be installed.
$ nodepy https://nodepy.org/get-nppm.py
Alternatively, you can clone the repository and use the local install script.
$ git clone https://github.com/nodepy/nppm.git
$ nodepy nppm/scripts/install.py
Important: The installer is not able to automatically detect whether Node.py was installed system-wide or with the
--useroption. If you installed Node.py with the--useroption, pass the--globaloption to the install-script (global meaning user-location). The default is to install with--root(system-wide).
Changes
v2.1.5 (2018-08-18)
- Add
Request.copy()method
v2.1.4 (2018-08-13)
- Handle relative package links (actually already in 2.1.3)
v2.1.3 (2018-08-13)
- Fix
PythonLoader.suggest_files(), no longer replaces an existing suffix when trying to add.pysuffix
v2.1.2 (2018-06-15)
- Fix
MANIFEST.inwhich now includesrequirements.txt(required bysetup.py)
v2.1.1 (2018-06-14)
- Release date fix for v2.1.0
v2.1.0 (2018-06-14)
- Rename
nodepy-pmtonppminREADME.md - Add MIT license to the header of all source files
v2.0.3 (2018-06-03)
- The
nodepy.base.Module()constructor now accepts absolute filenames only - Update
setup.pyto include Markdownlong_descriptionand read install requirements fromrequirements.txt
v2.0.2 (2018-03-30)
- The local
.nodepy/pipdirectory is now always added tosys.pathby using theEntryModule.run_with_exec_handler()method instead of loading and executing the module directly PythonLoader.load()no longer adds tosys.pathif the path already is in the list
v2.0.1 (2017-12-19)
PythonLoader._load_code()now uses utf8 encoding by default, however we should try to peek into the file to see if it contains a coding: comment- Always add local
modules_directoryto Context resolve path, this helps projects that use package links - Node.py repl can now also import from
.nodepy/pipdirectory - Fix
resolve_rootoutside of package root - Don't import
pathlibfromnodepy.utils.path, but instead importpathlib2directly. We decided on not using stdpathlibif it is available, as there can be minor differences - Add missing
strict=FalsetoUrlPath.resolve()andZipPath.resolve() - Add info to
nodepy.runtime.scriptsthat it can also holds anargsmember resolve_rootnow taken into account for defaultPackage.mainif it is not explicitly defined, addresolve_rootwhen package entry point is requiredStdResolver.package_for_directory()must resolve the path to eliminate pardir elements, otherwise we can end up with two Packages pointing to the same directory, but one containssubdir/..elements- Update
Module.nameproperty to be able to produce a requirable module name for modules outside a package'sresolve_root - Fixed comparing RequestString with actual request str in
Request.try_()to properly raise TryResolveError - Fix
FrameDebuggerparent calls for Python 2 - Add
Config.sections(), remove debug print inContext.__init__() - Remove
nodepy.default_context, but addnodepy.get_default_context()instead - Add
nodepy.utils.configmodule and addContext.configmember which is initialized from theNODEPY_CONFIGfile or~/.nodepy/config
v2.0.0 (2018-11-24)
- Complete rewrite
- Abstract module resolving interface
- Using the
pathlib2module to abstract the filesystem
Copyright © 2018 Niklas Rosenstein
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file nodepy-runtime-2.1.5.tar.gz.
File metadata
- Download URL: nodepy-runtime-2.1.5.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ead4ac0fbe84a4267191dba5bf505c519b485c658b1ba3ee208db927c493ca01
|
|
| MD5 |
760701ea1842dc8fb5fd7840eabf8cbb
|
|
| BLAKE2b-256 |
1f1127a078946ce67e2f76c98c9465aaee77d24cae0ed1ae442b7269aa061b50
|