Skip to content

Commit

Permalink
Update README.md and GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wwakabobik committed Nov 28, 2024
1 parent 271cf7e commit 8a662eb
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 24 deletions.
27 changes: 16 additions & 11 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
52 changes: 44 additions & 8 deletions .github/workflows/master_linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8a662eb

Please sign in to comment.