diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..9e43414 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,22 @@ +[bumpversion] +current_version = 0.10.0 +parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.?)(?P[a-z]*)(?P\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] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c33cea1..18421c9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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') }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 07b9e64..4084eb7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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') }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9ec5ea..4f6152e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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') }} @@ -49,8 +49,3 @@ jobs: flags: unittests file: ./coverage.xml fail_ci_if_error: false - services: - redis: - image: redis - ports: - - 6379:6379 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d8e63c0..0a82056 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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: @@ -60,3 +43,6 @@ repos: language: system pass_filenames: false always_run: true +ci: + skip: + - towncrier diff --git a/changes/48.feature b/changes/48.feature new file mode 100644 index 0000000..b00f6e7 --- /dev/null +++ b/changes/48.feature @@ -0,0 +1 @@ +Add support for Python 3.8+ diff --git a/giturlparse/parser.py b/giturlparse/parser.py index c67f035..fa2404e 100644 --- a/giturlparse/parser.py +++ b/giturlparse/parser.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index f4a655a..62d8371 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] @@ -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 diff --git a/requirements-test.txt b/requirements-test.txt index 24d2013..df4a740 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,5 +2,4 @@ coverage coveralls mock>=1.0.1 -flake8 tox diff --git a/setup.cfg b/setup.cfg index dad514d..e05b5fe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,26 +1,3 @@ -[bumpversion] -current_version = 0.10.0 -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\.?)(?P[a-z]*)(?P\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__ @@ -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 diff --git a/tasks.py b/tasks.py index b88f171..2038af7 100644 --- a/tasks.py +++ b/tasks.py @@ -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 diff --git a/tox.ini b/tox.ini index 477456d..39a7d89 100644 --- a/tox.ini +++ b/tox.ini @@ -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] @@ -18,23 +18,13 @@ passenv = COMMAND PYTEST_* -[testenv:pep8] +[testenv:ruff] commands = - {envpython} -m flake8 + {envpython} -m ruff check giturlparse {posargs} {envpython} -minterrogate -c pyproject.toml giturlparse 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] @@ -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 = .*