diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index ecc101b..d89c96e 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -1,48 +1,48 @@ -name: "Publish to PyPi" +name: Publish to PyPi permissions: - actions: "write" + actions: write on: workflow_run: - workflows: ["Python Tests"] + workflows: [Python Tests] types: - - completed + - completed branches: - - main + - main jobs: pypi-release: - name: "PyPi Release" - runs-on: "ubuntu-latest" + name: PyPi Release + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} - - uses: actions/setup-python@v5 - with: - python-version-file: pyproject.toml + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} + - uses: actions/setup-python@v5 + with: + python-version-file: pyproject.toml - - name: Skip if version did not change. - run: | - version_change=$(git diff -r HEAD^1 pyproject.toml | grep -E "^(\+|-)version =") - if [[ -z "$version_change" ]]; then - gh run cancel ${{ github.run_id }} - gh run watch ${{ github.run_id }} - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Skip if version did not change. + run: | + version_change=$(git diff -r HEAD^1 pyproject.toml | grep -E "^(\+|-)version =") + if [[ -z "$version_change" ]]; then + gh run cancel ${{ github.run_id }} + gh run watch ${{ github.run_id }} + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Build package. - run: | - pipx install poetry - poetry install --only main - poetry build + - name: Build package. + run: | + pipx install poetry + poetry install --only main + poetry build - - name: Publish to PyPi. - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} - verbose: true \ No newline at end of file + - name: Publish to PyPi. + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + verbose: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3bbe262..ad234a2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python_version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 - name: Install poetry @@ -54,6 +54,6 @@ jobs: with: python-version-file: pyproject.toml cache: poetry - - run: | + - run: |- poetry install - poetry run mypy . \ No newline at end of file + poetry run mypy . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9700112..c970168 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,11 +4,10 @@ repos: - repo: https://github.com/python-poetry/poetry rev: 1.7.1 hooks: - - id: poetry-check - - id: poetry-lock - + - id: poetry-check + - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.1.8 hooks: - id: ruff - id: ruff-format @@ -18,6 +17,9 @@ repos: hooks: - id: mypy args: [--ignore-missing-imports] + additional_dependencies: + - types-requests + - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks rev: v2.11.0 hooks: diff --git a/poetry.lock b/poetry.lock index 5f866b6..dc34f43 100644 --- a/poetry.lock +++ b/poetry.lock @@ -16,19 +16,20 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} [[package]] name = "anyio" -version = "4.1.0" +version = "4.2.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false python-versions = ">=3.8" files = [ - {file = "anyio-4.1.0-py3-none-any.whl", hash = "sha256:56a415fbc462291813a94528a779597226619c8e78af7de0507333f700011e5f"}, - {file = "anyio-4.1.0.tar.gz", hash = "sha256:5a0bec7085176715be77df87fc66d6c9d70626bd752fcc85f57cdbee5b3760da"}, + {file = "anyio-4.2.0-py3-none-any.whl", hash = "sha256:745843b39e829e108e518c489b31dc757de7d2131d53fac32bd8df268227bfee"}, + {file = "anyio-4.2.0.tar.gz", hash = "sha256:e1875bb4b4e2de1669f4bc7869b6d3f54231cdced71605e6e64c9be77e3be50f"}, ] [package.dependencies] exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" +typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} [package.extras] doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] @@ -592,13 +593,13 @@ setuptools = "*" [[package]] name = "openai" -version = "1.4.0" +version = "1.5.0" description = "The official Python library for the openai API" optional = false python-versions = ">=3.7.1" files = [ - {file = "openai-1.4.0-py3-none-any.whl", hash = "sha256:173e2a63822e73d6a8c971adacd98ed350301be755617b61b47d39e05b90a3f0"}, - {file = "openai-1.4.0.tar.gz", hash = "sha256:b5561e897bf6b42d3876552e06ce0e7960688791ec4090ed0e780e56fe3f1848"}, + {file = "openai-1.5.0-py3-none-any.whl", hash = "sha256:42d8c84b0714c990e18afe81d37f8a64423e8196bf7157b8ea665b8d8f393253"}, + {file = "openai-1.5.0.tar.gz", hash = "sha256:4cd91e97988ccd6c44f815107def9495cbc718aeb8b28be33a87b6fa2c432508"}, ] [package.dependencies] @@ -1262,10 +1263,7 @@ files = [ [package.extras] test = ["pytest (>=6.0.0)", "setuptools (>=65)"] -[extras] -docs = [] - [metadata] lock-version = "2.0" python-versions = ">3.8, <4.0" -content-hash = "aa51a35d53b6840380c8cbdb51375b8861b275877aba957130b9651595cbe319" +content-hash = "194ef6b36e81fbd9d31fbec270c83b735c7f6ec1422c6c5e7a17630b106501a2" diff --git a/pyproject.toml b/pyproject.toml index fef6c1b..2194b7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,17 +34,14 @@ tox-poetry-installer = "1.0.0b1" [tool.poetry.group.docs.dependencies] pdoc = "^14.1.0" -[tool.poetry.extras] -docs = ["pdoc"] +[tool.poetry.scripts] +cloai = 'cloai.__main__:main' [tool.pytest.ini_options] pythonpath = [ "src" ] -[tool.poetry.scripts] -cloai = 'cloai.__main__:main' - [tool.tox] legacy_tox_ini = """ [tox] @@ -63,40 +60,39 @@ ignore_missing_imports = true [tool.ruff] exclude = [ - ".bzr", - ".direnv", - ".eggs", - ".git", - ".git-rewrite", - ".hg", - ".mypy_cache", - ".nox", - ".pants.d", - ".pytype", - ".ruff_cache", - ".svn", - ".tox", - ".venv", - "__pypackages__", - "_build", - "buck-out", - "build", - "dist", - "node_modules", - "venv", + ".bzr", + ".direnv", + ".eggs", + ".git", + ".git-rewrite", + ".hg", + ".mypy_cache", + ".nox", + ".pants.d", + ".pytype", + ".ruff_cache", + ".svn", + ".tox", + ".venv", + "__pypackages__", + "_build", + "buck-out", + "build", + "dist", + "node_modules", + "venv" ] line-length = 88 indent-width = 4 -src=["src"] - +src = ["src"] target-version = "py311" [tool.ruff.lint] select = ["ALL"] ignore = [ - "ANN101", # Self should never be type annotated. - "ANN102", # cls should never be type annotated. - "B008", # Allow function call in arguments; this is common in FastAPI. + "ANN101", # Self should never be type annotated. + "ANN102", # cls should never be type annotated. + "B008" # Allow function call in arguments; this is common in FastAPI. ] fixable = ["ALL"] unfixable = [] @@ -113,15 +109,15 @@ convention = "google" [tool.ruff.per-file-ignores] "tests/**/*.py" = [ - "S101", # Allow assets - "ARG", # Unused arguments are common in tests (fixtures). - "FBT", #Allow positional booleans - "SLF001", # Allow private member access. - "INP001", # No need for namespace packages in tests. + "S101", # Allow assets + "ARG", # Unused arguments are common in tests (fixtures). + "FBT", # Allow positional booleans + "SLF001", # Allow private member access. + "INP001" # No need for namespace packages in tests. ] "src/**/models.py" = [ - "A003", # Allow id as a field name. + "A003" # Allow id as a field name. ] "src/**/schemas.py" = [ - "A003", # Allow id as a field name. + "A003" # Allow id as a field name. ]