Manuals / Python / Chapter 11

E · Ship · intermediate · Week 6–7 · Chapter 11 of 13

Packaging lite — pyproject.toml & entry points

You do not need to publish to PyPI yet. pyproject.toml declares project metadata and dependencies. pip install -e . makes your package importable. Entry points turn modules into CLI commands.

Path progress
79%

Step 1 of 4

Minimal pyproject.toml

PEP 621 project table: name, version, dependencies. Build backend can be hatchling or setuptools — keep it minimal.

Minimal pyproject.tomlDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Minimal pyproject.drag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Example

[project]
name = "py-journey"
version = "0.1.0"
dependencies = ["httpx>=0.27", "pytest>=8.0"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

Do this now

Add pyproject.toml to py-journey with project name, version 0.1.0, dependencies from requirements.txt.

Was this step clear?
Chapter learning outcomes
  • pyproject.toml basics
  • pip install -e .
  • Console scripts entry points
  • src layout packaging

Clear these before you leave

Side quest

Shareable tool

Extract retry() helper into installable subpackage. Friend clones repo and runs pip install -e . successfully.