Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cruft update #17

Merged
merged 2 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/iterative/cookiecutter-dvc-plugin",
"commit": "13d5c9b49c49d3c14106cb4f9aa61d07876c039b",
"commit": "fef394b15f2800a69b5ee11ddcc9e4c5339ae5f5",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
21 changes: 14 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
name: Release

on:
release:
types: [published]

permissions:
contents: read

jobs:
pip:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v3
- uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Build packages
- name: Install
run: |
pip install -U pip
pip install -U build setuptools>=58.2
python -m build --sdist --wheel --outdir dist/
pip install --upgrade pip wheel
pip install build twine
- name: Build
run: |
python -m build
twine check dist/*
- name: Publish packages to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
80 changes: 26 additions & 54 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,58 @@
name: Tests

on:
pull_request: {}
push: {}
push:
branches: [main]
pull_request:
schedule:
- cron: '5 1 * * *' # every day at 01:05

workflow_dispatch:

env:
DVC_TEST: "true"
HOMEBREW_NO_AUTO_UPDATE: 1
SHELL: /bin/bash
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
lint:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2.2.2
with:
python-version: 3.8
- name: Install requirements
run: |
pip install wheel
pip install -e '.[tests]'
pip install git+https://github.com/iterative/dvc pre-commit
- name: Check README
run: python setup.py checkdocs
- uses: pre-commit/action@v2.0.3
tests:
timeout-minutes: 45
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
pyv: ["3.8", "3.9", "3.10"]
pyv: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyv }}
- name: get pip cache dir
id: pip-cache-dir
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: set pip cache
id: pip-cache
uses: actions/cache@v2.1.6
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
cache: 'pip'
cache-dependency-path: setup.cfg

- name: install
if: steps.cache.pip-cache-dir.cache-hit != 'true'
run: |
pip install --upgrade pip setuptools wheel
pip install --upgrade pip wheel
pip install -e ".[tests]"
pip install "dvc[testing]@git+https://github.com/iterative/dvc"
- name: setup git
run: |
git config --global user.email "dvctester@example.com"
git config --global user.name "DVC Tester"
pip install "dvc[testing] @ git+https://github.com/iterative/dvc"

- name: lint
timeout-minutes: 10
uses: pre-commit/action@v3.0.0

- name: run tests
timeout-minutes: 40
timeout-minutes: 15
run: pytest -v -n=auto --cov-report=xml --cov-report=term

- name: upload coverage report
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: false
4 changes: 1 addition & 3 deletions .github/workflows/update-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ name: Update template
on:
schedule:
- cron: '5 1 * * *' # every day at 01:05

workflow_dispatch:

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install deps
run: pip install cruft
- name: Update template
Expand All @@ -25,4 +24,3 @@ jobs:
commit-message: update template
title: update template
token: ${{ secrets.WORKFLOW_TOKEN }}

12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ repos:
- id: black
language_version: python3
repo: https://github.com/ambv/black
rev: 22.3.0
rev: 22.12.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -18,12 +18,12 @@ repos:
- --ignore-words-list
- ba,datas,fo,uptodate
repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.2.2
- hooks:
- id: isort
language_version: python3
repo: https://github.com/timothycrosley/isort
rev: 5.9.3
rev: 5.11.4
- hooks:
- id: flake8
language_version: python3
Expand All @@ -32,8 +32,8 @@ repos:
- flake8-comprehensions
- flake8-debugger
- flake8-string-format
repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
repo: https://github.com/pycqa/flake8
rev: 6.0.0
- repo: local
hooks:
- id: mypy
Expand Down
9 changes: 5 additions & 4 deletions dvc_webdav/tests/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ def fs_path(self):
return self.path.lstrip("/")

def exists(self):
raise NotImplementedError
return self.client.exists(self.path)

def is_dir(self):
raise NotImplementedError
return self.client.isdir(self.path)

def is_file(self):
raise NotImplementedError
return self.client.isfile(self.path)

def read_bytes(self):
raise NotImplementedError
with self.client.open(self.path, mode="rb") as f:
return f.read()
4 changes: 2 additions & 2 deletions dvc_webdav/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from dvc.testing.fixtures import * # noqa, pylint: disable=wildcard-import,unused-import
from dvc.testing.fixtures import * # noqa, pylint: disable=unused-wildcard-import,wildcard-import

from .fixtures import * # noqa, pylint: disable=wildcard-import,unused-import
from .fixtures import * # noqa, pylint: disable=unused-wildcard-import,wildcard-import
2 changes: 2 additions & 0 deletions dvc_webdav/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from .cloud import AUTH, BASE_PATH, Webdav

# pylint: disable=redefined-outer-name


@pytest.fixture
def webdav_server(tmp_path_factory):
Expand Down
6 changes: 6 additions & 0 deletions dvc_webdav/tests/test_dvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
from dvc.testing.remote_tests import ( # noqa, pylint: disable=unused-import
TestRemote,
)
from dvc.testing.workspace_tests import ( # noqa, pylint: disable=unused-import
TestAdd,
TestGetUrl,
TestImport,
TestLsUrl,
)


@pytest.fixture
Expand Down
18 changes: 4 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,17 @@ warn_redundant_casts = true
warn_unreachable = true
files = ["dvc_webdav"]

[tool.pylint.master]
extension-pkg-whitelist = ["pygit2"]
init-hook = "import sys; sys.path.append(str('tests'))"
load-plugins = ["pylint_pytest"]

[tool.pylint.message_control]
disable = [
"format", "refactoring", "spelling", "design", "no-self-use",
"invalid-name", "misplaced-comparison-constant", "duplicate-code", "fixme",
"unused-wildcard-import", "cyclic-import", "wrong-import-order",
"wrong-import-position", "ungrouped-imports", "multiple-imports",
"logging-format-interpolation", "logging-fstring-interpolation",
"format", "refactoring", "spelling", "design", "invalid-name",
"cyclic-import", "wrong-import-order", "multiple-imports",
"wrong-import-position", "ungrouped-imports",
"missing-function-docstring", "missing-module-docstring",
"missing-class-docstring", "raise-missing-from", "import-outside-toplevel",
"missing-class-docstring", "import-outside-toplevel",
]
enable = ["c-extension-no-member", "no-else-return"]

[tool.pylint.typecheck]
generated-members = ["pytest.lazy_fixture", "logging.TRACE", "logger.trace", "sys.getwindowsversion", "argparse.Namespace"]
ignored-classes = ["Dvcfile"]
ignored-modules = ["azure"]
signature-mutators = ["funcy.decorators.decorator"]

[tool.pylint.variables]
Expand Down
39 changes: 11 additions & 28 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11

[options]
setup_requires =
Expand All @@ -32,50 +33,32 @@ install_requires =

[options.extras_require]
tests =
wheel==0.37.0
dvc[testing]
# Test requirements
pytest==6.2.5
pytest-cov==3.0.0
pytest-xdist==2.4.0
pytest-mock==3.6.1
pytest-lazy-fixture==0.6.3
pytest-docker==0.10.3
flaky==3.7.0
mock==4.0.3
rangehttpserver==1.2.0
wget==3.2
filelock==3.3.2
wsgidav==3.1.1
cheroot==8.6.0
crc32c==2.2.post0
xmltodict==0.12.0
# required by collective.checkdocs
Pygments==2.10.0
collective.checkdocs==0.2
pydocstyle==6.1.1
# pylint requirements
pylint==2.11.1
# we use this to suppress pytest-related false positives in our tests.
pylint-pytest==1.1.2
# we use this to suppress some messages in tests, eg: foo/bar naming,
# and, protected method calls in our tests
pylint-plugin-utils==0.6
pylint==2.15.9
# type-checking
mypy==0.910
types-requests==2.25.11
types-tabulate==0.8.3
types-toml==0.10.1
# optional dependencies
pywin32>=225; sys_platform == 'win32'
mypy==0.991

[flake8]
ignore=
E203, # Whitespace before ':'
E266, # Too many leading '#' for block comment
W503, # Line break occurred before a binary operator
P1, # unindexed parameters in the str.format, see:
# Whitespace before ':'
E203
# Too many leading '#' for block comment
E266
# Line break occurred before a binary operator
W503
# unindexed parameters in the str.format, see:
# https://pypi.org/project/flake8-string-format/
P1
max_line_length = 79
max-complexity = 15
select = B,C,E,F,W,T4,B902,T,P
Expand Down