79095936

Date: 2024-10-16 22:03:46
Score: 1.5
Natty:
Report link

Here's a way to achieve this: Create a separate virtual environment: You can create a virtual environment specifically for development purposes this way, you can install IPython and other development tools without affecting the main project dependencies.

Update your pyproject.toml: You can specify the virtual environment path in your pyproject.toml and ensure it's used during development1

pyproject.toml:

[project]
name = "demo"
description = "Demo Project"
version = "0.0.1"
readme = "README.md"
requires-python = ">=3.12"
dependencies = []

[project.optional-dependencies]
test = [
    "pytest",
    "ipython",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.envs.default]
type = "virtual"
path = "venv"
python = "3.12"

Use the following command to activate the virtual environment and install IPython:

hatch env shell

pip install ipython This way, IPython will be available in your development environment without being listed as a project dependency.

Does this approach work for you?

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Rad Taren