Skip to content

Missing build-system in pyproject.toml prevents package installation via uv sync #218

Description

@bwentl

Description

The PopulationSim repository's pyproject.toml is missing a [build-system] section, which prevents the package from being installed when using modern Python package managers like uv sync. This causes ModuleNotFoundError: No module named 'populationsim.run' when attempting to import the package after environment setup.

Root Cause

The pyproject.toml lacks a [build-system] section that tells packaging tools (pip, uv, build, etc.) which build backend to use. Without this section:

  • uv sync only installs dependencies but does not install the package itself
  • The package remains unimportable despite having a valid .venv with all dependencies

Current pyproject.toml structure

[project]
name = "populationsim"
version = "0.10.0"
# ... dependencies ...

[tool.setuptools.packages.find]
where = ["."]

[tool.uv.sources]
populationsim = { workspace = true }  # ← Also problematic - not a monorepo

[project.scripts]
populationsim = "populationsim.__main__:main"

Comparison with ActivitySim (works correctly)

[build-system]
requires = ["setuptools>=69", "wheel", "setuptools_scm>=8.0"]
build-backend = "setuptools.build_meta"

[project]
name = "activitysim"
# ... rest of config ...

Proposed Fix

Add a [build-system] section at the top of pyproject.toml:

[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "populationsim"
# ... rest remains the same ...

Additional Issues

  1. The line [tool.uv.sources] populationsim = { workspace = true } should be removed - it's only for monorepo setups and causes confusion
  2. Consider adding setuptools_scm if you want version management from git tags

Impact

  • Affected workflows: Any installation using uv sync, pip install -e . with modern pip versions, or PEP 517-compliant build tools
  • Workaround: Users must run uv pip install -e . explicitly after uv sync to trigger legacy setuptools detection
  • Similar projects affected: None - ActivitySim and other similar projects have proper [build-system] configurations

Steps to Reproduce

  1. Clone the PopulationSim repository
  2. Run uv sync --python 3.10
  3. Attempt to import: python -c "from populationsim.run import add_run_args"
  4. Observe: ModuleNotFoundError: No module named 'populationsim.run'
  5. Run uv pip install -e . as workaround
  6. Import now succeeds

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions