Skip to content

Commit

Permalink
Merge pull request #85 from LuqueDaniel/drop-python-37
Browse files Browse the repository at this point in the history
Drops Python 3.7 support
  • Loading branch information
LuqueDaniel committed Dec 28, 2023
2 parents 41fc6d2 + 2feef41 commit 0fdf97c
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup_python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
python_version:
description: "Version of Python to use"
required: false
default: "3.7"
default: "3.8"
python_packages:
description: "Python packages to install"
required: false
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,27 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup_python
- name: 🔍 Lint
run: |
ruff check --output-format github .
mypy .
- name: Lint (ruff)
run: ruff check --output-format github .
- name: Lint (mypy)
run: mypy .
format:
name: 🎨 Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: ./.github/actions/setup_python
- name: 🎨 Format
run: |
python -m black --check --diff .
python -m isort --check --diff .
- name: Format (black)
run: python -m black --check --diff .
- name: Format (isort)
run: python -m isort --check --diff .
test:
name: 🧪 Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Setup Python
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
Expand All @@ -34,7 +34,7 @@ repos:
- id: mypy
args: [--strict]
additional_dependencies: [
"Click >=8.0.4,<9.0.0",
"types-PyYAML >=6.0.0",
"pytest >=7.2.0,<8.0.0"
"Click ~=8.1.7",
"types-PyYAML ~=6.0.0",
"pytest ~=7.4.3"
]
2 changes: 1 addition & 1 deletion lnmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def echo(

def yaml_read(yaml_file: Path) -> DirectoriesDict:
"""Read the YAML file and return a dictionary."""
with open(yaml_file, "r", encoding="utf-8") as stream:
with yaml_file.open(encoding="utf-8") as stream:
result = yaml.safe_load(stream.read())
if not isinstance(result, dict):
raise cli.UsageError(
Expand Down
41 changes: 27 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 68.0.0", "wheel"]
requires = ["setuptools >= 69.0.3", "wheel"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -18,18 +18,17 @@ classifiers = [
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: System :: Systems Administration",
"Topic :: Utilities",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"Click >=8.0.4,<9.0.0",
"PyYAML >=6.0.0,<7.0.0"
"Click ~=8.1.7",
"PyYAML ~=6.0.0"
]
dynamic = ["version"]

Expand All @@ -40,14 +39,14 @@ Documentation = "https://github.com/LuqueDaniel/lnmc/blob/master/README.md"

[project.optional-dependencies]
dev = [
"pre-commit ==2.21.0",
"black ==23.3.0",
"isort >=5.11.5,<5.12.0", # 5.12.0+ requires Python 3.8+
"pre-commit ==3.5.0",
"black ==23.12.1",
"isort ~=5.13.2",
"ruff >=0.1.9",
"mypy ~=1.4.1",
"mypy ~=1.8.0",
"pytest ~=7.4.3",
"pytest-cov ~=4.1.0",
"types-PyYAML >=6.0.0",
"types-PyYAML ~=6.0.0",
]

[project.scripts]
Expand All @@ -58,21 +57,35 @@ py-modules = ["lnmc"]
dynamic = {version = {attr = "lnmc.__version__"}}

[tool.black]
target-version = ["py37"]
target-version = ["py38"]

[tool.isort]
profile = "black"
known_third_party = ["click", "pytest", "setuptools", "yaml"]
known_third_party = ["click", "pytest", "yaml"]

[tool.pytest.ini_options]
addopts = "-vvs --cov=lnmc"

[tool.ruff]
target-version = "py37"
target-version = "py38"
src = ["."]
fix = false
line-length = 88 # its default
select = ["F", "E", "W", "C", "B", "N"]
select = [
"F", # Pyflakes
"E", # pycodestyle (E, W)
"W",
"B", # flake8-bugbear
"N", # pep8-naming
"UP", # pyupgrade
"S", # flake8-bandit
"C4", # flake8-comprehensions
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
]

[tool.ruff.extend-per-file-ignores]
"*_test.py" = ["S101"] # Bandit use of asset in test files

[tool.mypy]
strict = true
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
YAML_TEST_FILE = Path("tests/test.yaml")


@pytest.fixture(scope="function")
@pytest.fixture()
def filesystem_actions(tmp_path: Path) -> FileSystemActions:
"""Instantiate a lnmc.FileSystemActions object and return it.
Expand All @@ -28,7 +28,7 @@ def filesystem_actions(tmp_path: Path) -> FileSystemActions:
return FileSystemActions(tmp_path, DST, verbose=True)


@pytest.fixture(scope="function")
@pytest.fixture()
def create_test_tree(tmp_path: Path) -> Generator[None, None, None]:
"""Create a test directory tree based on the content of YAML_TEST_FILE."""
directories = yaml_read(YAML_TEST_FILE)
Expand All @@ -48,7 +48,7 @@ def create_test_tree(tmp_path: Path) -> Generator[None, None, None]:
shutil.rmtree(DST)


@pytest.fixture(scope="function")
@pytest.fixture()
def create_test_file(
tmp_path: Path, file_path: str = "dir/file.txt"
) -> Generator[PathPair, None, None]:
Expand Down

0 comments on commit 0fdf97c

Please sign in to comment.