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

Drop py37, support py313, update hooks, add linters, add import annotations #42

Merged
merged 2 commits into from
Jul 14, 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
24 changes: 9 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]'
26 changes: 15 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,52 @@ 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
rev: 6.0.0
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
hooks:
- 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:
Expand Down
5 changes: 3 additions & 2 deletions random_object_id.py
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from setuptools import setup

setup()
2 changes: 2 additions & 0 deletions tests/random_object_id/random_object_id_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import re

import pytest
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down