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
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
commit:
prefix : ⬆️
21 changes: 21 additions & 0 deletions .github/test-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test Setup
description: 'Test setup action for this project'

inputs:
python-version:
required: true
description: "py version"

runs:
using: "composite"
steps:
- name: Setup Python ${{ inputs.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ inputs.python-version }}
cache: pip
- name: Installing test deps...
run: |
python -m pip install --upgrade pip
pip install '.[test]'
shell: bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Code Lint
permissions: { }

on:
pull_request:
types: [ reopened ]
Expand All @@ -9,6 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/[email protected]
with:
python-version: 3.9
Expand Down
54 changes: 25 additions & 29 deletions .github/workflows/test.yml → .github/workflows/code-test.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
name: unit-test
name: Unit Tests
permissions: { }

on:
pull_request:
types: [ reopened ]
push:

env:
PY_BASE_VERSION: "3.9"

jobs:
coverage-test: # Tests code for base version and coverage
runs-on: windows-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Setup Python 3.9
uses: actions/setup-python@v5
- uses: actions/checkout@v4
with:
python-version: '3.9'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install '.[test]'
fetch-depth: 0
persist-credentials: false
- uses: ./.github/test-setup
with:
python-version: ${{ env.PY_BASE_VERSION }}

- name: Run tests with coverage and enforce minimum
run: pytest -x --cov --cov-report=xml
Expand All @@ -31,37 +32,32 @@ jobs:
path: coverage.xml

macos-test: # Tests on macOS latest
needs: coverage-test
runs-on: macos-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Setup Python 3.9
uses: actions/setup-python@v5
- uses: actions/checkout@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel
pip install '.[test]'
fetch-depth: 0
persist-credentials: false
- uses: ./.github/test-setup
with:
python-version: ${{ env.PY_BASE_VERSION }}
- name: Run Tests
run: pytest -x

version-tests: # Tests code for higher version in ubuntu
needs: coverage-test
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
fetch-depth: 0
persist-credentials: false
- uses: ./.github/test-setup
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Requirements
run: |
python -m pip install --upgrade pip wheel
pip install '.[test]'
- name: Run Tests
run: pytest -x
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: pip

- name: Install dependencies
run: |
Expand All @@ -42,4 +41,4 @@ jobs:
gh release create $TAG --generate-notes

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@v1.12.4
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 6.0.0
rev: 6.0.1
hooks:
- id: isort

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

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
Expand All @@ -19,13 +17,11 @@ repos:
always_run: false
args: [ -b, main, -b, master ]
exclude: "__about__.py"

- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
rev: 7.2.0
hooks:
- id: flake8
additional_dependencies: [ flake8-pyproject ]

- repo: local
hooks:
- id: pylint
Expand Down
16 changes: 4 additions & 12 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,16 @@ max-line-length = 130
[REFACTORING]
max-args=8
max-attributes = 9
max-branches = 30
max-locals = 31
max-branches = 20
max-locals = 20
max-positional-arguments = 8
max-statements = 77

[MESSAGES CONTROL]
disable=
I,
import-error,
# Warnings
fixme,
keyword-arg-before-vararg,
logging-fstring-interpolation,
protected-access,
unspecified-encoding,
# Conventions
missing-docstring,
unidiomatic-typecheck,
# Refactoring
duplicate-code,
no-else-return,
keyword-arg-before-vararg,
logging-fstring-interpolation,
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# VObjectx

