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

feat: support Python 3.10+ only and update the lockfile #1

Merged
merged 2 commits into from
Jan 25, 2024
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: 0 additions & 2 deletions .flake8

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
cache: true
- name: Install Dependencies
run: |
pdm install -dGtest
pdm sync -dGtest
- name: Run Tests
run: |
pdm run pytest -v tests
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@ jobs:

- uses: actions/setup-python@v3
with:
python-version: 3.9
python-version: '3.11'

- uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Build artifacts
run: |
python -m pip install build
python -m build
run: pipx run build

- name: Upload to Pypi
run: |
Expand Down
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.9'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
152 changes: 53 additions & 99 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 23 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ authors = [
dependencies = [
"tomli>=2.0.1; python_version < \"3.11\"",
]
requires-python = ">=3.7"
requires-python = ">=3.10"
readme = "README.md"
license = {text = "MIT"}
dynamic = ["version"]
classifiers = [
"Topic :: Software Development :: Build Tools",
"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 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.urls]
Expand All @@ -31,8 +31,8 @@ pr = "onepm:pr"
pun = "onepm:pun"
pa = "onepm:pa"

[tool.pdm]
version = {source = "scm"}
[tool.pdm.version]
source = "scm"

[tool.pdm.dev-dependencies]
test = [
Expand All @@ -42,3 +42,19 @@ test = [
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

[tool.ruff]
target-version = "py310"

[tool.ruff.lint]
extend-select = [
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"RUF", # ruff
"W", # pycodestyle
"YTT", # flake8-2020
]

[tool.ruff.isort]
known-first-party = ["onepm"]
13 changes: 8 additions & 5 deletions src/onepm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import annotations

import os
import sys
from typing import Callable, Dict, List, NoReturn, Optional, Type
from typing import Callable, NoReturn

from onepm.base import PackageManager
from onepm.pdm import PDM
Expand All @@ -14,8 +16,9 @@
import tomli as tomllib


PACKAGE_MANAGERS: Dict[str, Type[PackageManager]] = {
p.name: p for p in [Pip, Pipenv, Poetry, PDM]
PACKAGE_MANAGERS: dict[str, type[PackageManager]] = {
p.name: p # type: ignore[type-abstract]
for p in [Pip, Pipenv, Poetry, PDM]
}


Expand All @@ -40,8 +43,8 @@ def determine_package_manager() -> str:
return "pip"


def make_shortcut(method_name: str) -> Callable[[Optional[List[str]]], NoReturn]:
def main(args: Optional[List[str]] = None) -> NoReturn:
def make_shortcut(method_name: str) -> Callable[[list[str] | None], NoReturn]:
def main(args: list[str] | None = None) -> NoReturn: # type: ignore[misc]
if args is None:
args = sys.argv[1:]
package_manager = PACKAGE_MANAGERS[determine_package_manager()]()
Expand Down
Loading
Loading