From 216d08d5932f2cb85225b861649fcae4389b057b Mon Sep 17 00:00:00 2001 From: Valentin Pratz Date: Wed, 22 May 2024 22:10:23 +0200 Subject: [PATCH] add metadata and project tools --- .gitignore | 3 +++ .pre-commit-config.yaml | 54 +++++++++++++++++++++++++++++++++++++++++ README.md | 18 ++++++++++++++ pyproject.toml | 18 ++++++++++++++ requirements.txt | 34 ++++++++++++++++++++++++++ 5 files changed, 127 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 pyproject.toml create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index c69b121..ccdebb5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ **/__pycache__ *.pdf +*.egg-info +**/.ipynb_checkpoints +*.sif diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..10134bb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,54 @@ +############################ +# Pre-commit configuration # +############################ + +# Install via `pip install pre-commit` + +# This is run as a precondition to commits, run manually via `pre-commit run` + +# When adding new hooks, it may make sense to once run +# `pre-commit run --all-files` as by default only changed files are checked + +# Automatically run before every commit via once running `pre-commit install` + +repos: +- repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + description: The uncompromising code formatter +- repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + name: isort (python) + - id: isort + name: isort (cython) + types: [cython] + - id: isort + name: isort (pyi) + types: [pyi] +- repo: https://github.com/nbQA-dev/nbQA + rev: 1.6.3 + hooks: + - id: nbqa-black + - id: nbqa-pyupgrade + args: [--py36-plus] + - id: nbqa-isort +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + description: Check yaml files for parseable syntax + - id: check-added-large-files + description: Prevent large files from being committed + - id: check-merge-conflict + description: Check for files that contain merge conflict strings + - id: check-symlinks + description: Check for symlinks which do not point to anything + - id: trailing-whitespace + description: Trim trailing whitespaces + - id: end-of-file-fixer + description: Fix empty lines at ends of files + - id: detect-private-key + description: Detects the presence of private keys diff --git a/README.md b/README.md index 6152200..cb685c2 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,21 @@ The code builds on https://github.com/vislearn/inn_toy_data/. The benchmark was proposed first in the following paper: Kruse, J., Ardizzone, L., Rother, C., & Köthe, U. (2021). Benchmarking Invertible Architectures on Inverse Problems (arXiv:2101.10763). arXiv. https://doi.org/10.48550/arXiv.2101.10763 + +## Development + +We manage dependencies in `pyproject.toml` and lock them in `requirements.txt` using `pip-compile` from the [pip-tools suite](https://github.com/jazzband/pip-tools). Automated formatting and checks are achieved using `pre-commit`. + +TODO: Insert all installation steps with corresponding commands. + +For development: + +1. Set up a new Python environment +2. Install dependencies using `pip install -r requirements.txt` +3. Activate pre-commit hooks using `pre-commit install` + +For adding a dependency: + +1. Add it to `pyproject.toml` +2. Run `pip-compile` +3. Install the updated `requirements.txt` using `pip install -r requirements.txt` diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..63db26c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[project] +name = "inverse-kinematics-sbi" +version = "0.0.1" +dependencies = [ + "numpy", + "scipy", + "matplotlib", +] +description = "Inverse kinematics benchmarks for simulation-based inference" + +[tool.black] +line-length = 120 +target-version = ["py39", "py310"] + +[tool.isort] +profile = "black" +line_length = 120 +multi_line_output = 3 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6ad6429 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,34 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile +# +contourpy==1.2.1 + # via matplotlib +cycler==0.12.1 + # via matplotlib +fonttools==4.51.0 + # via matplotlib +kiwisolver==1.4.5 + # via matplotlib +matplotlib==3.9.0 + # via inverse-kinematics-sbi (pyproject.toml) +numpy==1.26.4 + # via + # contourpy + # inverse-kinematics-sbi (pyproject.toml) + # matplotlib + # scipy +packaging==24.0 + # via matplotlib +pillow==10.3.0 + # via matplotlib +pyparsing==3.1.2 + # via matplotlib +python-dateutil==2.9.0.post0 + # via matplotlib +scipy==1.13.0 + # via inverse-kinematics-sbi (pyproject.toml) +six==1.16.0 + # via python-dateutil