Skip to content

Commit

Permalink
CI maintenance (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus committed Feb 28, 2024
1 parent 9916c03 commit 9c7c43e
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 36 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: '>=3.11'
- uses: pre-commit/action@main
31 changes: 17 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
repos:
- repo: https://github.com/tdegeus/conda_envfile
rev: v0.5.2
hooks:
- id: conda_envfile_pyproject
files: environment.yaml
args: [--format]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
Expand All @@ -8,12 +14,12 @@ repos:
- id: check-toml
- id: debug-statements
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.11.0
rev: v2.12.0
hooks:
- id: pretty-format-yaml
args: [--preserve-quotes, --autofix, --indent, '2']
- id: pretty-format-toml
args: [--autofix]
args: [--autofix, --indent, '4', --trailing-commas]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand All @@ -25,35 +31,32 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.2.0
hooks:
- id: black
args: [--safe, --quiet, --line-length=100]
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.0
hooks:
- id: autoflake
args: [--in-place, --remove-unused-variable]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.12.0
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: reorder-python-imports
- id: isort
name: isort
args: ["--force-single-line", "--line-length=100", "--profile=black"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
args: ["--max-line-length=100", "--per-file-ignores=shelephant/__init__.py:F401", "--ignore=E203,W503"]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/tdegeus/conda_envfile
rev: v0.4.2
hooks:
- id: conda_envfile_parse
files: environment.yaml
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ sphinx:
configuration: docs/conf.py

build:
os: ubuntu-22.04
os: ubuntu-lts-latest
tools:
python: mambaforge-22.9
python: mambaforge-latest

conda:
environment: environment.yaml
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
authors = [{name = "Tom de Geus", email = "tom@geus.me"}]
classifiers = ["License :: OSI Approved :: MIT License"]
dependencies = [
"click",
"numpy>=1.15.0",
"platformdirs",
"prettytable",
"pyyaml",
"tqdm"
"click",
"numpy >=1.15.0",
"platformdirs",
"prettytable",
"pyyaml",
"tqdm",
]
description = "Simple dataset management"
dynamic = ["version"]
Expand Down
1 change: 1 addition & 0 deletions shelephant/_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Not part of public API.
"""

import os
import pathlib

Expand Down
1 change: 1 addition & 0 deletions shelephant/rsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
(c) Tom de Geus, 2021, MIT
"""

import os
import re
import subprocess
Expand Down
32 changes: 20 additions & 12 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,11 @@ def test_ssh_send(self):
if not has_ssh:
raise unittest.SkipTest("'ssh localhost' does not work")

with tempdir(), shelephant.ssh.tempdir("localhost") as remote, contextlib.redirect_stdout(
io.StringIO()
) as sio:
with (
tempdir(),
shelephant.ssh.tempdir("localhost") as remote,
contextlib.redirect_stdout(io.StringIO()) as sio,
):
files = ["foo.txt", "bar.txt", "more.txt", "even_more.txt"]
check = create_dummy_files(files)
shelephant_dump(files)
Expand Down Expand Up @@ -410,9 +412,11 @@ def test_ssh_send2(self):
if not has_ssh:
raise unittest.SkipTest("'ssh localhost' does not work")

with tempdir(), shelephant.ssh.tempdir("localhost") as remote, contextlib.redirect_stdout(
io.StringIO()
) as sio:
with (
tempdir(),
shelephant.ssh.tempdir("localhost") as remote,
contextlib.redirect_stdout(io.StringIO()) as sio,
):
files = ["foo.txt", "bar.txt", "more.txt", "even_more.txt"]
check = create_dummy_files(files)
shelephant_dump(files)
Expand Down Expand Up @@ -441,9 +445,11 @@ def test_ssh_get(self):
if not has_ssh:
raise unittest.SkipTest("'ssh localhost' does not work")

with tempdir(), shelephant.ssh.tempdir("localhost") as remote, contextlib.redirect_stdout(
io.StringIO()
) as sio:
with (
tempdir(),
shelephant.ssh.tempdir("localhost") as remote,
contextlib.redirect_stdout(io.StringIO()) as sio,
):
with cwd(remote):
files = ["foo.txt", "bar.txt", "more.txt", "even_more.txt"]
check = create_dummy_files(files)
Expand Down Expand Up @@ -534,9 +540,11 @@ def test_ssh(self):
if not has_ssh:
raise unittest.SkipTest("'ssh localhost' does not work")

with tempdir(), shelephant.ssh.tempdir("localhost") as remote, contextlib.redirect_stdout(
io.StringIO()
) as sio:
with (
tempdir(),
shelephant.ssh.tempdir("localhost") as remote,
contextlib.redirect_stdout(io.StringIO()) as sio,
):
with cwd(remote):
files = ["foo.txt", "bar.txt", "more.txt", "even_more.txt"]
create_dummy_files(files)
Expand Down

0 comments on commit 9c7c43e

Please sign in to comment.