Skip to content

Commit

Permalink
Misc/tooling (#485)
Browse files Browse the repository at this point in the history
* Update `pre-commit.yml`

* Remove `.prettierignore`

* Move `.rstcheck.cfg`, remove old templates

* Move `.mypy.ini` to `pyproject.toml`

* Remove `.bump2version.cfg`

* Remove unused pre-commits

* Update MANIFEST.in

* Move `doc8`

* Update `pytest`

* Remove `tox.ini`

* Add `lint-docs` command

* Enable `ruff`

* Fix `mypy`

* Fix flake8

* More CI tests

* Fix TODOs in test

* Remove download tests, fix some warnings

* Fix more warnings

* Auto-close figures in tests

* Don't pass views in tests

* Remove flaky saving in tests

* Update `tests.yml`

* Test on 3.11 as well, fix parallel coverage

* Fix typo in `test.yml`

* Don't test on 3.11 yet because of `matplotlib`

* Don't test on 3.11 yet because of `numba`

* Update `pyproject.toml`

* Fix coverage path, update `codecov.yml`

* Don't use `develop` in `testenv`
  • Loading branch information
michalk8 authored Mar 9, 2023
1 parent a09df6a commit 54c5fab
Show file tree
Hide file tree
Showing 55 changed files with 486 additions and 667 deletions.
7 changes: 0 additions & 7 deletions .bumpversion.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# TODO(michalk8): in the future, lint the docs
# TODO(michalk8): enable in the future
lint-kind: [code] # , docs]

steps:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,28 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: [3.8]
python: ["3.8", "3.10"]
include:
- os: macos-latest
python: "3.9"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install pip dependencies
# TODO(michalk8): remove tox-gh dependency, update tox.ini
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
pip install tox
- name: Test
run: |
tox -vv
tox -e py-${{ matrix.python }}
env:
PYTEST_ADDOPTS: -vv -n 2

- name: Upload coverage
uses: codecov/codecov-action@v3
Expand Down
35 changes: 0 additions & 35 deletions .mypy.ini

This file was deleted.

90 changes: 19 additions & 71 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ default_language_version:
default_stages:
- commit
- push
minimum_pre_commit_version: 2.14.0
minimum_pre_commit_version: 3.0.0
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.1.1
hooks:
- id: mypy
additional_dependencies: [numpy>=1.21.0, jax]
files: ^src
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
additional_dependencies: [toml]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
rev: v3.0.0-alpha.6
hooks:
- id: prettier
language_version: system
Expand All @@ -27,95 +28,42 @@ repos:
- id: isort
additional_dependencies: [toml]
args: [--order-by-type]
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
hooks:
- id: yesqa
additional_dependencies:
[
flake8-tidy-imports,
flake8-docstrings,
flake8-rst-docstrings,
flake8-comprehensions,
flake8-bugbear,
flake8-blind-except,
flake8-builtins,
flake8-pytest-style,
flake8-string-format,
]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: detect-private-key
- id: check-merge-conflict
- id: check-ast
- id: check-symlinks
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: fix-encoding-pragma
args: [--remove]
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
exclude: ^.bumpversion.cfg$
- id: check-case-conflict
- id: check-docstring-first
- id: check-yaml
- id: check-toml
- id: requirements-txt-fixer
- repo: https://github.com/myint/autoflake
rev: v2.0.1
hooks:
- id: autoflake
args:
[
--in-place,
--remove-all-unused-imports,
--remove-unused-variable,
--ignore-init-module-imports,
]
- repo: https://github.com/pycqa/flake8.git
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies:
[
flake8-tidy-imports,
flake8-docstrings,
flake8-rst-docstrings,
flake8-comprehensions,
flake8-bugbear,
flake8-blind-except,
flake8-builtins,
flake8-pytest-style,
flake8-string-format,
]
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: script-must-have-extension
name: Check executable files use .sh extension
types: [shell, executable]
- id: pyupgrade
args: [--py3-plus, --py38-plus, --keep-runtime-typing]
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.1.0]
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
- repo: https://github.com/rstcheck/rstcheck
rev: v6.1.1
hooks:
- id: pyupgrade
args: [--py3-plus, --py38-plus, --keep-runtime-typing]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-no-eval
- id: python-check-blanket-noqa
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: rstcheck
additional_dependencies: [tomli]
args: [--config=pyproject.toml]
- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
hooks:
- id: doc8
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: v0.0.252
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

