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
- The line
[tool.uv.sources] populationsim = { workspace = true } should be removed - it's only for monorepo setups and causes confusion
- 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
- Clone the PopulationSim repository
- Run
uv sync --python 3.10
- Attempt to import:
python -c "from populationsim.run import add_run_args"
- Observe:
ModuleNotFoundError: No module named 'populationsim.run'
- Run
uv pip install -e . as workaround
- Import now succeeds
References
Description
The PopulationSim repository's
pyproject.tomlis missing a[build-system]section, which prevents the package from being installed when using modern Python package managers likeuv sync. This causesModuleNotFoundError: No module named 'populationsim.run'when attempting to import the package after environment setup.Root Cause
The
pyproject.tomllacks a[build-system]section that tells packaging tools (pip, uv, build, etc.) which build backend to use. Without this section:uv synconly installs dependencies but does not install the package itself.venvwith all dependenciesCurrent pyproject.toml structure
Comparison with ActivitySim (works correctly)
Proposed Fix
Add a
[build-system]section at the top ofpyproject.toml:Additional Issues
[tool.uv.sources] populationsim = { workspace = true }should be removed - it's only for monorepo setups and causes confusionsetuptools_scmif you want version management from git tagsImpact
uv sync,pip install -e .with modern pip versions, or PEP 517-compliant build toolsuv pip install -e .explicitly afteruv syncto trigger legacy setuptools detection[build-system]configurationsSteps to Reproduce
uv sync --python 3.10python -c "from populationsim.run import add_run_args"ModuleNotFoundError: No module named 'populationsim.run'uv pip install -e .as workaroundReferences