Skip to main content

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 model code and notebooks to a working folder with normschores-copy.

The notebooks import the model code from the folder above them (from Chorms import *, from estimate.moments import ..., import exhibits), not from the installed normschores. A copy is therefore self-contained: edits to its Chorms.py, estimate/, exhibits.py and cppfuncs/*.cpp are what its notebooks use. The notebooks write their results (saved/, output/figures/, output/tables/, model_cpp.dll) into the copy's notebooks/ folder.

With uv:

uv venv --python 3.12 .venv
.venv\Scripts\activate
uv pip install "normschores[notebooks]"
normschores-copy my_run      # copies the code and notebooks to .\my_run

or with plain pip:

py -3.12 -m venv .venv
.venv\Scripts\activate
pip install "normschores[notebooks]"
normschores-copy my_run

Then open the notebooks in my_run\notebooks 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-copy refuses to write into a folder that is not empty unless --force is given.

The copy also contains requirements.txt (the exact versions of all dependencies the package was released with, incl. the notebook tools) and environment.yml. They can be used instead of pip install "normschores[notebooks]" to set up an environment for the copy that does not depend on the installed package, e.g. on another machine:

cd my_run
pip install -r requirements.txt        # or: conda env create -f environment.yml

After editing C++ files, set DO_COMPILE = True (and restart the kernel) so model_cpp.dll is rebuilt; otherwise an existing dll in the notebook folder is reused. Python edits are picked up by the notebooks' %autoreload, or after a kernel restart.

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 src/normschores/requirements.txt   # pinned dependencies
pip install -e . --no-deps                        # normschores itself, in editable mode

Option C — Anaconda / conda

conda env create -f src/normschores/environment.yml
conda activate normschores
pip install -e . --no-deps                        # normschores itself, in editable mode

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 and environment.yml live inside the package (src/normschores/), so they are shipped with it and copied by normschores-copy. 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 --no-emit-project -o src/normschores/requirements.txt

--no-emit-project leaves out the package itself (-e .), so the file also works in a copied folder, where the notebooks use the code next to them.

Metadata

Release files for normschores 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for normschores 0.3.0
File Size Uploaded Provenance Actions
normschores-0.3.0.tar.gz 1.8 MB Without provenance Details for normschores-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for normschores 0.3.0
File Interpreter ABI Platform Actions
normschores-0.3.0-py3-none-any.whl Python 3 none any Details for normschores-0.3.0-py3-none-any.whl

Total release size: 3.6 MB

Release files / normschores-0.3.0.tar.gz

Download URL normschores-0.3.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
6d17c9c7d92d4e68b2865c6d4ecbc56c9bfb6b829544ccd47309aef162a689e7
BLAKE2b-256 checksum
How to use checksums
8eacf12bd228fba45102d232ab2737ec099fa5fe29e304cbc361d5ed4bc167e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / normschores-0.3.0-py3-none-any.whl

Download URL normschores-0.3.0-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4a21dc7295d412b7606e919e48cb573f0b8e2758614ee37218360414fc0498e3
BLAKE2b-256 checksum
How to use checksums
9c6d154b24f67650594f8547336a2a8d980f754640701e790622dab57fdc81b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for normschores 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page