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

Use pyproject.toml with hatch #156

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

150 changes: 125 additions & 25 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package
name: CI

on:
push:
Expand All @@ -10,34 +10,134 @@ on:
branches: [ master, dev, v0.7]

jobs:
build:
check:
name: ${{ matrix.env.name }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
env:
- {"name": "pkg", "target": "show"}
- {"name": "lint", "target": "run"}
# - {"name": "type", "target": "run"}
- {"name": "docs", "target": "all"}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Let us have colors
run: echo "FORCE_COLOR=true" >> "$GITHUB_ENV"
- name: Install Hatch
uses: pypa/hatch@install
- name: Setup ${{ matrix.env.name }}
run: |
hatch -v env create ${{ matrix.env.name }}
hatch run ${{ matrix.env.name }}:pip freeze
- name: Run ${{ matrix.env.name }}
run: hatch -v run ${{ matrix.env.name }}:${{ matrix.env.target }}

test:
name: test py${{ matrix.python-version }} - seaborn-${{ matrix.seaborn-version }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
# keep synchronized with hatch tests matrix
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
seaborn-version: ["0.11", "0.12", "0.13"]
exclude:
# exclude seaborn-version 0.11 for python >= 3.12
- python-version: "3.12"
seaborn-version: "0.11"
- python-version: "3.13"
seaborn-version: "0.11"
# exclude seaborn-version 0.12 for python >= 3.13
- python-version: "3.13"
seaborn-version: "0.12"

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 coverage packaging
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with unittest
run: |
coverage run -m unittest discover tests
coverage report -m
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Pick environment to run
run: |
import codecs
import os
env = "tests.py{}-{}".format("${{ matrix.python-version }}", "${{ matrix.seaborn-version }}")
print(f"Environment {env}")
with codecs.open(os.environ["GITHUB_ENV"], mode="a", encoding="utf-8") as file_handler:
file_handler.write("FORCE_COLOR=1\n")
file_handler.write(f"ENV={env}\n")
shell: python
- name: Install Hatch
uses: pypa/hatch@install
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup test environment
run: |
hatch -v env create ${ENV}
hatch run ${ENV}:pip freeze
shell: bash
- name: Run test suite
run: hatch -v run ${ENV}:run-cov
env:
CI_RUN: "yes"
shell: bash
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}-${{ matrix.seaborn-version }}
path: report/.coverage.*
if-no-files-found: error
include-hidden-files: true

coverage:
name: coverage
runs-on: ubuntu-22.04
needs: test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Let us have colors
run: echo "FORCE_COLOR=true" >> "$GITHUB_ENV"
- name: Install Hatch
uses: pypa/hatch@install
- name: Setup coverage tool
run: |
hatch -v env create coverage
hatch run coverage:pip freeze
- name: Download coverage data
uses: actions/download-artifact@v4
with:
pattern: coverage-*
path: report
merge-multiple: true
- name: Combine and report coverage
run: hatch run coverage:run

- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report
path: report/html

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
directory: report
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ statannot.egg-info/requires.txt
statannot.egg-info/SOURCES.txt
statannot.egg-info/top_level.txt

usage/figures/*
report/

# IDE files
.idea/
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
exclude: '^(.*\.svg)$'
- id: trailing-whitespace
exclude: '^(.*\.svg|.*\.tsv)$'

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.23
hooks:
- id: validate-pyproject

- repo: https://github.com/crate-ci/typos
rev: v1.27.3
hooks:
- id: typos

# - repo: https://github.com/astral-sh/ruff-pre-commit
# rev: v0.7.4
# hooks:
# # Run the linter.
# - id: ruff
# args: [ --fix, --unsafe-fixes ]
# # Run the formatter.
# - id: ruff-format
58 changes: 29 additions & 29 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
## v0.7
### v0.7.0
#### Features
- Compatibility with pandas v2+ and seaborn above v0.12+
- Compatibility with pandas v2+ and seaborn above v0.12+
(PR [#155](https://github.com/trevismd/statannotations/pull/155) by
[getzze](https://github.com/getzze))

## v0.6
### v0.6.0
#### Features
- Add option to skip annotation of non-significant results
(PR [#95](https://github.com/trevismd/statannotations/pull/95) by
- Add option to skip annotation of non-significant results
(PR [#95](https://github.com/trevismd/statannotations/pull/95) by
[sepro](https://github.com/sepro))

#### Fixes
Expand All @@ -21,42 +21,42 @@
#### Additional testing and documentation:
- PR [#84](https://github.com/trevismd/statannotations/pull/84) by
[JasonMendoza2008 ](https://github.com/JasonMendoza2008)
- PR [#86](https://github.com/trevismd/statannotations/pull/86) by
- PR [#86](https://github.com/trevismd/statannotations/pull/86) by
[mbhall88](https://github.com/mbhall88)
- PR [#117](https://github.com/trevismd/statannotations/pull/117) by
[tathey1](https://github.com/tathey1)

## v0.5.0
- Add scipy's Brunner-Munzel test
- Fix applying statannotations for non-string group labels (Issue
- Fix applying statannotations for non-string group labels (Issue
[#65](https://github.com/trevismd/statannotations/issues/65))
- Get Zenodo DOI

### v0.4.5
- Add MANIFEST.IN (PR [#56](https://github.com/trevismd/statannotations/pull/56)
by [Matt Chan](https://github.com/thewchan))
- Limit supported Seaborn version to v.0.11.x
- Fix adding annotations with hue if data is passed as arrays
(PR [#64](https://github.com/trevismd/statannotations/pull/64) by
- Fix adding annotations with hue if data is passed as arrays
(PR [#64](https://github.com/trevismd/statannotations/pull/64) by
[getzze](https://github.com/getzze))

### v0.4.4
- The label for Kruskal-Wallis test explicitly states that it is run pairwise
- The label for Kruskal-Wallis test explicitly states that it is run pairwise
(PR [#40](https://github.com/trevismd/statannotations/pull/40) by
[sepro](https://github.com/sepro))
- Fix broken link in readme
(PR [#43](https://github.com/trevismd/statannotations/pull/43) by
[orena1](https://github.com/orena1))
- Fix custom annotations order with respect to the given pairs (Issue
- Fix custom annotations order with respect to the given pairs (Issue
[#45](https://github.com/trevismd/statannotations/issues/45))

### v0.4.3
- The `correction_format` parameter allows changing how the multiple
- The `correction_format` parameter allows changing how the multiple
comparisons correction method adjusts the annotation when changing a result
to non-significant.
- Fix the `show_test_name` configuration.
- Fix the `verbose` parameter
(PR [#37](https://github.com/trevismd/statannotations/pull/37) by
- Fix the `verbose` parameter
(PR [#37](https://github.com/trevismd/statannotations/pull/37) by
[mxposed](https://github.com/mxposed))

### v0.4.2
Expand All @@ -68,50 +68,50 @@ to non-significant.
- Support for horizontal orientation

### v0.4.0
- Major refactoring, change to an Annotator `class` to prepare and add
- Major refactoring, change to an Annotator `class` to prepare and add
annotations in separate function (now method) calls.
- Support for `violinplot`
- Fixes in rendering of non-significant tests results after multiple
- Fixes in rendering of non-significant tests results after multiple
comparisons correction
- Fix the printout of the star annotation legend
- Fix the failure when providing a dataframe with categories as different
- Fix the printout of the star annotation legend
- Fix the failure when providing a dataframe with categories as different
columns.
- Fix a bug where an incorrect xunits calculation resulted in wrong
association of points within a box, leading to erroneous max y position for
- Fix a bug where an incorrect xunits calculation resulted in wrong
association of points within a box, leading to erroneous max y position for
that box.
- Reduced code complexity, more SOLID.
- Many unit and integration tests

## v0.3
### v0.3.2
- Fix `simple` format outputs
- Fix `ImportError` when applying a multiple comparison correction without
- Fix `ImportError` when applying a multiple comparison correction without
statsmodels.
- Multiple comparison correction is `None` by default, as `statsmodels` is an
- Multiple comparison correction is `None` by default, as `statsmodels` is an
additional dependency.

### v0.3.1
- Added support of functions returning more than the two expected values when
- Added support of functions returning more than the two expected values when
used in `StatTest`
- Fix version numbers in CHANGELOG

### v0.3.0
(Explicitly Requires Python 3.6)

- Refactoring with implementation of `StatTest`
([#7](https://github.com/trevismd/statannotations/pull/5)), removing the
([#7](https://github.com/trevismd/statannotations/pull/5)), removing the
`stat_func` parameter, and `test_long_name`.
- Annotations y-positions based on plot coordinates instead of data
coordinates
(PR [#5](https://github.com/trevismd/statannotations/pull/5) by
[JosephLalli](https://github.com/JosephLalli),
- Annotations y-positions based on plot coordinates instead of data
coordinates
(PR [#5](https://github.com/trevismd/statannotations/pull/5) by
[JosephLalli](https://github.com/JosephLalli),
fixes https://github.com/webermarcolivier/statannot/issues/21).
- Add this CHANGELOG

## v0.2
### v0.2.8
- Fix bug on group/box named 0, fixes
- Fix bug on group/box named 0, fixes
https://github.com/trevismd/statannotations/issues/10, originally in
https://github.com/webermarcolivier/statannot/issues/78. Independently
fixed in https://github.com/webermarcolivier/statannot/pull/73 before this
https://github.com/webermarcolivier/statannot/issues/78. Independently
fixed in https://github.com/webermarcolivier/statannot/pull/73 before this
issue.
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## Contributing to statannotations
Thank you for your interest! This package is truly the work of multiple
Thank you for your interest! This package is truly the work of multiple
developers and participating users and this mustn't change.

Contributions are appreciated in all their forms, such as the opening of new
issues when discovering a (possible) bug, suggestion/upvote new features,
Contributions are appreciated in all their forms, such as the opening of new
issues when discovering a (possible) bug, suggestion/upvote new features,
participation to discussions, improvements of the documentation, etc.

If you wish specifically to submit code changes, please use the following
If you wish specifically to submit code changes, please use the following
guide:
- [ ] If it is not an answer to an open issue, please consider opening one
- [ ] If it is not an answer to an open issue, please consider opening one
first, even more if the changes are major and/or possibly controversial
- [ ] Make sure to have the dev dependencies installed: `packaging` and
- [ ] Make sure to have the dev dependencies installed: `packaging` and
`statsmodels`
- Fork the repository and make a new branch from the latest `dev` commit
- [ ] Make your code modifications, including unit testing if possible.
- [ ] Make your code modifications, including unit testing if possible.
Please follow PEP8 guidelines.
- [ ] Run the test suite and make sure previous (and new) tests pass
- [ ] Update CHANGELOG.md to describe your changes
- [ ] Open a PR to the `dev` branch, containing at least what was added to the
- [ ] Open a PR to the `dev` branch, containing at least what was added to the
changelog, as well as a reference to the issue if any
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

Loading