statannotations icon indicating copy to clipboard operation
statannotations copied to clipboard

Use pyproject.toml with hatch

Open getzze opened this issue 1 year ago • 10 comments

Modernize the building and testing framework:

  • use pyproject.toml
  • use hatch environments
  • ~~add test_script to test plotting figures~~ -> added in #155

To build: hatch build or python -m build To bump version: hatch version minor To test: hatch run tests:run To test with coverage: hatch run tests:run-cov && hatch run coverage:run To build and test docs: hatch run docs:all To run examples: hatch run examples:run -- --plot_type=boxplot --data_type=df_with_group_and_hue

To test #155 I had to write the test_script.py file and it was very convenient to use hatch environments for testing. So I thought I should actually make a PR about it :)

getzze avatar Jul 25 '24 22:07 getzze

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 97.27%. Comparing base (48a3771) to head (105e57b). Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
statannotations/compat.py 72.72% 2 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #156      +/-   ##
==========================================
+ Coverage   91.39%   97.27%   +5.87%     
==========================================
  Files          34       16      -18     
  Lines        2465     1507     -958     
  Branches        0      212     +212     
==========================================
- Hits         2253     1466     -787     
+ Misses        212       27     -185     
- Partials        0       14      +14     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jul 27 '24 00:07 codecov[bot]

I modified a bit the Github action so instead of calling hatch once to run all the tests, the workflow creates a matrix of python and seaborn versions (we could also add an OS matrix if needed, see https://github.com/platformdirs/platformdirs/ for the modifications to do).

Github runs matrix jobs in parallel so the tests are substantially faster.

getzze avatar Jul 31 '24 16:07 getzze

I forgot to mention that python 3.7 is not tested (hatch was not working for me with this python version). It would be better to drop it, as it is EOL anyway.

getzze avatar Jul 31 '24 16:07 getzze

Thanks for merging #155, I rebased this PR, all tests are passing now. I will check the jupyter notebook.

Reminder: minimal python version is set to 3.8

getzze avatar Nov 19 '24 14:11 getzze

The notebook runs correctly with python 3.12.

I added support for python 3.13 (only compatible with seaborn 0.13), the tests are passing.

getzze avatar Nov 19 '24 15:11 getzze

Coverage is working now!

getzze avatar Nov 19 '24 17:11 getzze

@trevismd it's ready for review

getzze avatar Nov 19 '24 17:11 getzze

closes #150

I moved all the source files to a src folder, which avoids some errors when running tests and building docs.

Also I added some linting scripts: typos , end-of-file-fixer and trailing-whitespace

getzze avatar Nov 19 '24 21:11 getzze

Hi @trevismd , I rebased this PR. It seems it has a lot of changes but most of it is getting rid of the build docs folder (that should not be tracked with git). I believe this PR will help make the project more maintainable by moving to modern packaging with pyproject.toml.

The next step would be to add type annotations and a fast linter (ruff). But for that we need to have a pyproject.toml.

A reverted moving the source to a src folder as it is not critical and it makes the changes less trackable. If needed it can be done in a separate PR that does only that.

getzze avatar Mar 26 '25 10:03 getzze

I think it would make sense to merge this PR, and then as a next step work to improve docstrings and type annotations to make the package and documentation a bit more accessible?

phaleanopsis avatar Jul 16 '25 20:07 phaleanopsis