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

feat: change dependences versions #34

Merged
merged 4 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: dependabot + pydantic-v1 + tests with various python versions
  • Loading branch information
danfimov committed Oct 1, 2023
commit 74500a3e137d099e4ef68fb66ac76059b459ef11
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
5 changes: 4 additions & 1 deletion .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ jobs:
test:
runs-on: ubuntu-latest
name: Run tests
strategy:
matrix:
python-version: [ '3.9', '3.10', '3.11' ]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: ${{ matrix.python-version }}
- run: pip install --upgrade pip
- run: make install
- run: make test
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Yandex Tracker Client (or Yet Another Tracker Client)

Async Yandex Tracker Client based on aiohttp and pydantic (v2)
Async Yandex Tracker Client based on aiohttp and pydantic

[![Python](https://img.shields.io/badge/python-^3.11-blue)](https://www.python.org/)
[![Python](https://img.shields.io/badge/python-^3.19-blue)](https://www.python.org/)
[![Code linter: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
[![Linters](https://github.com/danfimov/ya_tracker_client/actions/workflows/code-check.yml/badge.svg)](https://github.com/danfimov/ya_tracker_client/actions/workflows/code-check.yml)

Expand Down
3 changes: 3 additions & 0 deletions examples/get_test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ async def main() -> None:
await client.get_issue('TRACKER-1', expand='attachments')
await client.get_issue_transitions('TRACKER-1')
await client.get_queue('TRACKER')
await client.get_queue_fields('TRACKER')
await client.get_queue_versions('TRACKER')
await client.get_issue_relationships('TRACKER-1')
await client.get_checklist_items("TRACKER-1")
await client.get_components()
Expand All @@ -41,6 +43,7 @@ async def main() -> None:
await client.get_macros('TRACKER')
await client.find_number_of_issues(issue_filter={'queue': 'TRACKER', "assignee": "empty()"})
await client.get_history_issue_changes('TRACKER-1')
await client.find_issues()

await client.stop()

Expand Down
529 changes: 266 additions & 263 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ priority = "supplemental"
[tool.poetry.dependencies]
python = "^3.11"
aiohttp = "^3.8.5"
pydantic = "^2.3.0"
pydantic = ">= 1.10.12, < 3"
certifi = "^2023.7.22"

[tool.poetry.group.dev.dependencies]
Expand Down
19 changes: 18 additions & 1 deletion ya_tracker_client/domain/entities/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
from abc import ABCMeta

import pydantic
from pydantic import BaseModel, ConfigDict
from pydantic.alias_generators import to_camel

if int(pydantic.VERSION[0]) == 2:
from pydantic.alias_generators import to_camel
else:
from re import sub


def to_camel(snake: str) -> str:
"""
Convert a snake_case string to camelCase.

:param snake: The string to convert.
:return: The converted camelCase string.
"""
camel = snake.title()
camel = sub('([0-9A-Za-z])_(?=[0-9A-Z])', lambda m: m.group(1), camel) # to PascalCase first
return sub('(^_*[A-Z])', lambda m: m.group(1).lower(), camel)


def tracker_alias_generator(s: str) -> str:
Expand Down
6 changes: 2 additions & 4 deletions ya_tracker_client/domain/entities/queue_field.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import AliasChoices, Field
from pydantic import Field

from ya_tracker_client.domain.entities.base import AbstractEntity
from ya_tracker_client.domain.entities.queue_field_category import QueueFieldCategory
Expand All @@ -13,9 +13,7 @@ class QueueField(AbstractEntity):
id: str
name: str
version: int
field_schema: QueueFieldSchema = Field(
validation_alias=AliasChoices("schema"),
)
field_schema: QueueFieldSchema = Field(alias='schema')
readonly: bool
options: bool
suggest: bool
Expand Down
Loading