From 8a662eb7a524dae5966956a66c040f94057c7936 Mon Sep 17 00:00:00 2001 From: wwakabobik Date: Thu, 28 Nov 2024 10:41:31 +0100 Subject: [PATCH] Update README.md and GitHub actions --- .github/workflows/linters.yml | 27 +++++++++------ .github/workflows/master_linters.yml | 52 +++++++++++++++++++++++----- LICENSE | 2 +- README.md | 7 +++- pyproject.toml | 2 ++ setup.cfg | 4 ++- src/requirements.txt | 4 +-- 7 files changed, 74 insertions(+), 24 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 624df96..072c2d0 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 @@ -45,11 +45,10 @@ jobs: id: mypy continue-on-error: true run: | - mkdir -p .mypy_cache changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true - echo $changed_files if [ -n "$changed_files" ]; then - PYTHONPATH=. mypy $changed_files --install-types --non-interactive --ignore-missing-imports + mkdir -p .mypy_cache + PYTHONPATH=. mypy $changed_files --install-types --non-interactive --ignore-missing-imports --exclude __main__.py else echo "No files changed, passing by" exit 0 @@ -59,12 +58,11 @@ jobs: continue-on-error: true run: | changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true - echo $changed_files if [ -n "$changed_files" ]; then - PYTHONPATH=. flake8 $changed_files + PYTHONPATH=. flake8 $changed_files else - echo "No files changed, passing by" - exit 0 + echo "No files changed, passing by" + exit 0 fi - name: Check code with Black id: black @@ -80,7 +78,14 @@ jobs: fi - name: Check runner state run: | - if [[ "${{ steps.pylint.outcome }}" == "failure" || "${{ steps.black.outcome }}" == "failure" || "${{ steps.mypy.outcome }}" == "failure" ]]; then - echo "Linters failed, refer to related sections for info" + failed_steps=() + if [[ "${{ steps.pylint.outcome }}" == "failure" ]]; then failed_steps+=("Pylint"); fi + if [[ "${{ steps.black.outcome }}" == "failure" ]]; then failed_steps+=("Black"); fi + if [[ "${{ steps.mypy.outcome }}" == "failure" ]]; then failed_steps+=("Mypy"); fi + + if [ ${#failed_steps[@]} -ne 0 ]; then + echo "Failed: ${failed_steps[*]}" exit 1 - fi + else + echo "All passed, well done, bro!" + fi \ No newline at end of file diff --git a/.github/workflows/master_linters.yml b/.github/workflows/master_linters.yml index 78349ce..e511d70 100644 --- a/.github/workflows/master_linters.yml +++ b/.github/workflows/master_linters.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v4 @@ -29,24 +29,60 @@ jobs: - name: Analysing the code with pylint id: pylint continue-on-error: true - run: PYTHONPATH=. pylint $(find . -name '*.py') + run: | + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + echo $changed_files + if [ -n "$changed_files" ]; then + PYTHONPATH=. pylint $changed_files + else + echo "No files changed, passing by" + exit 0 + fi - name: Analysing the code with mypy id: mypy continue-on-error: true run: | - mkdir -p .mypy_cache - PYTHONPATH=. mypy $(find . -name '*.py') --install-types --non-interactive --ignore-missing-imports --exclude __main__.py + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + if [ -n "$changed_files" ]; then + mkdir -p .mypy_cache + PYTHONPATH=. mypy $changed_files --install-types --non-interactive --ignore-missing-imports --exclude __main__.py + else + echo "No files changed, passing by" + exit 0 + fi - name: Check code with flake8 id: flake8 continue-on-error: true - run: PYTHONPATH=. flake8 $(find . -name '*.py') + run: | + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + if [ -n "$changed_files" ]; then + PYTHONPATH=. flake8 $changed_files + else + echo "No files changed, passing by" + exit 0 + fi - name: Check code with Black id: black continue-on-error: true - run: PYTHONPATH=. black --diff --check --color $(find . -name '*.py') + run: | + changed_files=$(git diff --diff-filter=d --name-only $(git merge-base HEAD origin/master) HEAD | grep '\.py$') || true + echo $changed_files + if [ -n "$changed_files" ]; then + PYTHONPATH=. black --diff --check --color $changed_files + else + echo "No files changed, passing by" + exit 0 + fi - name: Check runner state run: | - if [[ "${{ steps.pylint.outcome }}" == "failure" || "${{ steps.black.outcome }}" == "failure" || "${{ steps.mypy.outcome }}" == "failure" ]]; then - echo "Linters failed, refer to related sections for info" + failed_steps=() + if [[ "${{ steps.pylint.outcome }}" == "failure" ]]; then failed_steps+=("Pylint"); fi + if [[ "${{ steps.black.outcome }}" == "failure" ]]; then failed_steps+=("Black"); fi + if [[ "${{ steps.mypy.outcome }}" == "failure" ]]; then failed_steps+=("Mypy"); fi + + if [ ${#failed_steps[@]} -ne 0 ]; then + echo "Failed: ${failed_steps[*]}" exit 1 + else + echo "All passed, well done, bro!" fi diff --git a/LICENSE b/LICENSE index 0bec452..6ad26ee 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Ilya Vereshchagin +Copyright (c) 2024 Ilya Vereshchagin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index ce76a96..31ad050 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,12 @@ This package provides a Python API for [OpenAI](https://openai.com/), based on the official [API documentation](https://openai.com/blog/openai-api) and wraps-up original [OpenAI API](https://pypi.org/project/openai/). -[![PyPI version](https://badge.fury.io/py/openai-python-api.svg)](https://badge.fury.io/py/openai-python-api) [![Linters](https://github.com/wwakabobik/openai_api/actions/workflows/master_linters.yml/badge.svg?branch=master)](https://github.com/wwakabobik/openai_api/actions/workflows/master_linters.yml) +[![PyPI version](https://badge.fury.io/py/openai-python-api.svg)](https://badge.fury.io/py/openai-python-api) +[![Linters](https://github.com/wwakabobik/openai_api/actions/workflows/master_linters.yml/badge.svg?branch=master)](https://github.com/wwakabobik/openai_api/actions/workflows/master_linters.yml) +![PyPI - License](https://img.shields.io/pypi/l/openai-python-api) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openai-python-api) +[![Downloads](https://static.pepy.tech/badge/openai-python-api)](https://pepy.tech/project/openai-python-api) +[![Downloads](https://static.pepy.tech/badge/openai-python-api/month)](https://pepy.tech/project/openai-python-api) ## Installation diff --git a/pyproject.toml b/pyproject.toml index b778a7d..1e0153f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,8 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Intended Audience :: Developers", diff --git a/setup.cfg b/setup.cfg index b91237f..67e4ea9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,8 +15,10 @@ python_requires = >=3.9 classifiers = License :: OSI Approved :: MIT License Programming Language :: Python :: 3.9, - Programming Language :: Python :: 3.10, + Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 Operating System :: OS Independent Intended Audience :: Developers Intended Audience :: Information Technology diff --git a/src/requirements.txt b/src/requirements.txt index 043b22d..53a203b 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -1,5 +1,5 @@ aiofiles==24.1.0 -aiohttp==3.11.7 +aiohttp==3.11.8 asyncio==3.4.3 -openai==1.55.0 +openai==1.55.2 pillow==11.0.0