Skip to content

Commit

Permalink
add test and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Nov 23, 2023
1 parent a460a3a commit b40c84d
Show file tree
Hide file tree
Showing 15 changed files with 728 additions and 381 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ exclude =
venv,
doc/_build
--select = D,E,F,W,C
per-file-ignores =
__init__.py: D104
tests/*: D100, D104
docstring-convention = numpy
max-line-length = 99
max_complexity = 15
Expand Down
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/blank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Blank issue
about: Create an issue without a template.
title: ''
labels: ''
assignees: ''
---
81 changes: 81 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: Bug report

# See the json schema to help you create / update this form
# https://json.schemastore.org/github-issue-forms.json

description: Fill in this template to report a bug

title: '[BUG] '

labels: [bug]

body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues

- type: textarea
attributes:
label: Expected Behavior
description: Describe what outcome you expected.
placeholder: Describe what outcome you expected.
validations:
required: false

- type: textarea
attributes:
label: Current Behavior
description: Describe what you got instead.
placeholder: Describe what you got instead.
validations:
required: false

- type: textarea
attributes:
label: Error message
description: If possible paste below the error message you encountered.
validations:
required: false

- type: textarea
attributes:
label: Environment
description: |
If necessary give information about your setup.
value: |
- OS:
- Python/Node version:
validations:
required: false

# - type: textarea
# attributes:
# label: Version
# description: |
# Which version did you encounter this bug on?
# value: |
# - version:

- type: textarea
attributes:
label: How to reproduce
description: |
What is the command you ran?
Ideally provide a minimal example that reproduces the bug.
validations:
required: false

- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: Feature request

# See the json schema to help you create / update this form
# https://json.schemastore.org/github-issue-forms.json

description: Suggest an idea for this project

title: '[ENH] '

labels: [enhancement]

body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the feature you want.
options:
- label: I have searched the existing issues

- type: textarea
attributes:
label: New feature
description: You think / need this to do...
placeholder: Insert here your cool idea.
validations:
required: false

- type: textarea
attributes:
label: Unclear documentation
description: |
Something is missing / unclear about **X**.
You are confused about how to do **Y**.
It is not clear how / why the code does **Z**.
That means that we can improve the code or the documentation.
placeholder: Tell us more.
validations:
required: false
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# Documentation
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly

- package-ecosystem: gitsubmodule
directory: /
schedule:
interval: monthly
50 changes: 50 additions & 0 deletions .github/workflows/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!---
Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.
-->






<!---
This is a suggested pull request template.
It's designed to capture information we've found to be useful in reviewing pull requests.
If there is other information that would be helpful to include, please don't hesitate to add it!
-->

<!-- Please indicate after the # which issue you're closing with this PR.
This is helpful for the maintainers AND will magically close the issue
when this pull request is merged!
If the PR closes multiple issues, includes "closes" before each one is listed.
You can also just link to other issues if necessary, e.g. "See also #1234".
https://help.github.com/articles/closing-issues-using-keywords
-->
Closes #
See also #

<!-- Please give a brief overview of what has changed in the PR.
If you're not sure what to write, consider it a note to the maintainers
to indicate what they should be looking for when they review the pull request.
-->
Changes proposed in this pull request:

-
-

## Checklist

- [ ] PR has an interpretable title with a prefix (`[ENH]`, `[BUG]`, `[DOC]`, `[INFRA]`, `[MAINT]`)
- [ ] PR links to Github issue with mention `Closes #XXXX`
- [ ] Tests pass
- [ ] Code is properly formatted


For new features:
- [ ] Tests have been added

For bug fixes:
- [ ] There is at least one test that would fail under the original bug conditions.
46 changes: 46 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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

jobs:
unit_test:
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install
run: pip install .[test]

- name: unit tests
run: python -m pytest tests --cov fids --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
name: codecov-umbrella
fail_ci_if_error: false
93 changes: 61 additions & 32 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,81 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml

- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: isort
args: ["--profile", "black"]
- id: prettier
types_or: [json]

- repo: https://github.com/ikamensh/flynt/
rev: "0.78"
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: flynt
- id: yamlfmt
args: [--mapping, '4', --sequence, '4', --offset, '0']

- repo: https://github.com/asottile/pyupgrade
rev: v3.9.0
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.11.0
hooks:
- id: pyupgrade
- id: pretty-format-toml
args: [--autofix, --indent, '4']


- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, from __future__ import annotations]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/psf/black
rev: 23.3.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
hooks:
- id: black
args: [--verbose, --config=pyproject.toml]

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: black
args: ["--config", "pyproject.toml"]
- id: blacken-docs
additional_dependencies:
- black==22.12.0

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: ["--toml", "pyproject.toml"]
- id: codespell
args: [--toml, pyproject.toml]
additional_dependencies: [tomli]

- repo: https://github.com/pyCQA/flake8
rev: 6.0.0
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.7.0
# hooks:
# - id: mypy
# additional_dependencies: [types-all]
# args: [--config-file=pyproject.toml]

- repo: https://github.com/pyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args: ["--config", ".flake8", "--verbose"]
- id: flake8
args: [--config, .flake8, --verbose]
additional_dependencies: [flake8-docstrings, flake8-use-fstring]
Loading

0 comments on commit b40c84d

Please sign in to comment.