normschores
Code for the NormsChores project: a structural household model of gender norms and the division of market work, chores and leisure, with simulated-minimum-distance estimation tools.
The Python package lives in src/normschores/:
| module | contents |
|---|---|
normschores.Chorms |
ChormsClass, the model (solved in C++, see cppfuncs/) |
normschores.estimate |
moments (moments), bootstrap covariance (bootstrap_cov), SMD estimator (SMD) |
normschores.exhibits |
figures and tables for the paper |
normschores.LocalEconModel |
vendored copy of EconModel used for the C++ linking |
normschores/notebooks/ |
the notebooks that reproduce the paper (0_DataMoments.ipynb, 1_EstimateModel.ipynb, ..., _ Run all notebooks.ipynb) |
Requirements
Windows only. The model is solved in C++ which is compiled on first use with Microsoft Visual
Studio (2019/2022 Community is found automatically; for other editions set COMPILER_PATH in the
notebooks, or pass ChormsClass(..., compiler_path="<VS>/VC/Auxiliary/Build/")). The compiled
model_cpp.dll is written to the current working directory. Python 3.12 or newer.
Running the notebooks from the published package
Create a fresh virtual environment, install the package with the notebooks extra (adds ipykernel
and papermill) and copy the notebooks to a working folder. The notebooks write their results
(saved/, output/figures/, output/tables/) relative to the folder they are run from, so always
run them from such a copy, never from inside the installed package.
With uv:
uv venv --python 3.12 .venv
.venv\Scripts\activate
uv pip install "normschores[notebooks]"
normschores-notebooks my_run # copies the notebooks to .\my_run
or with plain pip:
py -3.12 -m venv .venv
.venv\Scripts\activate
pip install "normschores[notebooks]"
normschores-notebooks my_run
Then open the notebooks in my_run with .venv\Scripts\python.exe as the kernel (in VS Code:
Select Kernel → Python Environments; for a browser, also pip install jupyterlab) and run
_ Run all notebooks.ipynb, or the notebooks one at a time in numbered order. normschores-notebooks
refuses to overwrite notebooks already in the folder unless --force is given.
The model can also be used directly:
from normschores import ChormsClass
model = ChormsClass(name="baseline")
model.link_to_cpp() # compiles cppfuncs/model_cpp.cpp shipped with the package
Development setup (repository)
In the repository the notebooks are edited and run in place in src/normschores/notebooks/. Their
results (saved/, output/) are kept next to them but are not included in the built package. The
paper reads the figures and tables from there (\codefigs/\codetabs in _main.tex).
Move to the code directory and run:
Option A — uv
uv sync
This creates .venv, installs normschores in editable mode (so changes in src/ are picked up
directly) and the notebook tools (ipykernel, papermill) from the dev dependency group.
Activate the environment:
# Windows
.venv\Scripts\activate
# Linux / macOS
source .venv/bin/activate
For Jupyter notebooks in VS Code, the kernel is located at .venv\Scripts\python.exe.
Option B — pip + venv
python -m venv .venv
# Windows
.venv\Scripts\activate
# Linux / macOS
source .venv/bin/activate
pip install -r requirements.txt
Option C — Anaconda / conda
conda env create -f environment.yml
conda activate normschores
Releasing
Builds use uv (uv build, with the uv_build backend). Publishing
is done by the GitHub Actions workflow .github/workflows/publish.yml (in the repository root).
To publish a new version to PyPI:
uv version --bump patch # or minor / major; updates pyproject.toml and uv.lock
git commit -am "Release v$(uv version --short)"
git tag "v$(uv version --short)"
git push && git push --tags
Pushing a v* tag runs the workflow, which builds the package and uploads it to PyPI with trusted publishing (no API token stored in GitHub).
One-time setup on PyPI: under Your projects → Publishing add a pending trusted publisher with
owner ThomasHJorgensen, repository NormsChores, workflow publish.yml and environment pypi.
Also create an environment named pypi in the GitHub repository settings.
Appendix: Maintaining dependency files
Updating requirements.txt
requirements.txt is generated by uv from pyproject.toml. After adding or upgrading
packages in pyproject.toml, regenerate it with:
uv lock
uv export --no-hashes -o requirements.txt
Metadata
Release files for normschores 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| normschores-0.1.0.tar.gz | 2.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| normschores-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.8 MB
Release files / normschores-0.1.0.tar.gz
| Download URL | normschores-0.1.0.tar.gz |
|---|---|
| Size | 2.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37fd1b4a4e38dbea53543f43b700ff878054a1de1e0ae632234baabeb266939d
|
|
BLAKE2b-256 checksum How to use checksums |
097396f293eb491d9bfd7e2aa1f2ec68ff79366e64a0b062b03b6d2133fb9e2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / normschores-0.1.0-py3-none-any.whl
| Download URL | normschores-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0337d9b5803c8822dde4d62e643f6f5cd15fe2a7487bcb846fa56f22177ad4a
|
|
BLAKE2b-256 checksum How to use checksums |
52bd025f449ef4ae7474c2f2c7dba47f4abfd0957ec55d7bcf1eec39de4d5b14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|