3 changes: 0 additions & 3 deletions .rstcheck.cfg

This file was deleted.

3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ include src/moscot/utils/data/allTFs_dmel.txt
include src/moscot/utils/data/allTFs_hg38.txt
include src/moscot/utils/data/allTFs_mm.txt
prune docs
prune resources
prune tests
prune .github
prune tests/data
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ single-cell genomics. It can be used for
- prototyping of new OT models in single-cell genomics

**moscot** is powered by
`OTT <https://ott-jax.readthedocs.io/en/latest/>`_ which is a JAX-based Optimal
`OTT <https://ott-jax.readthedocs.io>`_ which is a JAX-based Optimal
Transport toolkit that supports just-in-time compilation, GPU acceleration, automatic
differentiation and linear memory complexity for OT problems.

Expand Down Expand Up @@ -39,7 +39,7 @@ If used with GPU, additionally run::
Resources
---------

Please have a look at our `documentation <https://moscot.readthedocs.io/en/latest/index.html/>`_
Please have a look at our `documentation <https://moscot.readthedocs.io>`_

Reference
---------
Expand Down
12 changes: 6 additions & 6 deletions .github/.codecov.yml → codecov.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
codecov:
require_ci_to_pass: false
require_ci_to_pass: true
strict_yaml_branch: main

coverage:
range: 90..100
range: "80...100"
status:
project:
default:
target: 1
target: 75%
threshold: 1%
patch: off

comment:
layout: reach, diff, files
layout: "reach, diff, files"
behavior: default
require_changes: true
branches:
- main
branches: [main]
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = build
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
Expand Down
5 changes: 0 additions & 5 deletions docs/_templates/autosummary/base.rst

This file was deleted.

50 changes: 23 additions & 27 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
:github_url: {{ fullname }}

{{ fullname | escape | underline}}
{{ fullname | escape | underline }}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
{% block methods %}
{%- if methods %}
.. rubric:: {{ _('Methods') }}

{% block attributes %}
{% if attributes %}
.. rubric:: Attributes

.. autosummary::
:toctree: .
{% for item in attributes %}
~{{ fullname }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block methods %}
{% if methods %}
.. rubric:: Methods
.. autosummary::
:toctree: .
{% for item in methods %}
{%- if item not in ['__init__', 'tree_flatten', 'tree_unflatten', 'bind'] %}
~{{ name }}.{{ item }}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endblock %}
{% block attributes %}
{%- if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
:toctree: .
{% for item in methods %}
{%- if item != '__init__' %}
~{{ fullname }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
{% endblock %}
.. autosummary::
:toctree: .
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{%- endif %}
{% endblock %}
5 changes: 0 additions & 5 deletions docs/_templates/autosummary/function.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/_templates/breadcrumbs.html

This file was deleted.

3 changes: 0 additions & 3 deletions docs/api/datasets.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Datasets
########

Datasets
~~~~~~~~

.. currentmodule:: moscot.datasets

.. autosummary::
Expand Down
3 changes: 1 addition & 2 deletions docs/api/developer.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
Developer
#########


OTT Backend
~~~~~~~~~~~~
~~~~~~~~~~~

.. autosummary::
:toctree: genapi
Expand Down
3 changes: 0 additions & 3 deletions docs/api/plotting.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Plotting
########

Plotting
~~~~~~~~

.. currentmodule:: moscot.plotting

.. autosummary::
Expand Down
Loading

0 comments on commit 54c5fab

Please sign in to comment.