nerdexam
Cisco

300-635 · Question #11

A set of automation scripts work with no issue from a local machine, but an experiment needs to take place with a new package found online. How is this new package isolated from the main code base?

The correct answer is D. Create a new virtual environment and perform a pip install of the new package.. Creating a virtual environment (option D) isolates the new package in its own sandboxed Python environment, keeping its dependencies completely separate from the main codebase - if the experiment breaks or conflicts arise, you simply delete the virtual environment with no impact

Network Programmability Foundation

Question

A set of automation scripts work with no issue from a local machine, but an experiment needs to take place with a new package found online. How is this new package isolated from the main code base?

Options

  • AAdd the new package to your requirements.txt file.
  • BCreate a new virtual machine and perform a pip install of the new package.
  • CPerform a pip install of the new package when logged into your local machine as root.
  • DCreate a new virtual environment and perform a pip install of the new package.

How the community answered

(20 responses)
  • A
    10% (2)
  • B
    5% (1)
  • C
    15% (3)
  • D
    70% (14)

Explanation

Creating a virtual environment (option D) isolates the new package in its own sandboxed Python environment, keeping its dependencies completely separate from the main codebase - if the experiment breaks or conflicts arise, you simply delete the virtual environment with no impact on the working scripts.

Why the distractors fail:

  • A is wrong because adding the package to requirements.txt records it as a dependency but doesn't isolate it - it would be installed into whatever environment is currently active, potentially breaking existing code.
  • B is overkill and resource-heavy; a full virtual machine provides OS-level isolation but is far heavier than needed when Python already has a lightweight isolation mechanism built in.
  • C is dangerous - installing as root affects the system-wide Python installation, which could destabilize other scripts, system tools, or the OS itself.

Memory tip: Think of a virtual environment as a "clean room" for Python - lightweight, disposable, and scoped to just your project. The key word in the question is isolated, and only a virtual environment (venv/virtualenv) provides isolation within Python without the overhead of a full VM.

Topics

#Python virtual environments#Dependency isolation#Package management#Development practices

Community Discussion

No community discussion yet for this question.

Full 300-635 Practice