| | |
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Compatibility | ![PyPI-PyVersion](https://img.shields.io/pypi/pyversions/vobjectx) |
| Quality Checks | [![pre--commit](https://github.com/rsb-23/vobjectx/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/rsb-23/vobjectx/actions/workflows/pre-commit.yml) [![unit tests](https://github.com/rsb-23/vobjectx/actions/workflows/test.yml/badge.svg)](https://github.com/rsb-23/vobjectx/actions/workflows/test.yml) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)] |
| Package | ![PyPI-Version](https://img.shields.io/pypi/v/vobjectx) ![PyPI-Downloads](https://img.shields.io/pypi/dm/vobjectx?label=PyPI%20downloads) |
| MetaData | [![License](https://img.shields.io/badge/License-Apache_2.0-orange.svg)](https://github.com/rsb-23/vobjectx/blob/main/LICENSE) |
| | |
|----------------|---------------------------------------------------------------------------------------------|
| Compatibility | ![Py-Version] |
| Quality Checks | [![lint check][lint-badge]]() [![tests][tests-badge]]() [![pre-commit][pre-commit-badge]]() |
| Package | ![pypi-v] ![pypi-downloads] |
| MetaData | [![license-badge]][license] |

VObjectx is intended to be a full-featured Python3 package for parsing and
generating vCard and vCalendar files.
Expand All @@ -19,6 +19,15 @@ generating vCard and vCalendar files.
- It is a practice project to learn about different areas of python package creation and maintainenece.

---
Made with :heart:
Made with 💚

[pyvobject]: https://www.github.com/py-vobject/vobject

[lint-badge]: https://github.com/rsb-23/vobjectx/actions/workflows/code-lint.yml/badge.svg
[tests-badge]: https://github.com/rsb-23/vobjectx/actions/workflows/code-test.yml/badge.svg
[license]: https://github.com/rsb-23/vobjectx/blob/main/LICENSE
[license-badge]: https://img.shields.io/badge/License-Apache_2.0-orange.svg
[pre-commit-badge]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
[pypi-downloads]: https://img.shields.io/pypi/dm/vobjectx?label=Downloads
[pypi-v]: https://img.shields.io/pypi/v/vobjectx?label=latest
[py-version]: https://img.shields.io/pypi/pyversions/vobjectx
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers = [
]
keywords = ["vobjectx", "icalendar", "vcard", "ics", "vcs", "hcalendar", "contacts", "vobjectx", "parser"]
dependencies = ["python-dateutil >= 2.5.0; python_version < '3.10'",
"python-dateutil >= 2.7.0; python_version >= '3.10'", "pytz>=2019.1", "tzdata; sys_platform == 'win32'"]
"python-dateutil >= 2.7.3; python_version >= '3.10'", "pytz>=2019.1", "tzdata; sys_platform == 'win32'"]
requires-python = ">=3.9"
[project.optional-dependencies]
lint = ["pre-commit", "pylint"]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
python-dateutil >= 2.5.0; python_version < '3.10'
python-dateutil >= 2.7.0; python_version >= '3.10'
python-dateutil >= 2.7.3; python_version >= '3.10'
pytz>=2019.1
tzdata; sys_platform == 'win32'
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""" Do not delete"""
"""Do not delete"""
36 changes: 36 additions & 0 deletions tests/test_ics_diff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import pytest

from vobject.icalendar import Component
from vobject.ics_diff import get_sort_key, sort_by_uid

# AI generated


def test_empty_list():
assert sort_by_uid([]) == []


def test_single_component():
component = Component("VEVENT")
components = [component]
sorted_components = sort_by_uid(components)
expected_sorted = [components[0]]
assert sorted_components == expected_sorted


@pytest.mark.skip(reason="to be checked")
def test_multiple_components():
event1 = Component("VEVENT", uid="uid1", sequence=1, recurrence_id=None)
event2 = Component("VEVENT", uid="uid2", sequence=3, recurrence_id="1970-01-01T00:00:00Z")
components = [event1, event2]
sorted_components = sort_by_uid(components)
expected_sorted = [event1, event2]
assert sorted_components == expected_sorted


@pytest.mark.skip(reason="to be checked")
def test_sort_key():
event = Component("VEVENT", uid="uid1", sequence=2, recurrence_id="1970-01-01T00:00:00Z")
sort_key = get_sort_key(event)
expected_sort_key = "uid10020000001970-01-01T00:00:00Z"
assert sort_key == expected_sort_key
Loading
Loading