This repository contains a small, working Python module. It can be imported while you are in the repository, but it is not an installable project yet.
Your task is to turn it into a minimal src/-layout package while preserving its public functions and behavior.
Create or activate an environment and install pytest:
python -m pip install -r requirements-dev.txtRun the example and tests:
python example.py
python -m pytestBoth should pass. Installation currently fails because the repository has no package metadata:
python -m pip install -e .Create this layout:
.
├── pyproject.toml
├── src/
│ └── measurement_tools/
│ ├── __init__.py
│ └── analysis.py
├── example.py
└── tests/
└── test_measurement_tools.py
Move the existing module rather than copying it:
mkdir -p src/measurement_tools
git mv measurement_tools.py src/measurement_tools/analysis.pyCreate src/measurement_tools/__init__.py and import these functions from .analysis so callers can continue importing them directly from measurement_tools:
center_measurementsmean_measurement
Create pyproject.toml:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "measurement-tools"
version = "0.1.0"
description = "Small helpers for laboratory measurements"
readme = "README.md"
requires-python = ">=3.11"
[tool.pytest.ini_options]
addopts = "-q"
testpaths = ["tests"]Install the project in editable mode. Editable installation means that changes under src/ are immediately visible without reinstalling:
python -m pip install -e .
python example.py
python -m pytest
python -c "from measurement_tools import mean_measurement"Inspect and commit your changes, then submit:
git status
git diff --stat
git add pyproject.toml src
git commit -m "Package measurement tools"
gh student submit