| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8daa571 commit 6208a54
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ root = true | |||
| 4 | 4 | [*] | |
| 5 | 5 | end_of_line = lf | |
| 6 | 6 | charset = utf-8 | |
| 7 | + max_line_length = 99 | ||
| 7 | 8 | ||
| 8 | 9 | [*.py] | |
| 9 | 10 | indent_style = space | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -71,30 +71,34 @@ jobs: | |||
| 71 | 71 | check: | |
| 72 | 72 | runs-on: ubuntu-latest | |
| 73 | 73 | needs: check-files | |
| 74 | - # Timout of 15min | ||
| 75 | 74 | timeout-minutes: 15 | |
| 76 | 75 | # needs.check-files.outputs.can_run | |
| 77 | 76 | if: ${{ needs.check-files.outputs.can_run == '1' }} | |
| 78 | 77 | ||
| 79 | 78 | steps: | |
| 80 | 79 | - uses: actions/checkout@v4 | |
| 81 | - - name: Set up Python ${{ matrix.python-version }} | ||
| 82 | - uses: actions/setup-python@v5 | ||
| 80 | + | ||
| 81 | + - name: Install uv | ||
| 82 | + uses: astral-sh/setup-uv@v3 | ||
| 83 | 83 | with: | |
| 84 | - python-version: 3.8 | ||
| 85 | - cache: 'pip' | ||
| 86 | - - name: Install dependencies | ||
| 87 | - run: | | ||
| 88 | - python3 -m pip install --upgrade pip setuptools>60 setuptools-scm>=60 | ||
| 89 | - pip install tox tox-gh-actions | ||
| 90 | - - name: Check | ||
| 84 | + enable-cache: true | ||
| 85 | + | ||
| 86 | + - name: Set up Python 3.7 | ||
| 87 | + # check tox.ini for the lowest version | ||
| 88 | + run: uv python install 3.7 | ||
| 89 | + | ||
| 90 | + - name: Install the project | ||
| 91 | 91 | run: | | |
| 92 | - tox run -e checks | ||
| 92 | + uv sync --all-extras --group gh-action | ||
| 93 | + | ||
| 94 | + - name: Checks | ||
| 95 | + continue-on-error: true | ||
| 96 | + run: uv run tox run -e checks | ||
| 93 | 97 | ||
| 94 | 98 | tests: | |
| 95 | 99 | needs: check | |
| 96 | 100 | runs-on: ${{ matrix.os }} | |
| 97 | - continue-on-error: true | ||
| 101 | + # continue-on-error: true | ||
| 98 | 102 | strategy: | |
| 99 | 103 | max-parallel: 5 | |
| 100 | 104 | fail-fast: true | |
@@ -114,15 +118,17 @@ jobs: | |||
| 114 | 118 | ||
| 115 | 119 | steps: | |
| 116 | 120 | - uses: actions/checkout@v4 | |
| 117 | - - name: Set up Python ${{ matrix.python-version }} for ${{ matrix.os }} | ||
| 118 | - uses: actions/setup-python@v5 | ||
| 119 | - with: | ||
| 120 | - python-version: ${{ matrix.python-version }} | ||
| 121 | - cache: 'pip' | ||
| 122 | - - name: Install dependencies | ||
| 123 | - run: | | ||
| 124 | - python3 -m pip install --upgrade pip | ||
| 125 | - pip install tox tox-gh-actions | ||
| 126 | - - name: Test with tox | ||
| 121 | + | ||
| 122 | + - name: Install uv | ||
| 123 | + uses: astral-sh/setup-uv@v3 | ||
| 124 | + | ||
| 125 | + - name: Set up Python ${{ matrix.python-version }} | ||
| 126 | + run: uv python install ${{ matrix.python-version }} | ||
| 127 | + | ||
| 128 | + - name: Install the project | ||
| 127 | 129 | run: | | |
| 128 | - tox run | ||
| 130 | + uv sync --all-extras --dev | ||
| 131 | + uv pip install tox tox-gh-actions | ||
| 132 | + | ||
| 133 | + - name: Checks | ||
| 134 | + run: uv run tox run -e ${{ matrix.python-version }} | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + [pytest] | ||
| 2 | + norecursedirs = .git build .env/ env/ .pyenv/ .tmp/ .eggs/ venv/ | ||
| 3 | + testpaths = tests docs | ||
| 4 | + pythonpath = src tests | ||
| 5 | + filterwarnings = | ||
| 6 | + ignore:Function 'semver.*:DeprecationWarning | ||
| 7 | + # ' <- This apostroph is just to fix syntax highlighting | ||
| 8 | + addopts = | ||
| 9 | + --import-mode=importlib | ||
| 10 | + --no-cov-on-fail | ||
| 11 | + --cov=semver | ||
| 12 | + --cov-report=term-missing | ||
| 13 | + --doctest-glob='*.rst' | ||
| 14 | + --doctest-modules | ||
| 15 | + --doctest-report ndiff | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,53 @@ | |||
| 1 | + # | ||
| 2 | + # Configuration file for ruff | ||
| 3 | + # See https://docs.astral.sh/ruff/configuration/ | ||
| 4 | + | ||
| 5 | + line-length = 88 | ||
| 6 | + indent-width = 4 | ||
| 7 | + include = [ | ||
| 8 | + "pyproject.toml", | ||
| 9 | + "src/**/*.py", | ||
| 10 | + "tests/**/*.py", | ||
| 11 | + "docs/**/*.py", | ||
| 12 | + ] | ||
| 13 | + | ||
| 14 | + [lint] | ||
| 15 | + extend-ignore = [ | ||
| 16 | + "RUF005", | ||
| 17 | + "RUF012", | ||
| 18 | + # Comment contains ambiguous `’` (RIGHT SINGLE QUOTATION MARK): | ||
| 19 | + "RUF003", | ||
| 20 | + "ISC001", | ||
| 21 | + ] | ||
| 22 | + select = [ | ||
| 23 | + "F", # pyflakes | ||
| 24 | + "E", # pycodestyle | ||
| 25 | + "I", # isort | ||
| 26 | + "N", # pep8-naming | ||
| 27 | + "UP", # pyupgrade | ||
| 28 | + "RUF", # ruff | ||
| 29 | + "B", # flake8-bugbear | ||
| 30 | + "C4", # flake8-comprehensions | ||
| 31 | + "ISC", # flake8-implicit-str-concat | ||
| 32 | + "PTH", # flake8-use-pathlib | ||
| 33 | + "SIM", # flake8-simplify | ||
| 34 | + "TID", # flake8-tidy-imports | ||
| 35 | + ] | ||
| 36 | + # TODO: Remove ISC001 ignore when formatter updated: https://github.com/astral-sh/ruff/issues/8272 | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + [format] | ||
| 40 | + # Exclude type hint stub files from formatting. | ||
| 41 | + exclude = ["*.pyi"] | ||
| 42 | + | ||
| 43 | + # Like Black, use double quotes for strings. | ||
| 44 | + quote-style = "double" | ||
| 45 | + | ||
| 46 | + # Like Black, indent with spaces, rather than tabs. | ||
| 47 | + indent-style = "space" | ||
| 48 | + | ||
| 49 | + # Like Black, respect magic trailing commas. | ||
| 50 | + skip-magic-trailing-comma = false | ||
| 51 | + | ||
| 52 | + docstring-code-format = true | ||
| 53 | + docstring-code-line-length = "dynamic" | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + Modernize project configs with :file:`pyproject.toml` | ||
| 2 | + | ||
| 3 | + * In :file:`pyproject.toml`: | ||
| 4 | + * Move all project related data from :file:`setup.cfg` to :file:`pyproject.toml` | ||
| 5 | + * Use new dependency group from :pep:`735` | ||
| 6 | + * Consolidate flake8, isort, pycodestyle with ruff | ||
| 7 | + * Split towncrier config type "trivial" into "trivial" and | ||
| 8 | + "internal" | ||
| 9 | + * Create config file for ruff (:file:`.ruff.toml`) | ||
| 10 | + * Create config file for pytest (:file:`.pytest.ini`) | ||
| 11 | + * Simplify :file:`tox.ini` and remove old stuff | ||
| 12 | + * Document installation with new :command:`uv` command | ||
| 13 | + * Simplify Sphinx config with :func:`find_version()` | ||
| 14 | + * Update the authors | ||
| 15 | + * Use :command:`uv` in GitHub Action :file:`python-testing.yml` workflow | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,12 @@ SPHINXPROJ = semver | |||
| 8 | 8 | SOURCEDIR = . | |
| 9 | 9 | BUILDDIR = _build | |
| 10 | 10 | ||
| 11 | + # Set the source directory for your project | ||
| 12 | + SRC_DIR = ../src | ||
| 13 | + | ||
| 14 | + # Set the PYTHONPATH environment variable | ||
| 15 | + export PYTHONPATH := $(SRC_DIR):$(PYTHONPATH) | ||
| 16 | + | ||
| 11 | 17 | # Put it first so that "make" without argument is like "make help". | |
| 12 | 18 | help: | |
| 13 | 19 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,4 @@ | |||
| 1 | 1 | #!/usr/bin/env python3 | |
| 2 | - # -*- coding: utf-8 -*- | ||
| 3 | 2 | # | |
| 4 | 3 | # python-semver documentation build configuration file | |
| 5 | 4 | # | |
@@ -16,37 +15,31 @@ | |||
| 16 | 15 | # add these directories to sys.path here. If the directory is relative to the | |
| 17 | 16 | # documentation root, use os.path.abspath to make it absolute, like shown here. | |
| 18 | 17 | # | |
| 19 | - import codecs | ||
| 20 | - from datetime import date | ||
| 18 | + | ||
| 21 | 19 | import os | |
| 22 | 20 | import re | |
| 23 | - import sys | ||
| 21 | + from datetime import date | ||
| 22 | + from pathlib import Path | ||
| 24 | 23 | ||
| 25 | - SRC_DIR = os.path.abspath("../src/") | ||
| 26 | - sys.path.insert(0, SRC_DIR) | ||
| 27 | - # from semver import __version__ # noqa: E402 | ||
| 24 | + SRC_DIR = Path(__file__).absolute().parent.parent / "src" | ||
| 28 | 25 | YEAR = date.today().year | |
| 29 | 26 | ||
| 30 | 27 | ||
| 31 | - def read(*parts): | ||
| 32 | - """ | ||
| 33 | - Build an absolute path from *parts* and and return the contents of the | ||
| 34 | - resulting file. Assume UTF-8 encoding. | ||
| 35 | - """ | ||
| 36 | - here = os.path.abspath(os.path.dirname(__file__)) | ||
| 37 | - with codecs.open(os.path.join(here, *parts), "rb", "utf-8") as f: | ||
| 38 | - return f.read() | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - def find_version(*file_paths): | ||
| 28 | + def find_version(path: Path) -> str: | ||
| 42 | 29 | """ | |
| 43 | 30 | Build a path from *file_paths* and search for a ``__version__`` | |
| 44 | 31 | string inside. | |
| 45 | 32 | """ | |
| 46 | - version_file = read(*file_paths) | ||
| 47 | - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) | ||
| 33 | + content = Path(path).read_text(encoding="utf-8") | ||
| 34 | + | ||
| 35 | + version_match = re.search( | ||
| 36 | + r"^__version__ = ['\"]([^'\"]*)['\"]", | ||
| 37 | + content, | ||
| 38 | + re.MULTILINE | ||
| 39 | + ) | ||
| 48 | 40 | if version_match: | |
| 49 | 41 | return version_match.group(1) | |
| 42 | + | ||
| 50 | 43 | raise RuntimeError("Unable to find version string.") | |
| 51 | 44 | ||
| 52 | 45 | ||
@@ -86,14 +79,14 @@ def find_version(*file_paths): | |||
| 86 | 79 | # General information about the project. | |
| 87 | 80 | project = "python-semver" | |
| 88 | 81 | copyright = f"{YEAR}, Kostiantyn Rybnikov and all" | |
| 89 | - author = "Kostiantyn Rybnikov and all" | ||
| 82 | + author = "Kostiantyn Rybnikov, Tom Schraitle, Sebastien Celles, and others" | ||
| 90 | 83 | ||
| 91 | 84 | # The version info for the project you're documenting, acts as replacement for | |
| 92 | 85 | # |version| and |release|, also used in various other places throughout the | |
| 93 | 86 | # built documents. | |
| 94 | 87 | # | |
| 95 | 88 | # The short X.Y version. | |
| 96 | - release = find_version("../src/semver/__about__.py") | ||
| 89 | + release = find_version(SRC_DIR / "semver/__about__.py") | ||
| 97 | 90 | # The full version, including alpha/beta/rc tags. | |
| 98 | 91 | version = release # .rsplit(u".", 1)[0] | |
| 99 | 92 | ||
@@ -174,7 +167,7 @@ def find_version(*file_paths): | |||
| 174 | 167 | "github_button": True, | |
| 175 | 168 | #: | |
| 176 | 169 | "github_type": "star", | |
| 177 | - #: whether to apply a ‘Fork me on Github’ banner | ||
| 170 | + #: whether to apply a "Fork me on Github" banner | ||
| 178 | 171 | #: in the top right corner of the page: | |
| 179 | 172 | # "github_banner": True, | |
| 180 | 173 | # | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,10 +25,11 @@ For users who have to stay with major 2 releases only, use the following line:: | |||
| 25 | 25 | semver>=2,<3 | |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | - Pip | ||
| 29 | - --- | ||
| 28 | + With Pip | ||
| 29 | + -------- | ||
| 30 | 30 | ||
| 31 | 31 | .. code-block:: bash | |
| 32 | + :name: install-pip | ||
| 32 | 33 | ||
| 33 | 34 | pip3 install semver | |
| 34 | 35 | ||
@@ -40,6 +41,19 @@ with an URL and its version: | |||
| 40 | 41 | pip3 install git+https://github.com/python-semver/python-semver.git@3.0.0 | |
| 41 | 42 | ||
| 42 | 43 | ||
| 44 | + With uv | ||
| 45 | + ------- | ||
| 46 | + | ||
| 47 | + First, install the :command:`uv` command. Refer to https://docs.astral.sh/uv/getting-started/installation/ for more information. | ||
| 48 | + | ||
| 49 | + Then use the command :command:`uv` to install the package: | ||
| 50 | + | ||
| 51 | + .. code-block:: bash | ||
| 52 | + :name: install-uv | ||
| 53 | + | ||
| 54 | + uv pip install semver | ||
| 55 | + | ||
| 56 | + | ||
| 43 | 57 | Linux Distributions | |
| 44 | 58 | ------------------- | |
| 45 | 59 | ||
@@ -101,7 +115,9 @@ openSUSE | |||
| 101 | 115 | ||
| 102 | 116 | 1. Enable the ``devel:languages:python`` repository of the Open Build Service:: | |
| 103 | 117 | ||
| 104 | - $ sudo zypper addrepo --refresh obs://devel:languages:python devel_languages_python | ||
| 118 | + $ sudo zypper addrepo --refresh \ | ||
| 119 | + --name devel_languages_python \ | ||
| 120 | + "https://download.opensuse.org/repositories/devel:/languages:/python/\$releasever" | ||
| 105 | 121 | ||
| 106 | 122 | 2. Install the package:: | |
| 107 | 123 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,4 +4,4 @@ Getting the Version of semver | |||
| 4 | 4 | To know the version of semver itself, use the following construct:: | |
| 5 | 5 | ||
| 6 | 6 | >>> semver.__version__ | |
| 7 | - '3.0.2' | ||
| 7 | + '3.0.3-alpha.1' | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments