or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli.mdconfiguration.mdenvironment.mdexceptions.mdindex.mdproject.mdroutines.mdutilities.md
tile.json

tessl/pypi-pipenv

Python Development Workflow for Humans.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pipenv@2025.0.x

To install, run

npx @tessl/cli install tessl/pypi-pipenv@2025.0.0

index.mddocs/

Pipenv

Python Development Workflow for Humans. Pipenv is a Python virtualenv management tool that combines pip and virtualenv functionality into a single tool, automatically creating and managing virtual environments for projects while using Pipfile and Pipfile.lock for dependency management instead of requirements.txt files.

Package Information

  • Package Name: pipenv
  • Language: Python
  • Installation: pip install pipenv
  • Requirements: Python 3.9+

Core Imports

import pipenv
from pipenv.project import Project
from pipenv.environment import Environment

CLI usage (most common):

pipenv install  # Install packages
pipenv shell    # Activate shell
pipenv run      # Run commands

Basic Usage

# Programmatic usage - Project management
from pipenv.project import Project

# Create project instance
project = Project()

# Access project information
print(f"Project: {project.name}")
print(f"Python: {project.environment.python}")
print(f"Packages: {list(project.packages.keys())}")

# Add packages programmatically
project.add_package_to_pipfile("requests", "requests>=2.25.0")

# Get environment and check installations
env = project.environment
installed = env.get_installed_packages()

CLI usage (typical workflow):

# Create and manage projects
pipenv install requests              # Install and add to Pipfile
pipenv install pytest --dev         # Install dev dependency
pipenv shell                         # Activate environment
pipenv run python script.py         # Run command in environment
pipenv lock                          # Generate lock file
pipenv sync                          # Install from lock file

Architecture

Pipenv provides both a command-line interface and programmatic API:

  • CLI Layer: Click-based command interface with 15+ commands
  • Project Layer: Core Project class managing Pipfiles, lockfiles, and environments
  • Environment Layer: Virtual environment management and package operations
  • Utility Layer: File operations, dependency parsing, shell integration
  • Routine Layer: High-level operations for install, sync, update, etc.

Capabilities

Command Line Interface

Complete CLI with 15 commands for managing Python projects including installation, environment management, dependency resolution, and project operations.

def cli():
    """Main CLI entry point with global options and subcommands."""

# Main commands
def install(*packages, **options): ...
def uninstall(*packages, **options): ...
def lock(**options): ...
def sync(**options): ...
def shell(**options): ...
def run(*command, **options): ...

Command Line Interface

Project Management

Core Project class for programmatic management of Pipfiles, lockfiles, and project metadata. Handles file operations, package tracking, and project configuration.

class Project:
    def __init__(self, python_version=None, chdir=True): ...
    def add_package_to_pipfile(self, package, pip_line, dev=False, category=None): ...
    def remove_package_from_pipfile(self, package_name, category): ...
    def load_lockfile(self, expand_env_vars=True): ...
    def write_lockfile(self, content): ...
    def create_pipfile(self, python=None): ...
    
    # Properties
    name: str
    pipfile_location: str
    lockfile_location: str
    virtualenv_location: str
    parsed_pipfile: dict
    packages: dict
    dev_packages: dict

Project Management

Environment Management

Virtual environment operations including package installation, version checking, and environment activation. Manages Python interpreters and installed packages.

class Environment:
    def __init__(self, prefix, python=None, is_venv=False): ...
    def get_installed_packages(self) -> list: ...
    def get_outdated_packages(self, pre: bool = False): ...
    def is_installed(self, pkgname): ...
    def is_satisfied(self, req): ...
    def activated(self): ...  # Context manager
    
    # Properties
    python: str
    prefix: str
    python_version: str
    sys_path: list

Environment Management

Configuration Management

Environment variable-based configuration system controlling pipenv behavior. Provides access to all configuration options and settings.

class Setting:
    # Key properties
    PIPENV_CACHE_DIR: str
    PIPENV_VENV_IN_PROJECT: bool
    PIPENV_VERBOSE: bool
    PIPENV_QUIET: bool
    PIPENV_SKIP_LOCK: bool
    PIPENV_MAX_DEPTH: int
    # ... and many more configuration options

Configuration

Utilities and Helpers

Utility functions for dependency parsing, shell operations, file handling, script parsing, and system integration. Includes constants, type definitions, and helper functions.

# Dependencies
def get_version(pipfile_entry): ...
def python_version(path_to_python): ...
def determine_package_name(): ...

# Shell utilities
def make_posix(path: str) -> str: ...
def chdir(path): ...  # Context manager
def load_path(python): ...

# File utilities
def find_pipfile(max_depth=3): ...
def ensure_pipfile(): ...

# Script parsing
class Script:
    @classmethod
    def parse(cls, value): ...
    def cmdify(self): ...

Utilities

Exception Handling

Comprehensive exception hierarchy for handling various error conditions including file operations, command execution, and dependency resolution failures.

class PipenvException(Exception): ...
class PipenvCmdError(PipenvException): ...
class PipenvUsageError(PipenvException): ...
class PipfileNotFound(PipenvException): ...
class VirtualenvCreationException(PipenvException): ...
class InstallError(PipenvException): ...
class ResolutionFailure(PipenvException): ...

Exception Handling

Routines

High-level operations that implement core pipenv functionality. These functions provide the main business logic for install, lock, sync, and other operations.

def do_install(project, **kwargs): ...
def do_lock(project, **kwargs): ...
def do_sync(project, **kwargs): ...
def do_uninstall(project, **kwargs): ...
def do_shell(project, **kwargs): ...
def do_run(project, command, args, **kwargs): ...

Routines

Version Information

__version__: str  # "2025.0.4"

Access version information:

from pipenv import __version__
print(__version__)  # "2025.0.4"