Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaybabloo authored Apr 21, 2023
2 parents 301a56b + 7e20f6e commit ba6e627
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 37 deletions.
5 changes: 5 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ categories:
exclude-labels:
- "changelog: skip"

autolabeler:
- label: "changelog: skip"
branch:
- "/pre-commit-ci-update-config/"

template: |
$CHANGES
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
python-version: "3.x"
- uses: pre-commit/[email protected]
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,27 @@ on:
# branches to consider in the event; optional, defaults to all
branches:
- main
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]
workflow_dispatch:

permissions:
contents: read

jobs:
update_release_draft:
if: github.repository_owner == 'python-humanize'
permissions:
# write permission is required to create a GitHub Release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: write
runs-on: ubuntu-latest
steps:
# Drafts your next release notes as pull requests are merged into "main"
Expand Down
18 changes: 10 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ repos:
args: [--py37-plus]

- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.3.0
hooks:
- id: black
args: [--target-version=py37]

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
rev: v2.0.2
hooks:
- id: autoflake
name: autoflake
Expand Down Expand Up @@ -45,11 +44,14 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-json
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: \.github/ISSUE_TEMPLATE\.md|\.github/PULL_REQUEST_TEMPLATE\.md

- repo: https://github.com/PyCQA/pydocstyle
rev: 6.3.0
Expand All @@ -59,24 +61,24 @@ repos:
files: "src/"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.1.1
hooks:
- id: mypy
additional_dependencies: [pytest, types-freezegun, types-setuptools]
args: [--strict]

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.5.0
rev: 0.9.2
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
rev: v0.12.2
hooks:
- id: validate-pyproject

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 0.6.1
rev: 1.0.0
hooks:
- id: tox-ini-fmt

Expand Down
26 changes: 12 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ license = {text = "MIT"}
maintainers = [{name = "Hugo van Kemenade"}]
authors = [{name = "Jason Moiron", email = "[email protected]"}]
requires-python = ">=3.7"
dependencies = [
'importlib-metadata; python_version < "3.8"',
]
dynamic = [
"version",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -40,13 +34,18 @@ classifiers = [
"Topic :: Text Processing",
"Topic :: Text Processing :: General",
]
dynamic = [
"version",
]
dependencies = [
'importlib-metadata; python_version < "3.8"',
]
[project.optional-dependencies]
tests = [
"freezegun",
"pytest",
"pytest-cov",
]

[project.urls]
Documentation = "https://python-humanize.readthedocs.io/"
Funding = "https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=pypi"
Expand All @@ -55,10 +54,6 @@ Homepage = "https://github.com/python-humanize/humanize"
"Release notes" = "https://github.com/python-humanize/humanize/releases"
Source = "https://github.com/python-humanize/humanize"


[tool.black]
target_version = ["py37"]

[tool.hatch]
version.source = "vcs"

Expand All @@ -70,11 +65,14 @@ artifacts = [
[tool.hatch.version.raw-options]
local_scheme = "no-local-version"

[tool.black]
target_version = ["py37"]

[tool.isort]
profile = "black"

[tool.pydocstyle]
convention = "google"

[tool.pytest.ini_options]
addopts = "--color=yes"

[tool.pydocstyle]
convention = "google"
12 changes: 2 additions & 10 deletions tests/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ def test_date_and_delta() -> None:
# Tests for the public interface of humanize.time


def nd_nomonths(d: dt.timedelta) -> str:
return humanize.naturaldelta(d, months=False)


@pytest.mark.parametrize(
"test_input, expected",
[
Expand All @@ -88,7 +84,7 @@ def nd_nomonths(d: dt.timedelta) -> str:
],
)
def test_naturaldelta_nomonths(test_input: dt.timedelta, expected: str) -> None:
assert nd_nomonths(test_input) == expected
assert humanize.naturaldelta(test_input, months=False) == expected


@pytest.mark.parametrize(
Expand Down Expand Up @@ -173,10 +169,6 @@ def test_naturaltime(test_input: dt.datetime, expected: str) -> None:
assert humanize.naturaltime(test_input) == expected


def nt_nomonths(d: dt.datetime) -> str:
return humanize.naturaltime(d, months=False)


@freeze_time("2020-02-02")
@pytest.mark.parametrize(
"test_input, expected",
Expand Down Expand Up @@ -215,7 +207,7 @@ def nt_nomonths(d: dt.datetime) -> str:
],
)
def test_naturaltime_nomonths(test_input: dt.datetime, expected: str) -> None:
assert nt_nomonths(test_input) == expected
assert humanize.naturaltime(test_input, months=False) == expected


@freeze_time("2020-02-02")
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ envlist =
py{py3, 312, 311, 310, 39, 38, 37}

[testenv]
passenv =
FORCE_COLOR
extras =
tests
passenv =
FORCE_COLOR
commands =
{envpython} -m pytest --cov humanize --cov tests --cov-report xml {posargs}

Expand All @@ -19,11 +19,11 @@ commands =
mkdocs build

[testenv:lint]
passenv =
PRE_COMMIT_COLOR
skip_install = true
deps =
pre-commit
passenv =
PRE_COMMIT_COLOR
commands =
pre-commit run --all-files --show-diff-on-failure

Expand Down

0 comments on commit ba6e627

Please sign in to comment.