From 954b12e541ea31e455b4b7dd24200f8846284ef5 Mon Sep 17 00:00:00 2001 From: juanitorduz Date: Tue, 30 Apr 2024 23:25:58 +0200 Subject: [PATCH 1/4] improve pre-commit --- .github/workflows/ci.yml | 15 --------------- .pre-commit-config.yaml | 14 +++++++++----- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 190e4e01..31f03f8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,21 +7,6 @@ on: branches: [main] jobs: - lint: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11"] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Run lint - uses: pre-commit/action@v3.0.0 - test: runs-on: ubuntu-latest strategy: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a6a75eb..823e35f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,23 +1,27 @@ +ci: + autofix_prs: false + # 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 + rev: v4.6.0 hooks: + - id: debug-statements - id: trailing-whitespace exclude_types: [svg] - id: end-of-file-fixer exclude_types: [svg] - id: check-yaml - id: check-added-large-files - args: ['--maxkb=1500'] - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.1.4 + args: ["--maxkb=1500"] + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.2 hooks: - id: ruff - id: ruff-format - repo: https://github.com/nbQA-dev/nbQA - rev: 1.7.0 + rev: 1.8.5 hooks: - id: nbqa-ruff - repo: https://github.com/econchick/interrogate From c4b3b0c079477eb4786fc590fdf343c5f03e1623 Mon Sep 17 00:00:00 2001 From: juanitorduz Date: Tue, 30 Apr 2024 23:27:06 +0200 Subject: [PATCH 2/4] pre-commit updates --- causalpy/data/__init__.py | 1 + causalpy/data/datasets.py | 1 + causalpy/data/simulate_data.py | 1 + causalpy/skl_experiments.py | 1 + causalpy/skl_models.py | 1 + causalpy/tests/conftest.py | 1 + causalpy/tests/test_data_loading.py | 1 + causalpy/utils.py | 1 + 8 files changed, 8 insertions(+) diff --git a/causalpy/data/__init__.py b/causalpy/data/__init__.py index 6a69442d..8e84091b 100644 --- a/causalpy/data/__init__.py +++ b/causalpy/data/__init__.py @@ -1,4 +1,5 @@ """Code for loading datasets.""" + from .datasets import load_data __all__ = ["load_data"] diff --git a/causalpy/data/datasets.py b/causalpy/data/datasets.py index 97014345..a16187db 100644 --- a/causalpy/data/datasets.py +++ b/causalpy/data/datasets.py @@ -1,6 +1,7 @@ """ Functions to load example datasets """ + import pathlib import pandas as pd diff --git a/causalpy/data/simulate_data.py b/causalpy/data/simulate_data.py index c54a88ca..a643e5f4 100644 --- a/causalpy/data/simulate_data.py +++ b/causalpy/data/simulate_data.py @@ -1,6 +1,7 @@ """ Functions that generate data sets used in examples """ + import numpy as np import pandas as pd from scipy.stats import dirichlet, gamma, norm, uniform diff --git a/causalpy/skl_experiments.py b/causalpy/skl_experiments.py index 6f43f4e7..e13c5c8f 100644 --- a/causalpy/skl_experiments.py +++ b/causalpy/skl_experiments.py @@ -8,6 +8,7 @@ - DifferenceInDifferences - RegressionDiscontinuity """ + import warnings from typing import Optional diff --git a/causalpy/skl_models.py b/causalpy/skl_models.py index f9adcdd3..cd7ea549 100644 --- a/causalpy/skl_models.py +++ b/causalpy/skl_models.py @@ -4,6 +4,7 @@ - Weighted Proportion """ + from functools import partial import numpy as np diff --git a/causalpy/tests/conftest.py b/causalpy/tests/conftest.py index 92a2a77e..74dede89 100644 --- a/causalpy/tests/conftest.py +++ b/causalpy/tests/conftest.py @@ -4,6 +4,7 @@ Functions: * rng: random number generator with session level scope """ + import numpy as np import pytest diff --git a/causalpy/tests/test_data_loading.py b/causalpy/tests/test_data_loading.py index 343c2c22..ed31d8f0 100644 --- a/causalpy/tests/test_data_loading.py +++ b/causalpy/tests/test_data_loading.py @@ -1,6 +1,7 @@ """ Tests that example data can be loaded into data frames. """ + import pandas as pd import pytest diff --git a/causalpy/utils.py b/causalpy/utils.py index 2b794503..25ba3a40 100644 --- a/causalpy/utils.py +++ b/causalpy/utils.py @@ -1,6 +1,7 @@ """ Utility functions """ + import numpy as np import pandas as pd From f02c53a4c9fff1cbde039f1f0239523303099c1a Mon Sep 17 00:00:00 2001 From: juanitorduz Date: Tue, 30 Apr 2024 23:28:08 +0200 Subject: [PATCH 3/4] pre-commit can fix --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 823e35f0..793e1644 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,7 @@ repos: rev: v0.4.2 hooks: - id: ruff + args: ["--fix", "--output-format=full"] - id: ruff-format - repo: https://github.com/nbQA-dev/nbQA rev: 1.8.5 From e13b919700c949b764f296cfacf31f3a6950f2a1 Mon Sep 17 00:00:00 2001 From: juanitorduz Date: Tue, 30 Apr 2024 23:41:35 +0200 Subject: [PATCH 4/4] try fix --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82d321d3..5feb538a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: mkdir -p test-sdist cd test-sdist python -m venv venv-sdist - venv-sdist/bin/python -m pip install ../dist/CausalPy*.tar.gz + venv-sdist/bin/python -m pip install ../dist/causalpy*.tar.gz echo "Checking import and version number (on release)" venv-sdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else causalpy.__version__; print(causalpy.__version__)" cd ..