Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre commit #11

Merged
merged 5 commits into from
Mar 3, 2023
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
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

58 changes: 29 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
name: Release

on:
push:
tags:
- '*.*.*'
push:
tags:
- "*.*.*"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
# will use ref/SHA that triggered it
- name: Checkout code
uses: actions/checkout@v3
release:
name: Release
runs-on: ubuntu-latest
steps:
# will use ref/SHA that triggered it
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.11
- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: 1.1.11

- name: Build project for distribution
run: poetry build
- name: Build project for distribution
run: poetry build

- name: Check Version
id: check-version
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true
- name: Check Version
id: check-version
run: |
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
67 changes: 33 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,39 @@
name: velovi

on:
push:
branches: [main]
pull_request:
branches: [main]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install pytest-cov
pip install .[dev]
- name: Test with pytest
run: |
pytest --cov-report=xml --cov=velovi
- name: After success
run: |
bash <(curl -s https://codecov.io/bash)
pip list
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install pytest-cov
pip install .[dev]
- name: Test with pytest
run: |
pytest --cov-report=xml --cov=velovi
- name: After success
run: |
bash <(curl -s https://codecov.io/bash)
pip list
53 changes: 44 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
fail_fast: false
default_language_version:
python: python3
default_stages:
- commit
- push
minimum_pre_commit_version: 2.16.0
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
rev: "23.1.0"
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.10.1
- id: blacken-docs
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.4
hooks:
- id: isort
name: isort (python)
additional_dependencies: [toml]
- id: prettier
# Newer versions of node don't work on systems that have an older version of GLIBC
# (in particular Ubuntu 18.04 and Centos 7)
# EOL of Centos 7 is in 2024-06, we can probably get rid of this then.
# See https://github.com/scverse/cookiecutter-scverse/issues/143 and
# https://github.com/jupyterlab/jupyterlab/issues/12675
language_version: "17.9.1"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.253
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: detect-private-key
- id: check-ast
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- id: check-case-conflict
- repo: local
hooks:
- id: forbid-to-commit
name: Don't commit rej files
entry: |
Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
Fix the merge conflicts manually and remove the .rej files.
language: fail
files: '.*\.rej$'
12 changes: 6 additions & 6 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Run to check if valid
# curl --data-binary @codecov.yml https://codecov.io/validate
coverage:
status:
project:
default:
target: 80%
threshold: 1%
patch: off
status:
project:
default:
target: 80%
threshold: 1%
patch: off
24 changes: 14 additions & 10 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* influenced by and borrowed from: https://github.com/cvxgrp/pymde/blob/main/docs_src/source/_static/css/custom.css */

@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&display=swap');
@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&display=swap");

:root {
--sidebarcolor: #003262;
--sidebarfontcolor: #ffffff;
--sidebarhover: #295e97;

--bodyfontcolor: #333;
--webfont: 'Roboto';
--webfont: "Roboto";

--contentwidth: 1000px;
}
Expand All @@ -20,7 +20,7 @@ h3,
h4,
h5,
h6 {
font-family: var(--webfont), 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-family: var(--webfont), "Helvetica Neue", Helvetica, Arial, sans-serif;
font-weight: 400;
}

Expand All @@ -38,7 +38,7 @@ h1 {
}

body {
font-family: var(--webfont), 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-family: var(--webfont), "Helvetica Neue", Helvetica, Arial, sans-serif;
color: var(--bodyfontcolor);
}

Expand All @@ -47,7 +47,6 @@ p {
line-height: 150%;
}


/* Sidebar */
.wy-side-nav-search {
background-color: var(--sidebarcolor);
Expand All @@ -66,7 +65,7 @@ p {
color: var(--sidebarfontcolor);
}

.wy-side-nav-search>div.version {
.wy-side-nav-search > div.version {
color: var(--sidebarfontcolor);
}

Expand All @@ -79,8 +78,13 @@ p {
max-width: var(--contentwidth);
}


html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.glossary):not(.simple) dl:not(.field-list)>dt {
html.writer-html5
.rst-content
dl[class]:not(.option-list):not(.field-list):not(.footnote):not(
.glossary
):not(.simple)
dl:not(.field-list)
> dt {
margin-bottom: 6px;
border-left: none;
background: none;
Expand Down Expand Up @@ -110,10 +114,10 @@ div.nbinput.container {

div.nbinput.container div.input_area {
/* Code cell border that works in both dark and light mode */
border-color: rgba(127, 127, 127, .25) !important;
border-color: rgba(127, 127, 127, 0.25) !important;
}

div.nbinput.container div.input_area div[class*="highlight"]>pre {
div.nbinput.container div.input_area div[class*="highlight"] > pre {
padding: 10px !important;
margin: 0;
}
Expand Down
26 changes: 13 additions & 13 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@
master_doc = "index"


intersphinx_mapping = dict(
anndata=("https://anndata.readthedocs.io/en/stable/", None),
ipython=("https://ipython.readthedocs.io/en/stable/", None),
matplotlib=("https://matplotlib.org/", None),
numpy=("https://docs.scipy.org/doc/numpy/", None),
pandas=("https://pandas.pydata.org/pandas-docs/stable/", None),
python=("https://docs.python.org/3", None),
scipy=("https://docs.scipy.org/doc/scipy/reference/", None),
sklearn=("https://scikit-learn.org/stable/", None),
torch=("https://pytorch.org/docs/master/", None),
scanpy=("https://scanpy.readthedocs.io/en/stable/", None),
pytorch_lightning=("https://pytorch-lightning.readthedocs.io/en/stable/", None),
)
intersphinx_mapping = {
"anndata": ("https://anndata.readthedocs.io/en/stable/", None),
"ipython": ("https://ipython.readthedocs.io/en/stable/", None),
"matplotlib": ("https://matplotlib.org/", None),
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"python": ("https://docs.python.org/3", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
"sklearn": ("https://scikit-learn.org/stable/", None),
"torch": ("https://pytorch.org/docs/master/", None),
"scanpy": ("https://scanpy.readthedocs.io/en/stable/", None),
"pytorch_lightning": ("https://pytorch-lightning.readthedocs.io/en/stable/", None),
}


# General information about the project.
Expand Down
3 changes: 3 additions & 0 deletions docs/extensions/typed_returns.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


def process_return(lines):
"""Process the return section of a docstring."""
for line in lines:
m = re.fullmatch(r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)", line)
if m:
Expand All @@ -17,6 +18,7 @@ def process_return(lines):


def scanpy_parse_returns_section(self, section):
"""Parse the returns section of the docstring."""
lines_raw = list(process_return(self._dedent(self._consume_to_next_section())))
lines = self._format_block(":returns: ", lines_raw)
if lines and lines[-1]:
Expand All @@ -25,4 +27,5 @@ def scanpy_parse_returns_section(self, section):


def setup(app: Sphinx):
"""Setup the extension."""
NumpyDocstring._parse_returns_section = scanpy_parse_returns_section
Loading