diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4bedc56..e34dcfa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,18 +7,12 @@ on: jobs: main: - strategy: - matrix: - python-version: [3.x, pypy3.7, pypy3.8, pypy3.9] - os: [windows-latest, ubuntu-latest] - - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: install tox - run: python -m pip install --upgrade tox virtualenv setuptools pip - - name: run tox - run: tox -e py + uses: asottile/workflows/.github/workflows/tox.yml@v1.5.0 + with: + env: '["py38", "py39", "py310", "py311", "py312", "py313", "pypy3"]' + main-win: + uses: asottile/workflows/.github/workflows/tox.yml@v1.5.0 + with: + env: '["py38"]' + os: windows-latest + arch: '["x64", "x86"]' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f7579f6..0e3d8a0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,8 +9,12 @@ repos: - id: name-tests-test - id: requirements-txt-fixer - id: trailing-whitespace +- repo: https://github.com/hakancelikdev/unimport + rev: 1.0.0 + hooks: + - id: unimport - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.3.0 + rev: v2.4.0 hooks: - id: setup-cfg-fmt - repo: https://github.com/PyCQA/flake8 @@ -18,9 +22,9 @@ repos: hooks: - id: flake8 additional_dependencies: - - flake8-bugbear==23.6.5 + - flake8-bugbear==23.7.10 - flake8-builtins==2.1.0 - - flake8-comprehensions==3.13.0 + - flake8-comprehensions==3.14.0 - flake8-typing-imports==1.14.0 - repo: https://github.com/asottile/yesqa rev: v1.5.0 @@ -28,29 +32,29 @@ repos: - id: yesqa additional_dependencies: - flake8==6.0.0 - - flake8-bugbear==23.6.5 + - flake8-bugbear==23.7.10 - flake8-builtins==2.1.0 - - flake8-comprehensions==3.13.0 + - flake8-comprehensions==3.14.0 - flake8-typing-imports==1.14.0 - repo: https://github.com/asottile/reorder-python-imports rev: v3.10.0 hooks: - id: reorder-python-imports - args: [--py36-plus] + args: [--py38-plus, --add-import, 'from __future__ import annotations'] - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black - repo: https://github.com/adamchainz/blacken-docs - rev: 1.14.0 + rev: 1.15.0 hooks: - id: blacken-docs - additional_dependencies: [black==23.3.0] + additional_dependencies: [black==23.7.0] - repo: https://github.com/asottile/pyupgrade - rev: v3.7.0 + rev: v3.9.0 hooks: - id: pyupgrade - args: [--py36-plus] + args: [--py38-plus] - repo: https://github.com/mxr/unkey rev: v0.0.1 hooks: diff --git a/random_object_id.py b/random_object_id.py index 3e4e08e..84e4ce3 100644 --- a/random_object_id.py +++ b/random_object_id.py @@ -1,8 +1,9 @@ +from __future__ import annotations + import binascii import os import time from argparse import ArgumentParser -from typing import Optional from typing import Sequence @@ -12,7 +13,7 @@ def generate() -> str: return f"{timestamp:x}{rest}" -def main(argv: Optional[Sequence[str]] = None) -> int: +def main(argv: Sequence[str] | None = None) -> int: parser = ArgumentParser(description="Generate a random MongoDB ObjectId") parser.add_argument( "-l", diff --git a/setup.cfg b/setup.cfg index a086b4f..f381953 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ keywords = random test MongoDB mongo ObjectId [options] py_modules = random_object_id -python_requires = >=3.7 +python_requires = >=3.8 [options.entry_points] console_scripts = diff --git a/setup.py b/setup.py index 6068493..a03590f 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from setuptools import setup setup() diff --git a/tests/random_object_id/random_object_id_test.py b/tests/random_object_id/random_object_id_test.py index a4aaddd..54f5e41 100644 --- a/tests/random_object_id/random_object_id_test.py +++ b/tests/random_object_id/random_object_id_test.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import re import pytest diff --git a/tox.ini b/tox.ini index 337ad2e..194a891 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38,py39,pypy3,pre-commit +envlist = py38,py39,py310,py311,py312,py313,pypy3,pre-commit [testenv] deps = -rrequirements-dev.txt