or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli.mdconfiguration.mdenvironment.mdindex.mdnode-install.mdpackage-management.mdutilities.mdversion-management.md
tile.json

tessl/pypi-nodeenv

Node.js virtual environment builder for creating isolated Node.js environments

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/nodeenv@1.9.x

To install, run

npx @tessl/cli install tessl/pypi-nodeenv@1.9.0

index.mddocs/

nodeenv

A comprehensive tool for creating isolated Node.js environments, similar to Python's virtualenv. nodeenv enables developers to install and manage multiple Node.js versions in separate environments without conflicts, supports integration with existing Python virtual environments, and offers extensive configuration options for different Node.js versions, npm versions, SSL settings, and compilation parameters.

Package Information

  • Package Name: nodeenv
  • Package Type: pypi
  • Language: Python
  • Installation: pip install nodeenv

Core Imports

import nodeenv

For programmatic access to specific functions:

from nodeenv import main, Config, create_environment, get_node_versions

Basic Usage

Command Line Usage

Create a new Node.js environment:

nodeenv myenv

Activate the environment:

source myenv/bin/activate

Deactivate the environment:

deactivate_node

Programmatic Usage

import nodeenv
import sys

# Parse command line arguments and create environment
sys.argv = ['nodeenv', '--node=16.20.0', 'my_node_env']  
nodeenv.main()

Architecture

nodeenv follows a modular design with distinct functional areas:

  • Command Line Interface: Argument parsing and main entry point coordination
  • Environment Management: Creation, activation, and configuration of isolated environments
  • Node.js Installation: Downloading, building from source, or copying prebuilt binaries
  • Package Management: npm installation and npm package management from requirements files
  • Version Management: Fetching available versions and determining latest/LTS releases
  • Configuration System: Loading settings from files and managing defaults
  • Shell Integration: Cross-platform activation scripts for bash, zsh, fish, PowerShell, and cmd

This design provides maximum flexibility for development workflows, allowing developers to test applications across different Node.js versions while maintaining clean separation between projects.

Capabilities

Command Line Interface

Main entry point for the nodeenv command-line tool, providing argument parsing, configuration loading, and orchestration of environment creation operations.

def main(): ...
def make_parser(): ...  
def parse_args(check=True): ...
def create_logger(): ...

Command Line Interface

Environment Management

Core functionality for creating, configuring, and managing isolated Node.js virtual environments with shell integration and activation scripts.

def create_environment(env_dir, args): ...
def get_env_dir(args): ...
def install_activate(env_dir, args): ...
def set_predeactivate_hook(env_dir): ...

Environment Management

Node.js Installation

Node.js version management including downloading prebuilt binaries, building from source code, and copying installations with platform-specific optimizations.

def install_node(env_dir, src_dir, args): ...
def install_node_wrapped(env_dir, src_dir, args): ...
def copy_node_from_prebuilt(env_dir, src_dir, node_version): ...
def build_node_from_src(env_dir, src_dir, node_src_dir, args): ...

Node.js Installation

Package Management

npm installation and package management functionality including requirements file processing and package installation with version management.

def install_npm(env_dir, _src_dir, args): ...
def install_npm_win(env_dir, src_dir, args): ...
def install_packages(env_dir, args): ...

Package Management

Version Management

Node.js version discovery, parsing, and selection including fetching available versions from remote repositories and determining latest stable and LTS releases.

def get_node_versions(): ...
def print_node_versions(): ...
def get_last_stable_node_version(): ...
def get_last_lts_node_version(): ...
def parse_version(version_str): ...

Version Management

Configuration Management

Configuration system for managing default settings, loading configuration files, and handling environment-specific options.

class Config(object): ...

Configuration Management

Utility Functions

Cross-platform utility functions for file operations, process execution, network requests, and system compatibility checks.

def mkdir(path): ...
def make_executable(filename): ...
def writefile(dest, content, overwrite=True, append=False): ...
def callit(cmd, show_stdout=True, in_shell=False, **kwargs): ...
def urlopen(url): ...
def copytree(src, dst, symlinks=False, ignore=None): ...

Utility Functions

Types

class Config(object):
    """Configuration namespace with defaults and loading capabilities."""
    node: str
    npm: str
    with_npm: bool
    jobs: str
    without_ssl: bool
    debug: bool
    profile: bool
    make: str
    prebuilt: bool
    ignore_ssl_certs: bool
    mirror: str
    
    @classmethod
    def _load(cls, configfiles, verbose=False): ...
    
    @classmethod  
    def _dump(cls): ...

Constants

nodeenv_version: str  # Package version string
is_PY3: bool         # Python 3 detection flag
is_WIN: bool         # Windows platform detection flag  
is_CYGWIN: bool      # Cygwin platform detection flag
ignore_ssl_certs: bool  # SSL certificate validation flag
src_base_url: str    # Base URL for Node.js downloads