Skip to content

Commit

Permalink
Updated to support python 3.8+
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Apr 24, 2023
1 parent 275b3b1 commit 5782832
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 115 deletions.
22 changes: 22 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[bumpversion]
current_version = 0.10.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.?)(?P<release>[a-z]*)(?P<relver>\d*)
serialize =
{major}.{minor}.{patch}.{release}{relver}
{major}.{minor}.{patch}
commit = True
tag = True
sign_tags = True
tag_name = {new_version}
message = Release {new_version}

[bumpversion:part:release]
optional_value = gamma
values =
dev
a
b
rc
gamma

[bumpversion:file:giturlparse/__init__.py]
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ jobs:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
python-version: [3.8]
toxenv: [pep8, isort, black, pypi-description, towncrier]
python-version: ["3.11.x"]
toxenv: [ruff, isort, black, pypi-description, docs, towncrier]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.toxenv }}
- name: Cache tox
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-lint-${{ matrix.toxenv }}-${{ hashFiles('setup.cfg') }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.toxenv }}
- name: Cache tox
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-tox-release-${{ hashFiles('setup.cfg') }}
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.7, 3.6]
python-version: ["3.11", "3.10", "3.9"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.toxenv }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.toxenv }}
- name: Cache tox
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: .tox
key: ${{ runner.os }}-tox-${{ format('{{py{0}}}', matrix.python-version) }}-${{ hashFiles('setup.cfg') }}
Expand All @@ -49,8 +49,3 @@ jobs:
flags: unittests
file: ./coverage.xml
fail_ci_if_error: false
services:
redis:
image: redis
ports:
- 6379:6379
38 changes: 12 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
exclude: "(.idea|node_modules|.tox)"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude: "setup.cfg"
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
Expand All @@ -16,38 +17,20 @@ repos:
- id: fix-encoding-pragma
args:
- --remove
- repo: https://github.com/timothycrosley/isort
rev: "5.9.3"
- repo: https://github.com/PyCQA/isort
rev: "5.12.0"
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 21.9b0
rev: 23.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.262'
hooks:
- id: flake8
additional_dependencies:
- flake8-broken-line
- flake8-bugbear
- flake8-builtins
- flake8-coding
- flake8-commas
- flake8-comprehensions
- flake8-eradicate
- flake8-quotes
- flake8-tidy-imports
- pep8-naming
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
args:
- "-cpyproject.toml"
- "--quiet"
- id: ruff
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v3.3.1
hooks:
- id: pyupgrade
args:
Expand All @@ -60,3 +43,6 @@ repos:
language: system
pass_filenames: false
always_run: true
ci:
skip:
- towncrier
1 change: 1 addition & 0 deletions changes/48.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for Python 3.8+
2 changes: 1 addition & 1 deletion giturlparse/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def parse(url, check_domain=True):
domain = match.group("domain")
# print('[%s] DOMAIN = %s' % (url, domain,))
if check_domain:
if platform.DOMAINS and not (domain in platform.DOMAINS):
if platform.DOMAINS and domain not in platform.DOMAINS:
continue
if platform.SKIP_DOMAINS and domain in platform.SKIP_DOMAINS:
continue
Expand Down
23 changes: 21 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[tool.black]
line-length = 119
target-version = ["py36"]
target-version = ["py310"]
include = 'giturlparse/*py'

[tool.towncrier]
Expand All @@ -22,9 +22,28 @@ ignore-private = false
ignore-module = true
ignore-nested-functions = true
fail-under = 0
exclude = [".tox"]
exclude = ["docs", ".tox"]
ignore-regex = ["^get$", "^mock_.*", ".*BaseClass.*"]
verbose = 0
quiet = false
whitelist-regex = []
color = true

[tool.isort]
profile = "black"
combine_as_imports = true
default_section = "THIRDPARTY"
force_grid_wrap = 0
include_trailing_comma = true
known_first_party = "giturlparse"
line_length = 119
multi_line_output = 3
use_parentheses = true

[tool.ruff]
ignore = []
line-length = 119
target-version = "py310"

[tool.ruff.mccabe]
max-complexity = 10
1 change: 0 additions & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
coverage
coveralls
mock>=1.0.1
flake8
tox
31 changes: 5 additions & 26 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
[bumpversion]
current_version = 0.10.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.?)(?P<release>[a-z]*)(?P<relver>\d*)
serialize =
{major}.{minor}.{patch}.{release}{relver}
{major}.{minor}.{patch}
commit = True
tag = True
sign_tags = True
tag_name = {new_version}
message = Release {new_version}

[bumpversion:part:release]
optional_value = gamma
values =
dev
a
b
rc
gamma

[bumpversion:file:giturlparse/__init__.py]

[metadata]
name = giturlparse
version = attr: giturlparse.__version__
Expand All @@ -41,15 +18,17 @@ classifiers =
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Natural Language :: English
Programming Language :: Python :: 3.6
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

[options]
include_package_data = True
setup_requires =
setuptools
packages = giturlparse, giturlparse.platforms
python_requires = >=3.6
python_requires = >=3.8
zip_safe = False
test_suite = giturlparse.tests

Expand Down
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def clean(c):
@task
def lint(c):
"""Run linting tox environments."""
c.run("tox -epep8,isort,black,pypi-description")
c.run("tox -eruff,isort,black,pypi-description")


@task # NOQA
Expand Down
44 changes: 6 additions & 38 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ envlist =
blacken
isort
isort_format
pep8
ruff
pypi-description
towncrier
py{38,37,36}
py{311,310,39,38}
skip_missing_interpreters = true

[testenv]
Expand All @@ -18,23 +18,13 @@ passenv =
COMMAND
PYTEST_*

[testenv:pep8]
[testenv:ruff]
commands =
{envpython} -m flake8
{envpython} -minterrogate -c pyproject.toml giturlparse
{envpython} -m ruff check app_enabler tests {posargs}
{envpython} -minterrogate -c pyproject.toml app_enabler tests
deps =
interrogate
flake8>3.9,<4
flake8-broken-line
flake8-bugbear
flake8-builtins
flake8-coding
flake8-commas
flake8-comprehensions
flake8-eradicate
flake8-quotes
flake8-tidy-imports
pep8-naming
ruff
skip_install = true

[testenv:isort]
Expand Down Expand Up @@ -92,28 +82,6 @@ passenv =
TWINE_*
skip_install = true

[flake8]
exclude = *.egg-info,.git,.settings,.tox,build,dist,docs,requirements,tmp,*migrations*,tests,data
ignore = E800, W503, C812, C813, C815, C818, C819, C408
max-line-length = 119
# flake8-quotes
inline-quotes = double
# flake8-coding
no-accept-encodings = True
# flake8-tidy-imports
banned-modules = __future__ = this project supports python3 only

[isort]
combine_as_imports = true
default_section = THIRDPARTY
force_grid_wrap = 0
include_trailing_comma = true
known_first_party = giturlparse
line_length = 119
multi_line_output = 3
skip = data, .tox
use_parentheses = True

[check-manifest]
ignore =
.*
Expand Down

0 comments on commit 5782832

Please sign in to comment.