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

Migrate from poetry to uv #13

Merged
merged 2 commits into from
Oct 28, 2024
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
36 changes: 18 additions & 18 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Format with Black
version: "0.4.27"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: install project
run: uv sync --all-extras --dev

- name: Format with Ruff
run: |
poetry run black --check versup
- name: Lint with flake8
uv run ruff format --check src

- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 versup --show-source --statistics --count
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
uv run ruff check src
- name: Type check with MyPy
run: |
# Some dependencies are missing the type definitions (semver, git)
poetry run mypy versup --ignore-missing-imports
uv run mypy src/versup --ignore-missing-imports
- name: Test with pytest
run: |
poetry run make test
uv run pytest src/tests
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run coveralls --service=github
uv run coveralls --service=github
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ test:
@ coverage html -d coverage_report
@ coverage xml -o coverage.xml
@ coverage report
@ flake8 versup
@ mypy versup --ignore-missing-imports
@ flake8 src/versup
@ mypy src/versup --ignore-missing-imports
16 changes: 8 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@
master_doc = "index"

# General information about the project.
project = u"Versup"
copyright = u"2020, Sven Steinbauer"
author = u"Sven Steinbauer"
project = "Versup"
copyright = "2020, Sven Steinbauer"
author = "Sven Steinbauer"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u"1.6.1"
version = "1.6.1"
# The full version, including alpha/beta/rc tags.
release = u"1.6.1"
release = "1.6.1"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -129,15 +129,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "Versup.tex", u"Versup Documentation", u"Sven Steinbauer", "manual"),
(master_doc, "Versup.tex", "Versup Documentation", "Sven Steinbauer", "manual"),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "versup", u"Versup Documentation", [author], 1)]
man_pages = [(master_doc, "versup", "Versup Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -149,7 +149,7 @@
(
master_doc,
"Versup",
u"Versup Documentation",
"Versup Documentation",
author,
"Versup",
"One line description of project.",
Expand Down
1,098 changes: 0 additions & 1,098 deletions poetry.lock

This file was deleted.

79 changes: 37 additions & 42 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
[tool.poetry]
[project]
name = "versup"
version = "1.6.1"
description = "Version up your project with ease."
authors = ["Sven Steinbauer <sven@unlogic.co.uk>"]
license = "MIT"
description = "Version up your porject with ease."
readme = "README.md"
repository = "https://github.com/Svenito/versup"

[tool.poetry.dependencies]
python = "^3.8"
gitpython = "^3.1"
click = "^8.0"
semver = "^2.13, <3"
setuptools = "^65.5.3"
rich = "^13.7.1"
flake8-pyproject = "^1.2.3"


[tool.poetry.dev-dependencies]
pytest-cov = "^4.0"
pytest = "^7.2"
sphinx = "^5.3.0"
sphinx_rtd_theme = "^0.4.3"
coveralls = "^3.3.1"
black = "^22.10.0"
coverage = "^6.5"
flake8 = "^5.0.4"
mypy = "^0.982"
types-click = "^7.1.8"
requires-python = ">=3.8"
authors=[{name="Sven Steinbauer", email="sven@unlogic.co.uk"}]
license={ file = "LICENSE.txt" }
dependencies = [
"click>=8.1.7",
"gitpython>=3.1.43",
"rich>=13.9.3",
"semver>=3.0.2",
]

[tool.poetry.scripts]
[project.scripts]
versup = "versup.__main__:main"

[tool.poetry.group.dev.dependencies]
isort = "^5.12.0"
[project.urls]
repository = "https://github.com/Svenito/versup"

[tool.flake8]
max-line-length = 88
extend-ignore = [
'E203', 'E231', 'W604'
]
per-file-ignores = [
'default_conf.py:E501',
[tool.uv]
dev-dependencies = [
"coverage>=7.6.1",
"coveralls>=4.0.1",
"flake8>=5.0.4",
"mypy>=1.13.0",
"pytest>=8.3.3",
"pytest-cov>=5.0.0",
"sphinx>=7.1.2",
"sphinx-rtd-theme>=3.0.1",
"types-click>=7.1.8",
"isort>=5.13.2",
"ruff>=0.7.1",
]
package = true

[tool.isort]
profile = "black"
[tool.ruff.lint]
select = ["E", "F"]
ignore = ["E501"]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false

[tool.isort]
profile = "black"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added src/tests/test_conf_empty.json
Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

import pytest

import versup.conf_reader as conf_reader
Expand All @@ -12,13 +10,13 @@

@pytest.fixture()
def config_file():
yield conf_reader.parse_config_file("./tests/test_conf.json")
yield conf_reader.parse_config_file("./src/tests/test_conf.json")


def test_parse_config_file():
conf = conf_reader.parse_config_file("./tests/test_conf.json")
conf = conf_reader.parse_config_file("./src/tests/test_conf.json")
assert conf["scripts"]["postbump"] == "echo POST"
conf = conf_reader.parse_config_file("./tests/testsss_conf.json")
conf = conf_reader.parse_config_file("./src/tests/testsss_conf.json")
assert conf == {}


Expand Down
3 changes: 0 additions & 3 deletions tests/test_file_updater.py → src/tests/test_file_updater.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import io
import sys

import versup.file_updater as file_updater


Expand Down
2 changes: 0 additions & 2 deletions tests/test_gitops.py → src/tests/test_gitops.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import configparser

import pytest

import versup.gitops as gitops
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@pytest.fixture()
def config_file():
yield conf_reader.parse_config_file("./tests/test_conf.json")
yield conf_reader.parse_config_file("./src/tests/test_conf.json")


@patch("subprocess.call")
Expand Down
2 changes: 0 additions & 2 deletions tests/test_template.py → src/tests/test_template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pytest

import versup.template as template


Expand Down
8 changes: 4 additions & 4 deletions tests/test_versioning.py → src/tests/test_versioning.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import pytest

from versup import __version__, versioning
from versup import versioning


def test_get_new_version_explicit():
assert "1.6.88" == versioning.get_new_version("1.2.3", "1.6.88", [], False)


def test_get_new_version_explicit_raise():
with pytest.raises(Exception) as e_info:
with pytest.raises(Exception):
versioning.get_new_version("1.4.2", "1.pies.88", [], False)


def test_get_new_version_increment_raise():
with pytest.raises(Exception) as e_info:
with pytest.raises(Exception):
versioning.get_new_version("1.4.2", "minor", ["major"], False)

assert "1.5.0" == versioning.get_new_version("1.4.2", "minor", ["minor"], False)
Expand Down Expand Up @@ -61,5 +61,5 @@ def test_release():
assert "1.0.1" == versioning.bump_version("1.0.1-rc.1", "release")
assert "2.0.1" == versioning.bump_version("2.0.1-rc.5", "release")

with pytest.raises(Exception) as e_info:
with pytest.raises(Exception):
versioning.bump_version("2.0.1", "release")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion versup/conf_reader.py → src/versup/conf_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse_config_file(config_file: str) -> dict:
return d


def merge(a: dict, b: dict, path: list = None):
def merge(a: dict, b: dict, path: list | None = None):
"""
Recursively merges two dictionaries b into a. Duplicate keys, b overrides a
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions versup/script_runner.py → src/versup/script_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def wrapper(config: Dict, version: str, **kwargs) -> Any:
pre_script = get_conf_value(config, f"scripts/pre{taskname}")
if pre_script:
if kwargs["dryrun"]:
print(f"Execute pre script `{pre_script}`\n")
print(f"Execute pre script '{pre_script}'\n")
else:
subprocess.call(pre_script.split() + [version])

Expand All @@ -36,7 +36,7 @@ def wrapper(config: Dict, version: str, **kwargs) -> Any:
post_script = get_conf_value(config, f"scripts/post{taskname}")
if post_script:
if kwargs["dryrun"]:
print(f"Execute post script `{post_script}`\n")
print(f"Execute post script '{post_script}'\n")
else:
subprocess.call(post_script.split())

Expand Down
File renamed without changes.
File renamed without changes.
Loading
Loading