Command Palette

Search for a command to run...

Hectal
Phase 6: Modules, Packages and Projects
Python · Exercise 4 of 5 PreviousNext
Intermediate

Read a pyproject.toml

Write project_info(text). Its input text is the whole content of a pyproject.toml file, as one string. Parse it with tomllib.loads and return a tuple (name, dependencies): the project name and the dependencies list, both from the [project] table.

If the [project] table has no dependencies key, return an empty list for it.

What Check tests

  1. Reads name and dependencies
  2. Missing dependencies gives []
  3. Two dependencies are kept in order
  4. Other tables are ignored, even when they come first

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

main.py
Sign in to run your code.

Output

Press Run to see what your program prints.