Skip to content
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
26 changes: 0 additions & 26 deletions .flake8

This file was deleted.

71 changes: 29 additions & 42 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
paths-ignore:
- 'examples/**'
branches:
- master
- main
- develop
pull_request:
paths-ignore:
Expand All @@ -27,107 +27,94 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
env:
UV_PYTHON: ${{ matrix.python-version }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}

- name: Setup up workflow test directory
run: mkdir ./reports

- name: Upgrade Pip and install dev dependencies
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.10.12"

- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel poetry
poetry config virtualenvs.create false
poetry install --with tests,lint,type,format -v
uv sync --locked --all-groups --dev

- name: Run mypy
run: mypy mongo_queries_manager
run: uv run mypy mongo_queries_manager
if: ${{ always() }}

- name: Run pylint
run: pylint mongo_queries_manager
if: ${{ always() }}

- name: Run flake8
run: flake8 mongo_queries_manager --format=html --htmldir=./reports/flake8-${{ matrix.python }}
if: ${{ always() }}

- name: Tar flake8 artifact
run: tar -cvf flake8-${{ matrix.python }}.tar ./reports/flake8-${{ matrix.python }}

- name: Archive flake8 artifact
uses: actions/upload-artifact@v3
with:
name: flake8-${{ matrix.python }}
path: flake8-${{ matrix.python }}.tar

- name: Run black
run: black mongo_queries_manager --check
- name: Run ruff check
run: uv run ruff check mongo_queries_manager
if: ${{ always() }}

- name: Run Isort
run: isort mongo_queries_manager --check
- name: Run ruff format
run: uv run ruff format --check mongo_queries_manager
if: ${{ always() }}

- name: Run Pytest without extra
run: coverage run --data-file=./reports/.coverage.without.extra -m pytest --junitxml=./reports/junit-results-without-extra-${{ matrix.python }}.xml --junit-prefix=without-extra-${{ matrix.python }} -vv
run: uv run coverage run --data-file=./reports/.coverage.without.extra -m pytest --junitxml=./reports/junit-results-without-extra-${{ matrix.python }}.xml --junit-prefix=without-extra-${{ matrix.python }} -vv
if: ${{ always() }}

- name: Archive Pytest artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v6
with:
name: junit-results-without-extra-${{ matrix.python }}
path: ./reports/junit-results-without-extra-${{ matrix.python }}.xml

- name: Install dateparser dependencies
run: |
poetry install -E dateparser -v
uv sync --locked --all-extras --all-groups --dev

- name: Run Pytest with extra
run: coverage run --data-file=./reports/.coverage.with.extra -m pytest --junitxml=./reports/junit-results-with-extra-${{ matrix.python }}.xml --junit-prefix=with-extra-${{ matrix.python }} -vv
run: uv run coverage run --data-file=./reports/.coverage.with.extra -m pytest --junitxml=./reports/junit-results-with-extra-${{ matrix.python }}.xml --junit-prefix=with-extra-${{ matrix.python }} -vv
if: ${{ always() }}

- name: Archive Pytest artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v6
with:
name: junit-results-with-extra-${{ matrix.python }}
path: ./reports/junit-results-with-extra-${{ matrix.python }}.xml

- name: Combine coverage
run: coverage combine --append --data-file=./reports/.coverage.full ./reports/.coverage.without.extra ./reports/.coverage.with.extra
run: uv run coverage combine --append --data-file=./reports/.coverage.full ./reports/.coverage.without.extra ./reports/.coverage.with.extra

- name: Generate coverage HTML
run: coverage html --data-file=./reports/.coverage.full --directory=./reports/${{ matrix.python }}-coverage-full-html
run: uv run coverage html --data-file=./reports/.coverage.full --directory=./reports/${{ matrix.python }}-coverage-full-html

- name: Tar files
run: tar -cvf ${{ matrix.python }}-coverage-full-html.tar ./reports/${{ matrix.python }}-coverage-full-html

- name: Archive code coverage HTML results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.python }}-coverage-full-html
path: ${{ matrix.python }}-coverage-full-html.tar

- name: Generate coverage XML
run: coverage xml --data-file=./reports/.coverage.full -o ./reports/coverage-${{ matrix.python }}-full.xml
run: uv run coverage xml --data-file=./reports/.coverage.full -o ./reports/coverage-${{ matrix.python }}-full.xml

