[Python] Managing Python venv folder sizes across multiple projects

Discussão em 'Python' iniciado por Stack, Setembro 25, 2024.

  1. Stack

    Stack Membro Participativo

    I'm trying to follow best practice and use a separate venv for each package I'm working on. I typically need numpy and scipy for the packages at minimum; optional dependencies usually include matplotlib; and then the usual suite of dev packages. This ends up creating a venv folder that is about 0.6 GB. That's a lot of wasted space when I look back over all the packages I've created. Is this really what developers do in practice?

    Example toml:

    [build-system]
    requires = ["setuptools", "wheel"]
    build-backend = "setuptools.build_meta"

    [project]
    name = ""
    version = ""
    description = ""
    authors = ""
    readme = ""
    license = ""
    requires-python = ">=3.7"
    dependencies = [
    "numpy",
    "pandas",
    "scipy",
    ]

    [project.optional-dependencies]
    examples = [
    "jupyter",
    "matplotlib",
    ]
    dev = [
    "pytest",
    "pytest-cov",
    "black",
    "flake8",
    "twine",
    "sphinx",
    "sphinx_rtd_theme",
    "pydocstyle",
    "myst-parser",
    "pre-commit",
    "toml",
    "build"
    ]

    [tool.setuptools]
    package-dir = {"" = "src"}
    packages = { find = { where = ["src"] } }
    include-package-data = true

    [tool.coverage.run]
    relative_files = true

    [project.urls]
    homepage = ""
    repository = ""
    documentation = ""

    Continue reading...

Compartilhe esta Página