Skip to main content

Python Prompt to Set Up Virtual Environment and Dependency Management

Set up Python virtual environments across projects with dependency isolation, reproducible builds and team-wide consistency.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Create a comprehensive Python virtual environment and dependency management setup for a 12-person team working on 6 Python projects. Projects use Python 3.11 and 3.12 and the team operates on macOS (Apple Silicon), Ubuntu 22.04, and Windows 11. Build this management system: 1) Compare and recommend the best tool for our needs from Poetry, uv, PDM, pip-tools, and conda — for each tool, evaluate: environment isolation quality, dependency resolution speed, lock file reliability, monorepo support, Python version management, and CI/CD integration. Provide a decision matrix and recommend uv with justification. 2) Set up the recommended tool for a new project: write the complete configuration file (pyproject.toml) with: Python version constraint, production dependencies with version pinning strategy (minimum version in pyproject.toml, exact pins in lock file), development dependencies (testing, linting, typing), optional dependency groups for docs (Sphinx), notebooks (Jupyter), and profiling (py-spy), and scripts/tasks for common operations. 3) Create a team onboarding guide: step-by-step instructions for installing the tool on macOS (Apple Silicon), Ubuntu 22.04, and Windows 11, cloning a project and setting up the environment, adding/removing/updating dependencies, and troubleshooting conflicting versions, missing system libraries, and platform-specific wheels. 4) Implement a CI/CD integration: write the GitHub Actions workflow that creates the environment, installs dependencies from the lock file (not pyproject.toml) for reproducibility, caches the virtual environment keyed on OS, Python version, and lock file hash, and runs tests/linting/type checking. 5) Build a dependency audit workflow: check for security vulnerabilities using pip-audit or safety, identify outdated packages with automation to create update PRs, verify license compliance against MIT, BSD, Apache-2.0, and ISC, and generate a dependency tree visualization. 6) Handle complex scenarios: managing private package repositories (a private PyPI server hosted on AWS CodeArtifact), using local editable packages for development, pinning transitive dependencies that cause conflicts, and maintaining 3 (Python 3.10, 3.11, 3.12) separate environments for testing against different Python versions. 7) Create a Makefile or task runner with commands: setup, install, update, lock, test, lint, format, audit, clean, and publish — each with help text and error handling.

What this prompt does

This prompt makes the AI design a full Python virtual-environment and dependency-management setup for a real team, scaled by [team_size] and [project_count] and constrained by the [python_versions] and [operating_systems] you actually run. It first compares the tools in [tools_to_evaluate] against criteria like resolution speed and lock-file reliability, produces a decision matrix, and justifies [recommended_tool]. That comparison step is what stops the output from being a generic README and ties it to your environment.

The structure works because reproducibility comes from specifics. [config_file] and [pinning_strategy] define how versions are constrained; [optional_groups] separates docs, notebooks, and profiling dependencies; [ci_platform] and [cache_key] wire it into CI installing from the lock file rather than the manifest; and [security_tool], [allowed_licenses], and [private_repo] cover auditing and private packages. The [env_count] and [common_issues] variables push the AI toward multi-version testing and real troubleshooting instead of a happy path. Because you declare [team_size] and the [operating_systems] in play, the onboarding guide accounts for platform-specific wheels and missing system libraries rather than assuming everyone is on the same machine. The [ci_platform] and [cache_key] pairing makes builds both fast and reproducible, and the [private_repo] variable ensures the guide includes the auth configuration your team actually needs to pull internal packages.

When to use it

  • You are starting a Python project and want reproducible builds from day one
  • Your team spans macOS, Linux, and Windows and hits works-on-my-machine drift
  • You need to standardize tooling across several projects at once
  • You want CI that installs from a lock file for guaranteed reproducibility
  • You need a dependency audit covering vulnerabilities and license compliance
  • You manage private packages and need editable installs for local development

Example output

The AI returns a decision matrix recommending a tool, a complete [config_file] with pinned production and grouped optional dependencies, a step-by-step onboarding guide per OS, a [ci_platform] workflow that installs from the lock file and caches on [cache_key], a dependency-audit workflow, and a Makefile or task runner exposing setup, install, update, lock, test, lint, format, audit, clean, and publish commands with help text.

Pro tips

  • List the tools you would genuinely consider in [tools_to_evaluate]; dropping ones you have ruled out keeps the matrix focused
  • Be precise in [pinning_strategy] — minimum versions in the manifest with exact pins in the lock file is what makes CI deterministic
  • Set [cache_key] to include the lock-file hash so cache busts correctly when dependencies change
  • Name your real [private_repo] so the onboarding guide includes the correct auth configuration
  • Use [env_count] to match the Python versions you test against, not an aspirational number
  • The Makefile is the piece a mixed-OS team relies on daily — keep its command names stable once adopted

Frequently Asked Questions

Does the prompt force a specific tool like Poetry or uv?
No. You set `[recommended_tool]` and `[tools_to_evaluate]`; the AI builds a decision matrix and justifies the choice against your criteria. The default leans toward uv, but you can swap it for Poetry, PDM, pip-tools, or conda.
Why does the CI step install from the lock file instead of pyproject.toml?
Installing from the lock file pins exact transitive versions, so every CI run and every developer gets an identical environment. Installing from the manifest would re-resolve dependencies and reintroduce the version drift the whole setup is meant to eliminate.
Does it handle multiple Python versions and operating systems?
Yes. `[python_versions]` and `[operating_systems]` drive the onboarding guide and CI, and `[env_count]` sets how many separate test environments to maintain across Python versions. The platform-specific wheel and missing-library issues are covered under troubleshooting.
Can it cover security and license auditing?
It builds an audit workflow using `[security_tool]` for vulnerabilities, checks licenses against `[allowed_licenses]`, flags outdated packages, and can generate a dependency tree. Treat the license check as a first pass, not legal sign-off.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Python & Automation Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support