Skip to content

Commit 2aca13f

Browse files
authored
Merge pull request #141 from funkelab/contributing
Add contributing docs
2 parents b97978a + 2f12620 commit 2aca13f

File tree

7 files changed

+108
-112
lines changed

7 files changed

+108
-112
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ jobs:
1313
name: Lint
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- name: Run pre-commit linting
1818
run: pipx run pre-commit run --all-files
1919

2020
test:
2121
name: ${{ matrix.platform }} py${{ matrix.python-version }}
2222
runs-on: ${{ matrix.platform }}
23-
defaults:
24-
run:
25-
shell: bash -l {0}
2623
strategy:
2724
fail-fast: false
2825
matrix:
@@ -33,23 +30,18 @@ jobs:
3330
python-version: "3.10"
3431

3532
steps:
36-
- uses: actions/checkout@v4
37-
38-
- uses: conda-incubator/setup-miniconda@v3
33+
- uses: actions/checkout@v5
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: astral-sh/setup-uv@v6
3936
with:
4037
python-version: ${{ matrix.python-version }}
41-
miniforge-version: latest
42-
use-mamba: true
43-
channels: conda-forge
44-
channel-priority: true
38+
enable-cache: true
4539

46-
- name: Install package and dependencies
47-
run: |
48-
mamba install -c gurobi -c funkelab ilpy
49-
python -m pip install -e .[test]
40+
- name: Install dependencies
41+
run: uv sync
5042

5143
- name: Test
52-
run: pytest tests -v --color=yes --cov=motile --cov-report=xml
44+
run: uv run pytest tests -v --color=yes --cov=motile --cov-report=xml
5345

5446
- name: Upload coverage to Codecov
5547
uses: codecov/codecov-action@v5

.github/workflows/publish-docs.yaml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,22 @@ permissions:
1616
jobs:
1717
build:
1818
runs-on: ubuntu-latest
19-
defaults:
20-
run:
21-
shell: bash -l {0}
2219
steps:
23-
- name: Checkout
24-
uses: actions/checkout@v4
25-
26-
- uses: conda-incubator/setup-miniconda@v3
20+
- uses: actions/checkout@v5
21+
- name: Set up Python 3.11
22+
uses: astral-sh/setup-uv@v6
2723
with:
28-
python-version: "3.11"
29-
miniforge-version: latest
30-
use-mamba: true
31-
channels: conda-forge
32-
channel-priority: true
24+
python-version: '3.11'
25+
enable-cache: true
3326

34-
- name: Install package and dependencies
35-
run: |
36-
mamba install -c gurobi -c funkelab ilpy
37-
python -m pip install -e .[docs]
27+
- name: Install dependencies
28+
run: uv sync
3829

3930
- name: Build documentation
40-
run: sphinx-build docs/source docs/build/html -W -b html
31+
run: uv run sphinx-build docs/source docs/build/html -W -b html
4132

4233
- name: Upload Pages Artifact
43-
uses: actions/upload-pages-artifact@v3
34+
uses: actions/upload-pages-artifact@v4
4435
with:
4536
path: docs/build/html
4637
retention-days: 90

CONTRIBUTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributing to `motile`
2+
3+
:tada: Thank you for your interest in contributing to `motile`! :tada:
4+
5+
`motile` is a research library. While it is stable and in use in multiple projects, the time
6+
available for the core developers to perform maintenance and feature requests is limited.
7+
The preferred form of communication for bugs and requests is GitHub
8+
[Issues](https://github.com/funkelab/motile/issues/new) - if your issue does not get a
9+
response in a reasonable time, feel free to ping @cmalinmayor and I will take at least a quick look.
10+
11+
## New Costs and Constraints
12+
To keep this library manageable to maintain, we intentionally keep the number of `Variables`,
13+
`Costs`, and `Constraints` implemented here low, and highly encourage people with specific
14+
needs to extend the base classes to implement their own components within the `motile`
15+
framework.
16+
17+
Examples of complex workflows can be found in experimental libraries that use `motile`, such as:
18+
- [`attrackt`](https://github.com/funkelab/attrackt)
19+
- [`mhat` (Multi Hypothesis Affinity Tracking)](https://github.com/funkelab/mhat)
20+
21+
If you want to contribute a `Cost` or `Constraint` that is widely useful and should be part of
22+
the core library, please open an [Issue](https://github.com/funkelab/motile/issues/new) or PR and we will review it. If we can't
23+
commit to maintaining the code but think others can use it as inspiration, we might suggest
24+
contributing it to the [`motile_toolbox`](https://github.com/funkelab/motile_toolbox) instead.
25+
26+
## Development Tools
27+
28+
We use `uv` for dependency management, `ruff` for formatting and linting, and `mypy` for type checking.
29+
If set up correctly, the `pre-commit` configuration runs `ruff` and `mypy` before each commit.
30+
To set it up, navigate to the root directory of this repository and run:
31+
```bash
32+
uv run pre-commit install
33+
```
34+
35+
To run the tests from the root directory:
36+
```bash
37+
uv run pytest
38+
```
39+
40+
### Deployment
41+
42+
To deploy a new version, first make sure to bump the version string in
43+
`motile/__init__.py`. Then create an **annotated** tag, and push it to GitHub.
44+
This will trigger the `deploy.yaml` workflow to upload to PyPI
45+
46+
```bash
47+
git tag -a vX.Y.Z -m vX.Y.Z
48+
git push upstream --follow-tags
49+
```
50+
51+
### Building Documentation
52+
From root directory of the repository:
53+
```sh
54+
uv run make docs
55+
open docs/_build/html/index.html
56+
57+
# or to start a live-reloading server
58+
uv run make docs-watch
59+
```

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ install-dev:
66

77
.PHONY: tests
88
tests:
9-
PY_MAJOR_VERSION=py`python -c 'import sys; print(sys.version_info[0])'` pytest -v --cov=motile --cov-config=.coveragerc tests
10-
pre-commit run --all-files
9+
uv run pytest -v --cov=motile --cov-config=.coveragerc tests
10+
uv run pre-commit run --all-files
1111

1212
.PHONY: publish
1313
publish:
@@ -21,5 +21,4 @@ docs:
2121

2222
.PHONY: docs-watch
2323
docs-watch:
24-
pip install sphinx-autobuild
2524
sphinx-autobuild docs/source docs/_build/html --watch motile --watch docs/source --open-browser

README.md

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,62 +11,9 @@ Read all about it in the [documentation](https://funkelab.github.io/motile/).
1111

1212
## Installation
1313

14-
Motile depends on [`ilpy`](https://github.com/funkelab/ilpy), which is currently only available via
15-
conda on the `funkelab` channel. `ilpy` in turn requires
16-
gurobi which is only available via the `gurobi` channel.
17-
18-
So, to create a new environment with motile:
19-
20-
```bash
21-
conda create -n my_env -c conda-forge -c funkelab -c gurobi ilpy
22-
conda activate my_env
23-
pip install motile
24-
```
25-
26-
or, to install into an existing environment:
27-
2814
```bash
29-
conda install -c conda-forge -c funkelab -c gurobi ilpy
3015
pip install motile
3116
```
3217

3318
## Development
34-
35-
```sh
36-
git clone https://github.com/funkelab/motile # or your fork
37-
cd motile
38-
39-
# currently required to build ilpy dependency wheel
40-
conda install scip
41-
42-
pip install -e .[dev]
43-
```
44-
45-
### Testing
46-
47-
```sh
48-
pytest
49-
```
50-
51-
### Deployment
52-
53-
> note for developers
54-
55-
To deploy a new version, first make sure to bump the version string in
56-
`motile/__init__.py`. Then create an **annotated** tag, and push it to github.
57-
This will trigger the `deploy.yaml` workflow to upload to PyPI
58-
59-
```bash
60-
git tag -a vX.Y.Z -m vX.Y.Z
61-
git push upstream --follow-tags
62-
```
63-
64-
### Building Documentation
65-
66-
```sh
67-
pip install -e .[docs]
68-
make docs && open docs/_build/html/index.html
69-
70-
# or to start a live-reloading server
71-
make docs-watch
72-
```
19+
Check out CONTRIBUTING.md for more information on contributing to `motile`.

docs/source/install.rst

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ Installation
77
:noindex:
88

99
.. code-block:: bash
10-
11-
conda create -n motile -c conda-forge -c gurobi -c funkelab ilpy
12-
conda activate motile
10+
1311
pip install motile
1412
15-
This will install ``motile`` with all required dependencies, including binaries
16-
for two discrete optimizers:
13+
This will install ``motile`` with all required dependencies, including
14+
two discrete optimizers:
1715

1816
1. The `Gurobi Optimizer <https://www.gurobi.com/>`_. This is a comercial
1917
solver, which requires a valid license. Academic licenses are provided for
@@ -22,16 +20,8 @@ for two discrete optimizers:
2220
to obtain one.
2321

2422
2. The `SCIP Optimizer <https://www.scipopt.org/>`_, a free and open source
25-
solver. If ``motile`` does not find a valid Gurobi license, it will fall
23+
solver. If ``motile`` does not find a valid Gurobi license it will fall
2624
back to using SCIP.
2725

28-
Do I have to use ``conda``?
29-
---------------------------
30-
31-
Kinda. ``motile`` uses `ilpy <https://github.com/funkelab/ilpy>`_ to solve the
32-
optimization problem. Conda packages for ``ilpy`` are available for all major
33-
platforms, linking against the conda packages for SCIP and Gurobi.
34-
35-
It is possible to not use ``conda``: If you have SCIP or Gurobi installed
36-
otherwise, you can compile ``ilpy`` yourself from the PyPI repository (``pip
37-
install ilpy``).
26+
Developers can use `uv` for dependency management. See CONTRIBUTING.md for more
27+
information.

pyproject.toml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,27 @@ authors = [
1818
{ name = 'Florian Jug', email = 'florian.jug@fht.org' },
1919
]
2020
dynamic = ["version"]
21-
dependencies = ['networkx', 'ilpy>=0.4.0', 'numpy', 'structsvm']
21+
requires-python = ">=3.9"
22+
dependencies = [
23+
'networkx',
24+
'ilpy>=0.4.0',
25+
'numpy',
26+
'structsvm',
27+
]
2228

23-
[project.optional-dependencies]
24-
dev = ["pre-commit", "pytest", "pytest-cov", "ruff", "twine", "build"]
25-
test = ["pytest", "pytest-cov"]
29+
[dependency-groups]
30+
test = [
31+
"pytest",
32+
"pytest-cov",
33+
]
34+
dev = [
35+
"pre-commit",
36+
"ruff",
37+
"twine",
38+
"build",
39+
{include-group="test"},
40+
{include-group="docs"}
41+
]
2642
docs = [
2743
"ipykernel",
2844
"jupyter_sphinx",
@@ -33,6 +49,8 @@ docs = [
3349
"sphinx>6",
3450
"tomli",
3551
"motile_toolbox",
52+
"plotly>=6.3",
53+
"sphinx-autobuild",
3654
]
3755

3856
[project.urls]
@@ -94,4 +112,4 @@ strict = true # feel free to relax this if it's annoying
94112
allow_untyped_defs = true # TODO: can eventually fill out typing and remove this
95113
# allow_untyped_calls = true # TODO: can eventually fill out typing and remove this
96114
disallow_any_generics = false
97-
ignore_missing_imports = true
115+
ignore_missing_imports = true

0 commit comments

Comments
 (0)