QuizzesPackaging with pyproject.toml — From Script to Installable Package — Concept Check
intermediate
python

Packaging with pyproject.toml — From Script to Installable Package — Concept Check

Questions on Packaging with pyproject.toml — From Script to Installable Package. pyproject.toml is the single modern config for a Python package: metadata, dependencies, and console scripts in one file — pip install -e . for development, python -m build + twine to publish.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Packaging with pyproject.toml — From Script to Installable Package — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.You have a Python project with a src/ layout. What is the main advantage of this layout?

    • AAutomatically includes all dependencies without listing them
    • BSimplifies the build process by eliminating the need for pyproject.toml
    • CAllows the package to be installed without a virtual environment
    • DPrevents accidental imports from the local folder instead of the installed package
  2. 2.A developer wants to make changes to a Python package and see the effects immediately. Which command should they use?

    • Atwine upload dist/*
    • Bpython -m build
    • Cpip install build twine
    • Dpip install -e .
  3. 3.What happens if you try to upload the same version of a package to PyPI again?

    • AThe package overwrites the previous version on PyPI
    • BPyPI rejects it, as it never accepts the same version twice
    • CPyPI accepts it but marks it as a duplicate
    • DThe upload fails silently without any error
  4. 4.A developer added a new dependency to pyproject.toml but it isn't being recognized. What might they have forgotten to do?

    • AEdit the src/ layout to reflect the new dependency
    • BRun pip install -e . again to update the environment
    • CRename the pyproject.toml file to setup.py
    • DRebuild the package with python -m build
  5. 5.Which section in pyproject.toml is used to define command-line tools?

    • A[project.scripts]
    • B[build-system]
    • C[project.dependencies]
    • D[project.optional-dependencies]
  6. 6.What is the purpose of the 'requires' field in the [build-system] section of pyproject.toml?

    • ASpecifies the build tools needed, like hatchling
    • BSpecifies optional development dependencies
    • CDefines the Python version required
    • DLists all runtime dependencies
  7. 7.A developer wants to publish their package to TestPyPI before the real PyPI. Which command should they use first?

    • Apip install -e .
    • Bpython -m build
    • Cpip install build twine
    • Dtwine upload --repository testpypi dist/*