Implementation & Configuration Flashcards
7 cards from real POC practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Implementation & Configuration flashcards as text
What does the `PYTHONPATH` environment variable control?
Answer: Additional directories prepended to `sys.path` for module searching
`PYTHONPATH` is a colon-separated list of directories that Python prepends to `sys.path` before the interpreter starts.
Which `setup.py` command builds a source distribution archive?
Answer: python setup.py sdist
`python setup.py sdist` creates a source distribution tarball (`.tar.gz`) in the `dist/` directory.
What is the role of `__init__.py` in a Python package directory?
Answer: It marks the directory as a Python package and runs on import
`__init__.py` signals to Python that the directory is a package and its code runs when the package is first imported.
Which approach correctly reads a value from an environment variable with a fallback default in Python?
Answer: os.environ.get('KEY', 'default')
`os.environ.get('KEY', 'default')` returns the environment variable value or 'default' if the key is absent.
In Python packaging, what does a `MANIFEST.in` file specify?
Answer: Additional files to include in source distributions
`MANIFEST.in` uses directives like `include` and `recursive-include` to add non-Python files (docs, data) to a source distribution.
What is the effect of setting `PYTHONDONTWRITEBYTECODE=1` in the environment?
Answer: Python does not write `.pyc` bytecode cache files to disk
Setting this variable prevents Python from creating `__pycache__` directories and `.pyc` files during import.
Which `pip` flag installs a package without its dependencies?
Answer: --no-deps
`pip install --no-deps package` installs only the specified package while ignoring its declared dependencies.