- name: Archive code coverage XML results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v6
with:
name: coverage-${{ matrix.python }}-full
path: ./reports/coverage-${{ matrix.python }}-full.xml

- name: Send code coverage to codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
directory: ./reports
files: coverage-${{ matrix.python }}-full.xml
Expand Down
73 changes: 37 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@ on:
jobs:
publish_on_testpypi:
name: Build and publish to TestPyPI 🐍📦
environment: release
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
contents: read
if: ${{ inputs.publish_on_testpypi }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v6

- name: Set up Python 3.10
uses: actions/setup-python@v3
- name: "Set up default Python"
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version-file: "pyproject.toml"

- name: Upgrade Pip and install poetry
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel poetry

- name: Configure Poetry
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.10.12"

- name: Build Python package with Poetry
run: poetry build
- name: Build Python package with uv
run: uv build

- name: Tar test build result
run: tar -cvf mongo-queries-manager-test-packages-${{ github.ref_name }}.tar ./dist
Expand All @@ -48,42 +48,43 @@ jobs:
name: mongo-queries-manager-test-packages-${{ github.ref_name }}
path: mongo-queries-manager-test-packages-${{ github.ref_name }}.tar

- name: Publish Python package with Poetry on TestPyPi
run: poetry publish -r test-pypi
- name: Publish Python package with uv on PyPi
run: uv publish

publish_on_pypi:
name: Build and publish to PyPI 🐍📦
environment: release
runs-on: ubuntu-latest
environment:
name: release
permissions:
id-token: write
contents: read
if: ${{ inputs.publish_on_pypi }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v6

- name: Set up Python 3.10
uses: actions/setup-python@v3
- name: "Set up default Python"
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Upgrade Pip and install poetry
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel poetry
python-version-file: "pyproject.toml"

- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.10.12"

- name: Build Python package with Poetry
run: poetry build
- name: Build Python package with uv
run: uv build

- name: Tar build result
run: tar -cvf mongo-queries-manager-packages-${{ github.ref_name }}.tar ./dist

- name: Archive packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v6
with:
name: mongo-queries-manager-packages-${{ github.ref_name }}
path: mongo-queries-manager-packages-${{ github.ref_name }}.tar

- name: Publish Python package with Poetry on PyPi
run: poetry publish
- name: Publish Python package with uv on PyPi
run: uv publish
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,3 @@ dmypy.json

# Reports generated by tox
reports

# Lock fil generated by poetry
poetry.lock
77 changes: 7 additions & 70 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -9,85 +9,22 @@ repos:
- id: check-case-conflict
- id: check-json
- id: check-toml
exclude: tests/fixtures/invalid_lock/poetry\.lock
exclude: tests/fixtures
- id: check-yaml
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii, --no-sort-keys]
- id: check-ast
- id: debug-statements
- id: check-docstring-first

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.7
hooks:
- id: python-check-mock-methods
- id: python-use-type-annotations
- id: python-check-blanket-noqa

- repo: https://github.com/asottile/yesqa
rev: v1.4.0
hooks:
- id: yesqa
additional_dependencies: &flake8_deps
- flake8-annotations==2.9.0
- flake8-broken-line==0.5.0
- flake8-bugbear==22.7.1
- flake8-comprehensions==3.10.0
- flake8-eradicate==1.3.0
- flake8-quotes==3.3.1
- flake8-simplify==0.19.3
- flake8-tidy-imports==4.8.0
- flake8-type-checking==2.2.0
- flake8-typing-imports==1.12.0
- flake8-use-fstring==1.4
- pep8-naming==0.13.1
- flake8-pie==0.16.0

- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
hooks:
- id: pyupgrade
args: [--py36-plus]
exclude: ^(install|get)-poetry.py$

- repo: https://github.com/hadialqattan/pycln
rev: v2.1.1
hooks:
- id: pycln
args: [--all]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: "isort (python)"
types: [python]
args: [--add-import, from __future__ import annotations]
exclude: |
(?x)(
^(install|get)-poetry.py$
| ^src/poetry/__init__.py$
)

- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies: *flake8_deps

- repo: https://github.com/PyCQA/pylint
rev: v2.15.5
hooks:
- id: pylint
language: system
- id: ruff-check
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.982
rev: v1.19.1
hooks:
- id: mypy
language: system
Loading
Loading