or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

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

0

# nodeenv

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: nodeenv

7

- **Package Type**: pypi

8

- **Language**: Python

9

- **Installation**: `pip install nodeenv`

10

11

## Core Imports

12

13

```python

14

import nodeenv

15

```

16

17

For programmatic access to specific functions:

18

19

```python

20

from nodeenv import main, Config, create_environment, get_node_versions

21

```

22

23

## Basic Usage

24

25

### Command Line Usage

26

27

Create a new Node.js environment:

28

29

```bash

30

nodeenv myenv

31

```

32

33

Activate the environment:

34

35

```bash

36

source myenv/bin/activate

37

```

38

39

Deactivate the environment:

40

41

```bash

42

deactivate_node

43

```

44

45

### Programmatic Usage

46

47

```python

48

import nodeenv

49

import sys

50

51

# Parse command line arguments and create environment

52

sys.argv = ['nodeenv', '--node=16.20.0', 'my_node_env']

53

nodeenv.main()

54

```

55

56

## Architecture

57

58

nodeenv follows a modular design with distinct functional areas:

59

60

- **Command Line Interface**: Argument parsing and main entry point coordination

61

- **Environment Management**: Creation, activation, and configuration of isolated environments

62

- **Node.js Installation**: Downloading, building from source, or copying prebuilt binaries

63

- **Package Management**: npm installation and npm package management from requirements files

64

- **Version Management**: Fetching available versions and determining latest/LTS releases

65

- **Configuration System**: Loading settings from files and managing defaults

66

- **Shell Integration**: Cross-platform activation scripts for bash, zsh, fish, PowerShell, and cmd

67

68

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

69

70

## Capabilities

71

72

### Command Line Interface

73

74

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

75

76

```python { .api }

77

def main(): ...

78

def make_parser(): ...

79

def parse_args(check=True): ...

80

def create_logger(): ...

81

```

82

83

[Command Line Interface](./cli.md)

84

85

### Environment Management

86

87

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

88

89

```python { .api }

90

def create_environment(env_dir, args): ...

91

def get_env_dir(args): ...

92

def install_activate(env_dir, args): ...

93

def set_predeactivate_hook(env_dir): ...

94

```

95

96

[Environment Management](./environment.md)

97

98

### Node.js Installation

99

100

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

101

102

```python { .api }

103

def install_node(env_dir, src_dir, args): ...

104

def install_node_wrapped(env_dir, src_dir, args): ...

105

def copy_node_from_prebuilt(env_dir, src_dir, node_version): ...

106

def build_node_from_src(env_dir, src_dir, node_src_dir, args): ...

107

```

108

109

[Node.js Installation](./node-install.md)

110

111

### Package Management

112

113

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

114

115

```python { .api }

116

def install_npm(env_dir, _src_dir, args): ...

117

def install_npm_win(env_dir, src_dir, args): ...

118

def install_packages(env_dir, args): ...

119

```

120

121

[Package Management](./package-management.md)

122

123

### Version Management

124

125

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

126

127

```python { .api }

128

def get_node_versions(): ...

129

def print_node_versions(): ...

130

def get_last_stable_node_version(): ...

131

def get_last_lts_node_version(): ...

132

def parse_version(version_str): ...

133

```

134

135

[Version Management](./version-management.md)

136

137

### Configuration Management

138

139

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

140

141

```python { .api }

142

class Config(object): ...

143

```

144

145

[Configuration Management](./configuration.md)

146

147

### Utility Functions

148

149

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

150

151

```python { .api }

152

def mkdir(path): ...

153

def make_executable(filename): ...

154

def writefile(dest, content, overwrite=True, append=False): ...

155

def callit(cmd, show_stdout=True, in_shell=False, **kwargs): ...

156

def urlopen(url): ...

157

def copytree(src, dst, symlinks=False, ignore=None): ...

158

```

159

160

[Utility Functions](./utilities.md)

161

162

## Types

163

164

```python { .api }

165

class Config(object):

166

"""Configuration namespace with defaults and loading capabilities."""

167

node: str

168

npm: str

169

with_npm: bool

170

jobs: str

171

without_ssl: bool

172

debug: bool

173

profile: bool

174

make: str

175

prebuilt: bool

176

ignore_ssl_certs: bool

177

mirror: str

178

179

@classmethod

180

def _load(cls, configfiles, verbose=False): ...

181

182

@classmethod

183

def _dump(cls): ...

184

```

185

186

## Constants

187

188

```python { .api }

189

nodeenv_version: str # Package version string

190

is_PY3: bool # Python 3 detection flag

191

is_WIN: bool # Windows platform detection flag

192

is_CYGWIN: bool # Cygwin platform detection flag

193

ignore_ssl_certs: bool # SSL certificate validation flag

194

src_base_url: str # Base URL for Node.js downloads

195

```