Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ipynb linguist-vendored
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- precommit
strategy:
matrix:
python-version: [3.11]
python-version: [ 3.12 ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -41,7 +41,7 @@ jobs:
- precommit
strategy:
matrix:
python-version: [3.11]
python-version: [ 3.12 ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -61,7 +61,7 @@ jobs:
- precommit
strategy:
matrix:
python-version: [3.11]
python-version: [ 3.12, 3.13 ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- precommit
strategy:
matrix:
python-version: [3.11]
python-version: [ 3.12, 3.13 ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: [3.12, 3.13]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,5 @@ cython_debug/
.vscode/

poetry.lock

.DS_Store
8 changes: 8 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[general]
ignore=body-is-missing

[title-min-length]
min-length=10

[title-must-not-contain-word]
words=wip,todo
16 changes: 3 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,12 @@ repos:
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pycqa/bandit
rev: 1.7.1
hooks:
- id: bandit
language: python
language_version: python3
types: [python]
args: ["-c", "pyproject.toml"]
additional_dependencies: ["toml"]
files: "(surjectors|examples)"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910-1
rev: v1.15.0
hooks:
- id: mypy
args: ["--ignore-missing-imports"]
Expand All @@ -35,4 +25,4 @@ repos:
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.10
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"

sphinx:
builder: html
Expand Down
17 changes: 13 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
PKG_VERSION=`hatch version`
.PHONY: tests, lints, docs, format

tag:
git tag -a v${PKG_VERSION} -m v${PKG_VERSION}
git push --tag
tests:
uv run pytest

lints:
uv run ruff check surjectors examples

format:
uv run ruff check --fix surjectors examples
uv run ruff format surjectors examples

docs:
cd docs && make html
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# surjectors

[![active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![ci](https://github.com/dirmeier/surjectors/actions/workflows/ci.yaml/badge.svg)](https://github.com/dirmeier/surjectors/actions/workflows/ci.yaml)
[![version](https://img.shields.io/pypi/v/surjectors.svg?colorB=black&style=flat)](https://pypi.org/project/surjectors/)
[![doi](https://joss.theoj.org/papers/10.21105/joss.06188/status.svg)](https://doi.org/10.21105/joss.06188)

> Surjection layers for density estimation with normalizing flows

## About

Surjectors is a light-weight library for density estimation using
Expand Down Expand Up @@ -82,12 +79,26 @@ Contributions in the form of pull requests are more than welcome. A good way to

In order to contribute:

1) Clone `Surjectors` and install `hatch` via `pip install hatch`,
2) create a new branch locally `git checkout -b feature/my-new-feature` or `git checkout -b issue/fixes-bug`,
3) implement your contribution and ideally a test case,
4) test it by calling `hatch run test` on the (Unix) command line,
5) submit a PR 🙂

1) Clone `surjectors` and install `uv` from [here](https://docs.astral.sh/uv/getting-started/installation/).
2) Install all dependencies using `uv sync --all-groups`.
3) Install `pre-commit` and `gitlint` via:

```shell
pre-commit install
gitlint install-hook
```
4) Create a new branch locally `git checkout -b feature/my-new-feature` or `git checkout -b issue/fixes-bug`.
5) Implement your contribution and ideally a test case.
6) Test it by calling `make tests`, `make lints` and `make format` on the (Unix) command line.
7) Submit a PR 🙂.

```shell
pre-commit install
gitlint install-hook
```
6) Implement your contribution and ideally a test case.
7) Test it by calling `make format`, `make lints` and `make tests` on the (Unix) command line.
8) Submit a PR 🙂.

## Citing Surjectors

Expand All @@ -109,4 +120,4 @@ If you find our work relevant to your research, please consider citing:

## Author

Simon Dirmeier <a href="mailto:sfyrbnd @ pm me">sfyrbnd @ pm me</a>
Simon Dirmeier <a href="mailto:simd23 @ pm me">simd23 @ pm me</a>
25 changes: 20 additions & 5 deletions docs/_static/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,25 @@ html[data-theme="light"] {
--pst-color-inline-code-links: #b26679;
}

pre > span {
line-height: 20px;
}

span.kn {
color: rgb(0, 120, 161) !important;
}
h1 > code > span {
font-family: var(--pst-font-family-monospace);
font-weight: 700;
font-weight: 300 !important;
}

pre {
border: 0;
font-size: 13px;
background-color: rgb(245, 245, 245) !important;
}
h1 {
margin-bottom: 50px;
}
nav > li > a > code.literal {
padding-top: 0;
padding-bottom: 0;
Expand All @@ -20,17 +34,18 @@ nav > li > a > code.literal {
nav.bd-links p.caption {
text-transform: uppercase;
}

code.literal {
background-color: white;
border: 0;
border-radius: 0;
}
a > code {
font-weight: 575;
}
a:hover {
text-decoration-thickness: 1px !important;
}


ul.bd-breadcrumbs li.breadcrumb-item a:hover {
text-decoration-thickness: 1px;
}
Expand All @@ -45,4 +60,4 @@ nav.bd-links li > a:hover {

button.theme-switch-button {
display: none !important;
}
}
5 changes: 3 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"repository_url": "https://github.com/dirmeier/surjectors",
"use_repository_button": True,
"use_download_button": False,
"extra_navbar": ""
"use_fullscreen_button": False,
"launch_buttons": {"colab_url": "https://colab.research.google.com"},
}

html_title = "Surjectors 🚀"
Expand All @@ -63,4 +64,4 @@ def skip(app, what, name, obj, would_skip, options):


def setup(app):
app.connect("autodoc-skip-member", skip)
app.connect("autodoc-skip-member", skip)
20 changes: 13 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ Contributions in the form of pull requests are more than welcome. A good way to

In order to contribute:

1) Clone :code:`Surjectors` and install :code:`hatch` via :code:`pip install hatch`,
2) create a new branch locally :code:`git checkout -b feature/my-new-feature` or :code:`git checkout -b issue/fixes-bug`,
3) implement your contribution and ideally a test case,
4) test it by calling :code:`hatch run test` on the (Unix) command line,
5) submit a PR 🙂
1) Clone :code:`surjectors` and install :code:`uv` from `here <https://docs.astral.sh/uv/getting-started/installation/>`_,
2) install all dependencies using ``uv sync``,
3) create a new branch locally :code:`git checkout -b feature/my-new-feature` or :code:`git checkout -b issue/fixes-bug`,
4) implement your contribution and ideally a test case,
5) test it by calling ``make format``, ``make lints`` and ``make tests`` on the (Unix) command line,
6) submit a PR 🙂

Citing Surjectors
-----------------
Expand Down Expand Up @@ -117,16 +118,21 @@ Surjectors is licensed under the Apache 2.0 License.
:hidden:

🏠 Home <self>
📰 News <news>

.. toctree::
:caption: 🎓 Examples
:caption: 🎓 Tutorials
:maxdepth: 1
:hidden:

Introduction <notebooks/introduction>
Unconditional and conditional density estimation <notebooks/normalizing_flows>
Dimensionality reduction using surjectors <notebooks/dimension_reduction>

.. toctree::
:caption: 🚀 Examples
:maxdepth: 1
:hidden:

Self-contained scripts <examples>

.. toctree::
Expand Down
11 changes: 0 additions & 11 deletions docs/news.rst

This file was deleted.

Loading
Loading