diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index 7c87b1c3..b2f210f4 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -30,13 +30,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install -r requirements-test.txt - pip install . + pip install .[test] - name: Test with pytest run: | - pytest --cov --cov-report=xml --cov-config=setup.cfg --verbose + pytest --cov --cov-report=xml --verbose - name: Build docs if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == 3.9 }} diff --git a/MANIFEST.in b/MANIFEST.in index d9af3ce8..75fe1cdc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,36 +1,6 @@ # Add README, LICENSE and requirements : include README.rst include LICENSE -include requirements.txt # Add datasets .csv files -include pingouin/datasets/ancova.csv -include pingouin/datasets/anova.csv -include pingouin/datasets/anova2.csv -include pingouin/datasets/anova2_unbalanced.csv -include pingouin/datasets/anova3.csv -include pingouin/datasets/anova3_unbalanced.csv -include pingouin/datasets/blandaltman.csv -include pingouin/datasets/chi2_independence.csv -include pingouin/datasets/chi2_mcnemar.csv -include pingouin/datasets/circular.csv -include pingouin/datasets/cochran.csv -include pingouin/datasets/cronbach_alpha.csv -include pingouin/datasets/cronbach_wide_missing.csv -include pingouin/datasets/datasets.csv -include pingouin/datasets/icc.csv -include pingouin/datasets/mediation.csv -include pingouin/datasets/mixed_anova.csv -include pingouin/datasets/mixed_anova_unbalanced.csv -include pingouin/datasets/multivariate.csv -include pingouin/datasets/pairwise_corr.csv -include pingouin/datasets/pairwise_tests.csv -include pingouin/datasets/pairwise_tests_missing.csv -include pingouin/datasets/partial_corr.csv -include pingouin/datasets/penguins.csv -include pingouin/datasets/rm_anova.csv -include pingouin/datasets/rm_anova2.csv -include pingouin/datasets/rm_anova_wide.csv -include pingouin/datasets/rm_corr.csv -include pingouin/datasets/rm_missing.csv -include pingouin/datasets/tips.csv +recursive-include src/pingouin/datasets *.csv diff --git a/README.rst b/README.rst index 1493d8f9..d73f1f91 100644 --- a/README.rst +++ b/README.rst @@ -114,6 +114,19 @@ New releases are frequent so always make sure that you have the latest version: pip install --upgrade pingouin +Development +----------- + +To build and install from source, clone this repository or download the source archive and decompress the files + +.. code-block:: shell + + cd pingouin + python -m build # optional, build a wheel and sdist + pip install . # install the package + pip install --editable . # or editable install + pytest # test the package + Quick start ============ diff --git a/pyproject.toml b/pyproject.toml index 67a6d04a..7a2f1782 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,121 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "pingouin" +description = "Pingouin: statistical package for Python" +authors = [ + {name = "Raphael Vallat", email = "raphaelvallat9@gmail.com"}, +] +dependencies = [ + "matplotlib", + "numpy", + "pandas>=1.5", + "pandas_flavor", + "scikit-learn>=1.2", + "scipy", + "seaborn", + "statsmodels", + "tabulate", +] +requires-python = ">=3.8" +readme = "README.rst" +license = {text = "GPL-3.0"} +maintainers = [ + {name = "Raphael Vallat", email = "raphaelvallat9@gmail.com"}, +] +dynamic = ["version"] +classifiers = [ + "Intended Audience :: Science/Research", + "Operating System :: MacOS", + "Operating System :: POSIX", + "Operating System :: Unix", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Topic :: Scientific/Engineering :: Mathematics", +] + +[project.optional-dependencies] +test = [ + "pytest>=6", + "pytest-cov", + "codecov", + "openpyxl", + "mpmath", + # Ensure coverage is new enough for `source_pkgs`. + "coverage[toml]>=5.3", +] + +[project.urls] +Homepage = "https://pingouin-stats.org/index.html" +Downloads = "https://github.com/raphaelvallat/pingouin/" + +[tool.setuptools] +py-modules = ["pingouin"] +include-package-data = true + +[tool.setuptools.package-data] +pingouin = [ + "datasets/*.csv", +] + +[tool.setuptools.packages.find] +namespaces = false +where = ["src"] + +[tool.setuptools.dynamic] +version = {attr = "pingouin.__version__"} + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "--showlocals --durations=10 --maxfail=2 --cov" +doctest_optionflags= ["NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL"] +filterwarnings = [ + "ignore::UserWarning", + "ignore::RuntimeWarning", + "ignore::FutureWarning", +] +markers = ["slow"] + +[tool.coverage.run] +branch = true +omit = [ + "*/setup.py", + "*/examples/*", + "*/tests/*", + "*/datasets/*", +] +source_pkgs = ["pingouin"] + +[tool.coverage.paths] +source = ["src"] + +[tool.coverage.report] +show_missing = true +# sort = "Cover" + [tool.black] line-length = 100 target-version = ['py311'] -include = '\.pyi?$' \ No newline at end of file +include = '\.pyi?$' + +[tool.flake8] +# W605 : bug when math equation in numpydoc +# W503, W504 : line-break with math operator +# E203: E203 whitespace before ':', not compatible with Black +# DXXX: Docstring related +max-line-length = 100 +ignore = ["N806", "N803", "W503", "W504", "W605", "D100", "D200", "D205", "D301", "D400", "D401", "E203"] +exclude = [ + ".git", + "__pycache__", + "docs", + "build", + "__init__.py", + "examples", + "setup.py", +] +statistics = true diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index 6c3c87f3..00000000 --- a/requirements-test.txt +++ /dev/null @@ -1,6 +0,0 @@ -pytest>=4.6 -codecov -pytest-cov -openpyxl -mpmath -numpy diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 3c6373ca..00000000 --- a/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -numpy -scipy -pandas>=1.5 -matplotlib -seaborn -statsmodels -scikit-learn -pandas_flavor -tabulate diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index e189609c..00000000 --- a/setup.cfg +++ /dev/null @@ -1,47 +0,0 @@ -[aliases] -test=pytest - -[tool:pytest] -addopts = - --showlocals - --durations=10 - --maxfail=2 - --cov -# --doctest-modules --doctest-continue-on-failure | do not work with travis -doctest_optionflags= NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL -markers = - slow: mark a test as slow. -filterwarnings = - ignore::UserWarning - ignore::RuntimeWarning - ignore::FutureWarning - -[flake8] -# W605 : bug when math equation in numpydoc -# W503, W504 : line-break with math operator -# E203: E203 whitespace before ':', not compatible with Black -# DXXX: Docstring related -max-line-length = 100 -ignore = N806, N803, W503, W504, W605, D100, D200, D205, D301, D400, D401, E203 -exclude = - .git, - __pycache__, - docs, - build, - __init__.py, - examples, - setup.py, -statistics=True - -[coverage:run] -branch = True -source = pingouin -omit = - */setup.py - */examples/* - */tests/* - */datasets/* - -[coverage:report] -show_missing = True -# sort = Cover diff --git a/setup.py b/setup.py deleted file mode 100644 index 563cbc08..00000000 --- a/setup.py +++ /dev/null @@ -1,78 +0,0 @@ -#! /usr/bin/env python -# -# Copyright (C) 2018 Raphael Vallat -import os - - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - - -DESCRIPTION = "Pingouin: statistical package for Python" -LONG_DESCRIPTION = """Pingouin is a statistical Python package based on Pandas. -""" - -DISTNAME = "pingouin" -MAINTAINER = "Raphael Vallat" -MAINTAINER_EMAIL = "raphaelvallat9@gmail.com" -URL = "https://pingouin-stats.org/index.html" -DOWNLOAD_URL = "https://github.com/raphaelvallat/pingouin/" -VERSION = "0.5.4" -LICENSE = "GPL-3.0" -PACKAGE_DATA = {"pingouin.data.icons": ["*.svg"]} - -INSTALL_REQUIRES = [ - "numpy", - "scipy", - "pandas>=1.5", - "matplotlib", - "seaborn", - "statsmodels", - "scikit-learn", - "pandas_flavor", - "tabulate", -] - -PACKAGES = [ - "pingouin", - "pingouin.datasets", -] - -CLASSIFIERS = [ - "Intended Audience :: Science/Research", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering :: Mathematics", - "Operating System :: POSIX", - "Operating System :: Unix", - "Operating System :: MacOS", -] - -try: - from setuptools import setup - - _has_setuptools = True -except ImportError: - from distutils.core import setup - -if __name__ == "__main__": - setup( - name=DISTNAME, - author=MAINTAINER, - author_email=MAINTAINER_EMAIL, - maintainer=MAINTAINER, - maintainer_email=MAINTAINER_EMAIL, - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - license=LICENSE, - url=URL, - version=VERSION, - download_url=DOWNLOAD_URL, - install_requires=INSTALL_REQUIRES, - include_package_data=True, - packages=PACKAGES, - package_data=PACKAGE_DATA, - classifiers=CLASSIFIERS, - ) diff --git a/pingouin/__init__.py b/src/pingouin/__init__.py similarity index 100% rename from pingouin/__init__.py rename to src/pingouin/__init__.py diff --git a/pingouin/bayesian.py b/src/pingouin/bayesian.py similarity index 100% rename from pingouin/bayesian.py rename to src/pingouin/bayesian.py diff --git a/pingouin/circular.py b/src/pingouin/circular.py similarity index 100% rename from pingouin/circular.py rename to src/pingouin/circular.py diff --git a/pingouin/config.py b/src/pingouin/config.py similarity index 100% rename from pingouin/config.py rename to src/pingouin/config.py diff --git a/pingouin/contingency.py b/src/pingouin/contingency.py similarity index 100% rename from pingouin/contingency.py rename to src/pingouin/contingency.py diff --git a/pingouin/correlation.py b/src/pingouin/correlation.py similarity index 100% rename from pingouin/correlation.py rename to src/pingouin/correlation.py diff --git a/pingouin/datasets/__init__.py b/src/pingouin/datasets/__init__.py similarity index 100% rename from pingouin/datasets/__init__.py rename to src/pingouin/datasets/__init__.py diff --git a/pingouin/datasets/ancova.csv b/src/pingouin/datasets/ancova.csv similarity index 100% rename from pingouin/datasets/ancova.csv rename to src/pingouin/datasets/ancova.csv diff --git a/pingouin/datasets/anova.csv b/src/pingouin/datasets/anova.csv similarity index 100% rename from pingouin/datasets/anova.csv rename to src/pingouin/datasets/anova.csv diff --git a/pingouin/datasets/anova2.csv b/src/pingouin/datasets/anova2.csv similarity index 100% rename from pingouin/datasets/anova2.csv rename to src/pingouin/datasets/anova2.csv diff --git a/pingouin/datasets/anova2_unbalanced.csv b/src/pingouin/datasets/anova2_unbalanced.csv similarity index 100% rename from pingouin/datasets/anova2_unbalanced.csv rename to src/pingouin/datasets/anova2_unbalanced.csv diff --git a/pingouin/datasets/anova3.csv b/src/pingouin/datasets/anova3.csv similarity index 100% rename from pingouin/datasets/anova3.csv rename to src/pingouin/datasets/anova3.csv diff --git a/pingouin/datasets/anova3_unbalanced.csv b/src/pingouin/datasets/anova3_unbalanced.csv similarity index 100% rename from pingouin/datasets/anova3_unbalanced.csv rename to src/pingouin/datasets/anova3_unbalanced.csv diff --git a/pingouin/datasets/blandaltman.csv b/src/pingouin/datasets/blandaltman.csv similarity index 100% rename from pingouin/datasets/blandaltman.csv rename to src/pingouin/datasets/blandaltman.csv diff --git a/pingouin/datasets/chi2_independence.csv b/src/pingouin/datasets/chi2_independence.csv similarity index 100% rename from pingouin/datasets/chi2_independence.csv rename to src/pingouin/datasets/chi2_independence.csv diff --git a/pingouin/datasets/chi2_mcnemar.csv b/src/pingouin/datasets/chi2_mcnemar.csv similarity index 100% rename from pingouin/datasets/chi2_mcnemar.csv rename to src/pingouin/datasets/chi2_mcnemar.csv diff --git a/pingouin/datasets/circular.csv b/src/pingouin/datasets/circular.csv similarity index 100% rename from pingouin/datasets/circular.csv rename to src/pingouin/datasets/circular.csv diff --git a/pingouin/datasets/cochran.csv b/src/pingouin/datasets/cochran.csv similarity index 100% rename from pingouin/datasets/cochran.csv rename to src/pingouin/datasets/cochran.csv diff --git a/pingouin/datasets/cronbach_alpha.csv b/src/pingouin/datasets/cronbach_alpha.csv similarity index 100% rename from pingouin/datasets/cronbach_alpha.csv rename to src/pingouin/datasets/cronbach_alpha.csv diff --git a/pingouin/datasets/cronbach_wide_missing.csv b/src/pingouin/datasets/cronbach_wide_missing.csv similarity index 100% rename from pingouin/datasets/cronbach_wide_missing.csv rename to src/pingouin/datasets/cronbach_wide_missing.csv diff --git a/pingouin/datasets/datasets.csv b/src/pingouin/datasets/datasets.csv similarity index 100% rename from pingouin/datasets/datasets.csv rename to src/pingouin/datasets/datasets.csv diff --git a/pingouin/datasets/icc.csv b/src/pingouin/datasets/icc.csv similarity index 100% rename from pingouin/datasets/icc.csv rename to src/pingouin/datasets/icc.csv diff --git a/pingouin/datasets/mediation.csv b/src/pingouin/datasets/mediation.csv similarity index 100% rename from pingouin/datasets/mediation.csv rename to src/pingouin/datasets/mediation.csv diff --git a/pingouin/datasets/mixed_anova.csv b/src/pingouin/datasets/mixed_anova.csv similarity index 100% rename from pingouin/datasets/mixed_anova.csv rename to src/pingouin/datasets/mixed_anova.csv diff --git a/pingouin/datasets/mixed_anova_unbalanced.csv b/src/pingouin/datasets/mixed_anova_unbalanced.csv similarity index 100% rename from pingouin/datasets/mixed_anova_unbalanced.csv rename to src/pingouin/datasets/mixed_anova_unbalanced.csv diff --git a/pingouin/datasets/multivariate.csv b/src/pingouin/datasets/multivariate.csv similarity index 100% rename from pingouin/datasets/multivariate.csv rename to src/pingouin/datasets/multivariate.csv diff --git a/pingouin/datasets/pairwise_corr.csv b/src/pingouin/datasets/pairwise_corr.csv similarity index 100% rename from pingouin/datasets/pairwise_corr.csv rename to src/pingouin/datasets/pairwise_corr.csv diff --git a/pingouin/datasets/pairwise_tests.csv b/src/pingouin/datasets/pairwise_tests.csv similarity index 100% rename from pingouin/datasets/pairwise_tests.csv rename to src/pingouin/datasets/pairwise_tests.csv diff --git a/pingouin/datasets/pairwise_tests_missing.csv b/src/pingouin/datasets/pairwise_tests_missing.csv similarity index 100% rename from pingouin/datasets/pairwise_tests_missing.csv rename to src/pingouin/datasets/pairwise_tests_missing.csv diff --git a/pingouin/datasets/partial_corr.csv b/src/pingouin/datasets/partial_corr.csv similarity index 100% rename from pingouin/datasets/partial_corr.csv rename to src/pingouin/datasets/partial_corr.csv diff --git a/pingouin/datasets/penguins.csv b/src/pingouin/datasets/penguins.csv similarity index 100% rename from pingouin/datasets/penguins.csv rename to src/pingouin/datasets/penguins.csv diff --git a/pingouin/datasets/rm_anova.csv b/src/pingouin/datasets/rm_anova.csv similarity index 100% rename from pingouin/datasets/rm_anova.csv rename to src/pingouin/datasets/rm_anova.csv diff --git a/pingouin/datasets/rm_anova2.csv b/src/pingouin/datasets/rm_anova2.csv similarity index 100% rename from pingouin/datasets/rm_anova2.csv rename to src/pingouin/datasets/rm_anova2.csv diff --git a/pingouin/datasets/rm_anova_wide.csv b/src/pingouin/datasets/rm_anova_wide.csv similarity index 100% rename from pingouin/datasets/rm_anova_wide.csv rename to src/pingouin/datasets/rm_anova_wide.csv diff --git a/pingouin/datasets/rm_corr.csv b/src/pingouin/datasets/rm_corr.csv similarity index 100% rename from pingouin/datasets/rm_corr.csv rename to src/pingouin/datasets/rm_corr.csv diff --git a/pingouin/datasets/rm_missing.csv b/src/pingouin/datasets/rm_missing.csv similarity index 100% rename from pingouin/datasets/rm_missing.csv rename to src/pingouin/datasets/rm_missing.csv diff --git a/pingouin/datasets/tips.csv b/src/pingouin/datasets/tips.csv similarity index 100% rename from pingouin/datasets/tips.csv rename to src/pingouin/datasets/tips.csv diff --git a/pingouin/distribution.py b/src/pingouin/distribution.py similarity index 100% rename from pingouin/distribution.py rename to src/pingouin/distribution.py diff --git a/pingouin/effsize.py b/src/pingouin/effsize.py similarity index 100% rename from pingouin/effsize.py rename to src/pingouin/effsize.py diff --git a/pingouin/equivalence.py b/src/pingouin/equivalence.py similarity index 100% rename from pingouin/equivalence.py rename to src/pingouin/equivalence.py diff --git a/pingouin/multicomp.py b/src/pingouin/multicomp.py similarity index 100% rename from pingouin/multicomp.py rename to src/pingouin/multicomp.py diff --git a/pingouin/multivariate.py b/src/pingouin/multivariate.py similarity index 100% rename from pingouin/multivariate.py rename to src/pingouin/multivariate.py diff --git a/pingouin/nonparametric.py b/src/pingouin/nonparametric.py similarity index 100% rename from pingouin/nonparametric.py rename to src/pingouin/nonparametric.py diff --git a/pingouin/pairwise.py b/src/pingouin/pairwise.py similarity index 100% rename from pingouin/pairwise.py rename to src/pingouin/pairwise.py diff --git a/pingouin/parametric.py b/src/pingouin/parametric.py similarity index 100% rename from pingouin/parametric.py rename to src/pingouin/parametric.py diff --git a/pingouin/plotting.py b/src/pingouin/plotting.py similarity index 100% rename from pingouin/plotting.py rename to src/pingouin/plotting.py diff --git a/pingouin/power.py b/src/pingouin/power.py similarity index 100% rename from pingouin/power.py rename to src/pingouin/power.py diff --git a/pingouin/regression.py b/src/pingouin/regression.py similarity index 100% rename from pingouin/regression.py rename to src/pingouin/regression.py diff --git a/pingouin/reliability.py b/src/pingouin/reliability.py similarity index 100% rename from pingouin/reliability.py rename to src/pingouin/reliability.py diff --git a/pingouin/utils.py b/src/pingouin/utils.py similarity index 100% rename from pingouin/utils.py rename to src/pingouin/utils.py diff --git a/pingouin/tests/__init__.py b/tests/__init__.py similarity index 100% rename from pingouin/tests/__init__.py rename to tests/__init__.py diff --git a/pingouin/tests/test_bayesian.py b/tests/test_bayesian.py similarity index 100% rename from pingouin/tests/test_bayesian.py rename to tests/test_bayesian.py diff --git a/pingouin/tests/test_circular.py b/tests/test_circular.py similarity index 100% rename from pingouin/tests/test_circular.py rename to tests/test_circular.py diff --git a/pingouin/tests/test_config.py b/tests/test_config.py similarity index 100% rename from pingouin/tests/test_config.py rename to tests/test_config.py diff --git a/pingouin/tests/test_contingency.py b/tests/test_contingency.py similarity index 100% rename from pingouin/tests/test_contingency.py rename to tests/test_contingency.py diff --git a/pingouin/tests/test_correlation.R b/tests/test_correlation.R similarity index 100% rename from pingouin/tests/test_correlation.R rename to tests/test_correlation.R diff --git a/pingouin/tests/test_correlation.py b/tests/test_correlation.py similarity index 100% rename from pingouin/tests/test_correlation.py rename to tests/test_correlation.py diff --git a/pingouin/tests/test_distribution.py b/tests/test_distribution.py similarity index 100% rename from pingouin/tests/test_distribution.py rename to tests/test_distribution.py diff --git a/pingouin/tests/test_effsize.py b/tests/test_effsize.py similarity index 100% rename from pingouin/tests/test_effsize.py rename to tests/test_effsize.py diff --git a/pingouin/tests/test_equivalence.py b/tests/test_equivalence.py similarity index 100% rename from pingouin/tests/test_equivalence.py rename to tests/test_equivalence.py diff --git a/pingouin/tests/test_multicomp.py b/tests/test_multicomp.py similarity index 100% rename from pingouin/tests/test_multicomp.py rename to tests/test_multicomp.py diff --git a/pingouin/tests/test_multivariate.py b/tests/test_multivariate.py similarity index 100% rename from pingouin/tests/test_multivariate.py rename to tests/test_multivariate.py diff --git a/pingouin/tests/test_nonparametric.py b/tests/test_nonparametric.py similarity index 100% rename from pingouin/tests/test_nonparametric.py rename to tests/test_nonparametric.py diff --git a/pingouin/tests/test_pairwise.py b/tests/test_pairwise.py similarity index 100% rename from pingouin/tests/test_pairwise.py rename to tests/test_pairwise.py diff --git a/pingouin/tests/test_pandas.py b/tests/test_pandas.py similarity index 100% rename from pingouin/tests/test_pandas.py rename to tests/test_pandas.py diff --git a/pingouin/tests/test_parametric.py b/tests/test_parametric.py similarity index 100% rename from pingouin/tests/test_parametric.py rename to tests/test_parametric.py diff --git a/pingouin/tests/test_plotting.py b/tests/test_plotting.py similarity index 100% rename from pingouin/tests/test_plotting.py rename to tests/test_plotting.py diff --git a/pingouin/tests/test_power.py b/tests/test_power.py similarity index 100% rename from pingouin/tests/test_power.py rename to tests/test_power.py diff --git a/pingouin/tests/test_regression.py b/tests/test_regression.py similarity index 100% rename from pingouin/tests/test_regression.py rename to tests/test_regression.py diff --git a/pingouin/tests/test_reliability.py b/tests/test_reliability.py similarity index 100% rename from pingouin/tests/test_reliability.py rename to tests/test_reliability.py diff --git a/pingouin/tests/test_utils.py b/tests/test_utils.py similarity index 100% rename from pingouin/tests/test_utils.py rename to tests/test_utils.py