Skip to content

Commit

Permalink
Merge pull request #21 from fluent-qa/feat/uv-project
Browse files Browse the repository at this point in the history
update project to uv project
  • Loading branch information
qdriven authored Dec 15, 2024
2 parents f5a5e77 + fe7e018 commit e852618
Show file tree
Hide file tree
Showing 19 changed files with 914 additions and 264 deletions.
92 changes: 18 additions & 74 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,24 @@
name: test
name: Python UV Project CI

on: [push,pull_request]

jobs:
linting:
build:
runs-on: ubuntu-latest

steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
#----------------------------------------------
# load pip cache if cache exists
#----------------------------------------------
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
#----------------------------------------------
# install and run linters
#----------------------------------------------

test:
needs: linting
strategy:
fail-fast: true
matrix:
os: [ "ubuntu-latest", "macos-latest" ]
python-version: [ "3.10", "3.11" ]
runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
#----------------------------------------------
# add matrix specifics and run test suite
- name: formatting
run: make formatting
- name: Run tests
run: |
make test
make cleanup
- name: checkout repo
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true # Enable caching for faster builds
version: "latest" # Specify the version of uv to install
# You are now able to use PDM in your workflow
- name: Install dependencies
run: uv sync
- name: run tests and coverage report
run: |
uv run cov
uv run check_format
uv run badge
16 changes: 0 additions & 16 deletions .github/workflows/greetings.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/release-drafter.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -620,3 +620,6 @@ htmlcov/
.venv/
.coverage
poetry.lock
allure-results/
.ruff_cache/
dist/
23 changes: 23 additions & 0 deletions ci.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import subprocess



def coverage():
from qpyci.commands import run_tests
run_tests('qpybase')


def check_format():
subprocess.run(['uvx', 'ruff', 'check', '--fix'], check=True)
subprocess.run(['uvx', 'ruff', 'format'], check=True)


# if __name__ == "__main__":
# import sys
# if len(sys.argv) > 1:
# if sys.argv[1] == 'check':
# check_format()
# elif sys.argv[1] == 'cov':
# coverage()
# else:
# check_format()
13 changes: 0 additions & 13 deletions cookiecutter-config-file.yml

This file was deleted.

138 changes: 138 additions & 0 deletions pyproject copy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Poetry pyproject.toml: https://python-poetry.org/docs/pyproject/
[build-system]
requires = ["poetry_core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "qpybase"
version = "0.1.0"
description = "`qpybase` is a Python libs "
readme = "README.md"
authors = ["fluentqa-base <[email protected]>"]
repository = "https://github.com/fluent-qa/fluentqa-pybase.git"
homepage = "https://github.com/fluent-qa/fluentqa-pybase.git"
keywords = ["python-libs"] #! Update me
classifiers = [ #! Update me
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python :: 3",
]
packages = [
{ include = "qpybase", from="src"}
]

[tool.poetry.dependencies]
python=">=3.9,<3.12"
loguru = "^0.7.0"
rich = "^13.3.4"
structlog = "^24.1.0"
inflection = "^0.5.1"
dynaconf = "^3.1.12"
Faker = "^30.1.0"
boltons = "^24.0.0"
pydantic = "^2.7.4"


[tool.poetry.dev-dependencies]
pytest = "^8.0.0"
pre-commit = "^3.2.2"
isort = {extras = ["colors"], version = "^5.11.4"}
darglint = "^1.8.1"
pytest-html = "^4.0.0"
coverage = "^7.0.5"
coverage-badge = "^1.1.0"
black = "^24.1.0"
pytest-cov = "^5.0.0"

[tool.black]
# https://github.com/psf/black
target-version = ["py310"]
line-length = 88
color = true
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
| env
| venv
)/
'''

[tool.isort]
# https://github.com/timothycrosley/isort/
py_version = 310
line_length = 88
known_typing = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]
sections = ["FUTURE", "TYPING", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
include_trailing_comma = true
profile = "black"
multi_line_output = 3
indent = 4
color_output = true
force_single_line = true
combine_as_imports = true
lines_between_types = 1
lines_after_imports = 2
src_paths = ["src", "tests"]
extend_skip = ["setup.py"]

[tool.mypy]
python_version = 3.10
pretty = true
show_traceback = true
color_output = true
allow_redefinition = false
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
ignore_missing_imports = true
implicit_reexport = false
no_implicit_optional = true
show_column_numbers = true
show_error_codes = true
show_error_context = true
strict_equality = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true


[tool.pytest.ini_options]
# https://docs.pytest.org/en/6.2.x/customize.html#pyproject-toml
# Directories that are not visited by pytest collector:
norecursedirs =["hooks", "*.egg", ".eggs", "dist", "build", "docs", ".tox", ".git", "__pycache__"]
doctest_optionflags = ["NUMBER", "NORMALIZE_WHITESPACE", "IGNORE_EXCEPTION_DETAIL"]

# Extra options:
addopts = [
"--strict-markers",
"--tb=short",
"--doctest-modules",
"--doctest-continue-on-failure",
]

[tool.coverage.run]
source = ["tests"]

[coverage.paths]
source = "qpybase"

[coverage.run]
branch = true

[coverage.report]
fail_under = 50
show_missing = true
Loading

0 comments on commit e852618

Please sign in to comment.