Skip to content

Commit

Permalink
Merge branch 'master' into args-kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Feb 1, 2024
2 parents ea40339 + 6cfa2c7 commit 469cbd4
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 68 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[flake8]
max-line-length = 120
extend-ignore = E203,C901
exclude =
.git,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[test]"
python -m pip install -e . -r tests/requirements.txt
- name: Check Docs
run: |
python setup.py checkdocs
37 changes: 0 additions & 37 deletions .github/workflows/lint.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[test]"
python -m pip install -e . -r tests/requirements.txt
- name: Unit tests
env:
CACHIER_TEST_HOST: ${{ secrets.CACHIER_TEST_HOST }}
Expand Down
73 changes: 73 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
default_language_version:
python: python3

ci:
autofix_prs: true
autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions"
autoupdate_schedule: quarterly
# submodules: true

repos:
# todo: let's enable also al these but as separate PR
# - repo: https://github.com/pre-commit/pre-commit-hooks
# rev: v4.5.0
# hooks:
# - id: end-of-file-fixer
# - id: trailing-whitespace
# - id: check-json
# - id: check-yaml
# - id: check-toml
# - id: check-docstring-first
# - id: check-executables-have-shebangs
# - id: check-case-conflict
# - id: check-added-large-files
# - id: detect-private-key

# todo: another great hook
# - repo: https://github.com/crate-ci/typos
# rev: v1.16.26
# hooks:
# - id: typos
# # empty to do not write fixes
# args: []
# exclude: pyproject.toml

# - repo: https://github.com/PyCQA/docformatter
# rev: v1.7.5
# hooks:
# - id: docformatter
# additional_dependencies: [tomli]
# args: ["--in-place"]

# - repo: https://github.com/psf/black-pre-commit-mirror
# rev: 24.1.1
# hooks:
# - id: black
# name: Format code
# args:
# - "--skip-string-normalization"

# todo: unify formatting all GH actions files
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: v3.1.0
# hooks:
# - id: prettier
# # https://prettier.io/docs/en/options.html#print-width
# args: ["--print-width=120"]

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.8.0
# hooks:
# - id: mypy

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8

# todo: replacement for flake8
# - repo: https://github.com/astral-sh/ruff-pre-commit
# rev: v0.1.9
# hooks:
# - id: ruff
# args: ["--fix"]
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Install in development mode with test dependencies:
.. code-block:: bash
cd cachier
pip install -e ".[test]"
pip install -e . -r tests/requirements.txt
Running the tests
Expand Down
18 changes: 0 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,6 @@

import versioneer

TEST_REQUIRES = [
# tests and coverages
'pytest', 'coverage', 'pytest-cov', 'birch',
# linting and code quality
'bandit', 'flake8', 'pylint', 'safety',
# type checking
'mypy', 'types-setuptools', 'pandas-stubs',
# to connect to the test mongodb server
'pymongo', 'dnspython', 'pymongo-inmemory',
# to test pandas dataframe as-param hashing with mongodb core
'pandas',
# to be able to run `python setup.py checkdocs`
'collective.checkdocs', 'pygments',
]

README_RST = ''
with open('README.rst') as f:
README_RST = f.read()
Expand All @@ -54,9 +39,6 @@
'watchdog', 'portalocker',
'setuptools>=67.6.0', # to avoid vulnerability in 56.0.0
],
extras_require={
'test': TEST_REQUIRES,
},
platforms=['linux', 'osx', 'windows'],
keywords=['cache', 'persistence', 'mongo', 'memoization', 'decorator'],
classifiers=[
Expand Down
15 changes: 15 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# todo: add some version range or pinning latest versions
# tests and coverages
pytest
coverage
pytest-cov
birch
# to connect to the test mongodb server
pymongo
dnspython
pymongo-inmemory
# to test pandas dataframe as-param hashing with mongodb core
pandas
# to be able to run `python setup.py checkdocs`
collective.checkdocs
pygments
9 changes: 1 addition & 8 deletions tests/test_quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
import subprocess


def test_flake8():
"""Flake8 linter passes with no warnings or errors."""
command = ['flake8']
parameters = ['--max-line-length=120', 'cachier', 'tests']
subprocess.check_call(command + parameters)


@pytest.mark.skip
@pytest.mark.skip # todo: dead check, so let's replace it with Ruff
def test_pylint():
"""Pylint linter passes with no warnings or errors."""
command = ['pylint']
Expand Down
4 changes: 2 additions & 2 deletions tests/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import subprocess


@pytest.mark.skip
@pytest.mark.skip # todo: dead check, so let's replace it with Ruff
def test_bandit():
"""Bandit security scan passes with no warnings or errors."""
command = ['bandit']
Expand All @@ -12,7 +12,7 @@ def test_bandit():
subprocess.check_call(command + parameters)


@pytest.mark.skip
@pytest.mark.skip # todo: dead check, so let's enable it in separate PR within pre-commit
def test_safety():
"""Safety security scan passes with no warnings or errors."""
command = ['safety']
Expand Down

0 comments on commit 469cbd4

Please sign in to comment.