diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..095f637 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,19 @@ +name: Ruff +on: [push, pull_request] + +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "3.9" + - name: Run Ruff with auto-fix + uses: chartboost/ruff-action@v1 + with: + args: --fix # Automatically apply safe fixes + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'style fixes by ruff' + file_pattern: '*.py' # Ensure only Python files are committed \ No newline at end of file diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 0000000..fa03a2e --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,19 @@ +name: Python Unit Tests +on: [push, pull_request] + +jobs: + unit-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -e ."[dev, test]" + - name: Run Unit Tests + run: | + python -m unittest discover \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1878330..4399084 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,8 @@ dmypy.json *.jpg *.jpeg *.png + +# don't ignore github workflow +!/.github/ +!/.github/workflows/ +!/.github/workflows/*.yml diff --git a/pyproject.toml b/pyproject.toml index aabfd8c..5b2826a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,8 @@ dependencies = [ "numpy", "pandas", "seaborn", - "statannot" + "statannot", + "scipy" ] [project.urls] diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..7455bb5 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,61 @@ +# Exclude a variety of commonly ignored directories. +exclude = [ + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv", +] + +# Same as Black. +line-length = 80 +indent-width = 4 + +# Assume Python 3.9 +target-version = "py39" + +[lint] +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. +# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or +# McCabe complexity (`C901`) by default. +select = ["E4", "E7", "E9", "F"] +ignore = [] + +# Allow fix for all enabled rules (when `--fix`) is provided. +fixable = ["ALL"] +unfixable = [] + +# Allow unused variables when underscore-prefixed. +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" + +[format] +# Like Black, use double quotes for strings. +quote-style = "double" + +# Like Black, indent with spaces, rather than tabs. +indent-style = "space" + +# Like Black, respect magic trailing commas. +skip-magic-trailing-comma = false + +# Like Black, automatically detect the appropriate line ending. +line-ending = "auto" + +[lint.pydocstyle] +convention = "google" \ No newline at end of file diff --git a/swarm_visualizer/barplot.py b/swarm_visualizer/barplot.py index 09e8b22..3c88310 100644 --- a/swarm_visualizer/barplot.py +++ b/swarm_visualizer/barplot.py @@ -1,4 +1,3 @@ -import numpy as np import seaborn as sns from swarm_visualizer.utility.general_utils import set_axis_infos diff --git a/swarm_visualizer/lineplot.py b/swarm_visualizer/lineplot.py index 29479d1..7d8e0a2 100644 --- a/swarm_visualizer/lineplot.py +++ b/swarm_visualizer/lineplot.py @@ -38,7 +38,6 @@ def plot_overlaid_ts( title_str: str = None, ylabel: str = None, xlabel: str = "time", - fontsize: float = 30, xticks=None, ylim=None, DEFAULT_ALPHA: float = 1.0, @@ -53,7 +52,6 @@ def plot_overlaid_ts( :param title_str: title of the plot :param ylabel: y-axis label :param xlabel: x-axis label - :param fontsize: font size :param xticks: x-axis ticks :param ylim: y-axis limits :param DEFAULT_ALPHA: default alpha value diff --git a/swarm_visualizer/scatterplot.py b/swarm_visualizer/scatterplot.py index b6ca96e..0502624 100644 --- a/swarm_visualizer/scatterplot.py +++ b/swarm_visualizer/scatterplot.py @@ -55,7 +55,6 @@ def plot_scatter_pdf_plot( ts_y=None, title_str: str = None, ylabel: str = None, - lw: float = 3.0, ylim=None, xlabel: str = "time", xlim=None, diff --git a/swarm_visualizer/utility/textfile_utils.py b/swarm_visualizer/utility/textfile_utils.py index bc64664..7715cec 100644 --- a/swarm_visualizer/utility/textfile_utils.py +++ b/swarm_visualizer/utility/textfile_utils.py @@ -15,7 +15,6 @@ import os import pickle -import numpy as np from scipy.ndimage import shift """ diff --git a/tests/test_lineplot.py b/tests/test_lineplot.py index 6ee48a1..ec49be9 100644 --- a/tests/test_lineplot.py +++ b/tests/test_lineplot.py @@ -101,7 +101,6 @@ def test_overlaid_ts_plot(normalized_ts_dict) -> None: title_str="Overlaid Time Series Plot", ylabel="$y$", xlabel="$x$", - fontsize=30, xticks=None, ylim=None, DEFAULT_ALPHA=1.0, diff --git a/tests/test_scatterplot.py b/tests/test_scatterplot.py index 65b6f83..f089306 100644 --- a/tests/test_scatterplot.py +++ b/tests/test_scatterplot.py @@ -71,7 +71,6 @@ def test_scatter_pdf_plot(x_data, y_data) -> None: ts_y=y_data, title_str="Scatter Plot with CDFs", ylabel="$y$", - lw=3.0, ylim=None, xlabel="$x$", xlim=None,