From 157e1218239e062402803e9dde6e5338f8d03984 Mon Sep 17 00:00:00 2001 From: "Mark A. Miller" Date: Thu, 27 Jun 2024 13:04:45 -0400 Subject: [PATCH] Initial commit --- .cruft.json | 25 +++ .editorconfig | 5 + .github/actions/setup-poetry-env/action.yml | 33 ++++ .github/workflows/main.yml | 74 ++++++++ .github/workflows/on-release-main.yml | 44 +++++ .github/workflows/validate-codecov-config.yml | 15 ++ .gitignore | 167 ++++++++++++++++++ .pre-commit-config.yaml | 22 +++ CONTRIBUTING.md | 133 ++++++++++++++ Dockerfile | 21 +++ LICENSE | 22 +++ Makefile | 56 ++++++ README.md | 50 ++++++ codecov.yaml | 9 + docs/index.md | 8 + docs/modules.md | 1 + llm_github/__init__.py | 0 llm_github/foo.py | 17 ++ mkdocs.yml | 54 ++++++ poetry.toml | 2 + pyproject.toml | 101 +++++++++++ tests/test_foo.py | 5 + tox.ini | 18 ++ 23 files changed, 882 insertions(+) create mode 100644 .cruft.json create mode 100644 .editorconfig create mode 100644 .github/actions/setup-poetry-env/action.yml create mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/on-release-main.yml create mode 100644 .github/workflows/validate-codecov-config.yml create mode 100644 .gitignore create mode 100644 .pre-commit-config.yaml create mode 100644 CONTRIBUTING.md create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 codecov.yaml create mode 100644 docs/index.md create mode 100644 docs/modules.md create mode 100644 llm_github/__init__.py create mode 100644 llm_github/foo.py create mode 100644 mkdocs.yml create mode 100644 poetry.toml create mode 100644 pyproject.toml create mode 100644 tests/test_foo.py create mode 100644 tox.ini diff --git a/.cruft.json b/.cruft.json new file mode 100644 index 0000000..8377fc9 --- /dev/null +++ b/.cruft.json @@ -0,0 +1,25 @@ +{ + "template": "https://github.com/fpgmaas/cookiecutter-poetry.git", + "commit": "f448c9c6407c799f6b81b8e310608cb841e98d15", + "checkout": null, + "context": { + "cookiecutter": { + "author": "Mark Andrew Miller", + "email": "mamillerpa@gmail.com", + "author_github_handle": "turbomam", + "project_name": "llm-github", + "project_slug": "llm_github", + "project_description": "Tools for extracting knowledge from GitHub issues, PR comments, etc.", + "include_github_actions": "y", + "publish_to": "pypi", + "deptry": "y", + "mkdocs": "y", + "codecov": "y", + "dockerfile": "y", + "devcontainer": "n", + "open_source_license": "MIT license", + "_template": "https://github.com/fpgmaas/cookiecutter-poetry.git" + } + }, + "directory": null +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9395b54 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +max_line_length = 120 + +[*.json] +indent_style = space +indent_size = 4 diff --git a/.github/actions/setup-poetry-env/action.yml b/.github/actions/setup-poetry-env/action.yml new file mode 100644 index 0000000..b2cd2df --- /dev/null +++ b/.github/actions/setup-poetry-env/action.yml @@ -0,0 +1,33 @@ +name: "setup-poetry-env" +description: "Composite action to setup the Python and poetry environment." + +inputs: + python-version: + required: false + description: "The python version to use" + default: "3.11" + +runs: + using: "composite" + steps: + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-in-project: true + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-${{ runner.os }}-${{ inputs.python-version }}-${{ hashFiles('poetry.lock') }} + + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction + shell: bash diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..d193f81 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,74 @@ +name: Main + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + quality: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v4 + + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + + - name: Set up the environment + uses: ./.github/actions/setup-poetry-env + + - name: Run checks + run: make check + + tox: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11'] + fail-fast: false + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + + - name: Load cached venv + uses: actions/cache@v4 + with: + path: .tox + key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }} + + - name: Install tox + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + + - name: Test with tox + run: tox + + - name: Upload coverage reports to Codecov with GitHub Action on Python 3.11 + uses: codecov/codecov-action@v4 + if: ${{ matrix.python-version == '3.11' }} + + check-docs: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Set up the environment + uses: ./.github/actions/setup-poetry-env + + - name: Check if documentation can be built + run: poetry run mkdocs build -s diff --git a/.github/workflows/on-release-main.yml b/.github/workflows/on-release-main.yml new file mode 100644 index 0000000..85f5200 --- /dev/null +++ b/.github/workflows/on-release-main.yml @@ -0,0 +1,44 @@ +name: release-main + +on: + release: + types: [published] + branches: [main] + +jobs: + + publish: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Set up the environment + uses: ./.github/actions/setup-poetry-env + + - name: Export tag + id: vars + run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT + + - name: Build and publish + run: | + source .venv/bin/activate + poetry version $RELEASE_VERSION + make build-and-publish + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + RELEASE_VERSION: ${{ steps.vars.outputs.tag }} + + deploy-docs: + needs: publish + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Set up the environment + uses: ./.github/actions/setup-poetry-env + + - name: Deploy documentation + run: poetry run mkdocs gh-deploy --force + diff --git a/.github/workflows/validate-codecov-config.yml b/.github/workflows/validate-codecov-config.yml new file mode 100644 index 0000000..2a8fd11 --- /dev/null +++ b/.github/workflows/validate-codecov-config.yml @@ -0,0 +1,15 @@ +name: validate-codecov-config + +on: + pull_request: + paths: [codecov.yaml] + push: + branches: [main] + +jobs: + validate-codecov-config: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Validate codecov configuration + run: curl -sSL --fail-with-body --data-binary @codecov.yaml https://codecov.io/validate diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f64e26a --- /dev/null +++ b/.gitignore @@ -0,0 +1,167 @@ +docs/source + +# From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# Vscode config files +.vscode/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5e3015b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,22 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.4.0" + hooks: + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: "v0.1.6" + hooks: + - id: ruff + args: [--exit-non-zero-on-fix] + - id: ruff-format + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.0.3" + hooks: + - id: prettier diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b3e84ac --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,133 @@ +# Contributing to `llm-github` + +Contributions are welcome, and they are greatly appreciated! +Every little bit helps, and credit will always be given. + +You can contribute in many ways: + +# Types of Contributions + +## Report Bugs + +Report bugs at https://github.com/turbomam/llm-github/issues + +If you are reporting a bug, please include: + +- Your operating system name and version. +- Any details about your local setup that might be helpful in troubleshooting. +- Detailed steps to reproduce the bug. + +## Fix Bugs + +Look through the GitHub issues for bugs. +Anything tagged with "bug" and "help wanted" is open to whoever wants to implement a fix for it. + +## Implement Features + +Look through the GitHub issues for features. +Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it. + +## Write Documentation + +Cookiecutter PyPackage could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such. + +## Submit Feedback + +The best way to send feedback is to file an issue at https://github.com/turbomam/llm-github/issues. + +If you are proposing a new feature: + +- Explain in detail how it would work. +- Keep the scope as narrow as possible, to make it easier to implement. +- Remember that this is a volunteer-driven project, and that contributions + are welcome :) + +# Get Started! + +Ready to contribute? Here's how to set up `llm-github` for local development. +Please note this documentation assumes you already have `poetry` and `Git` installed and ready to go. + +1. Fork the `llm-github` repo on GitHub. + +2. Clone your fork locally: + +```bash +cd +git clone git@github.com:YOUR_NAME/llm-github.git +``` + +3. Now we need to install the environment. Navigate into the directory + +```bash +cd llm-github +``` + +If you are using `pyenv`, select a version to use locally. (See installed versions with `pyenv versions`) + +```bash +pyenv local +``` + +Then, install and activate the environment with: + +```bash +poetry install +poetry shell +``` + +4. Install pre-commit to run linters/formatters at commit time: + +```bash +poetry run pre-commit install +``` + +5. Create a branch for local development: + +```bash +git checkout -b name-of-your-bugfix-or-feature +``` + +Now you can make your changes locally. + +6. Don't forget to add test cases for your added functionality to the `tests` directory. + +7. When you're done making changes, check that your changes pass the formatting tests. + +```bash +make check +``` + +Now, validate that all unit tests are passing: + +```bash +make test +``` + +9. Before raising a pull request you should also run tox. + This will run the tests across different versions of Python: + +```bash +tox +``` + +This requires you to have multiple versions of python installed. +This step is also triggered in the CI/CD pipeline, so you could also choose to skip this step locally. + +10. Commit your changes and push your branch to GitHub: + +```bash +git add . +git commit -m "Your detailed description of your changes." +git push origin name-of-your-bugfix-or-feature +``` + +11. Submit a pull request through the GitHub website. + +# Pull Request Guidelines + +Before you submit a pull request, check that it meets these guidelines: + +1. The pull request should include tests. + +2. If the pull request adds functionality, the docs should be updated. + Put your new functionality into a function with a docstring, and add the feature to the list in `README.md`. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..30992c9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# syntax=docker/dockerfile:1 + +FROM python:3.9-slim-buster + +ENV POETRY_VERSION=1.4 \ + POETRY_VIRTUALENVS_CREATE=false + +# Install poetry +RUN pip install "poetry==$POETRY_VERSION" + +# Copy only requirements to cache them in docker layer +WORKDIR /code +COPY poetry.lock pyproject.toml /code/ + +# Project initialization: +RUN poetry install --no-interaction --no-ansi --no-root --no-dev + +# Copy Python code to the Docker image +COPY llm_github /code/llm_github/ + +CMD [ "python", "llm_github/foo.py"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0da21c0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2024, Mark Andrew Miller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6be7935 --- /dev/null +++ b/Makefile @@ -0,0 +1,56 @@ +.PHONY: install +install: ## Install the poetry environment and install the pre-commit hooks + @echo "🚀 Creating virtual environment using pyenv and poetry" + @poetry install + @ poetry run pre-commit install + @poetry shell + +.PHONY: check +check: ## Run code quality tools. + @echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry check --lock" + @poetry check --lock + @echo "🚀 Linting code: Running pre-commit" + @poetry run pre-commit run -a + @echo "🚀 Static type checking: Running mypy" + @poetry run mypy + @echo "🚀 Checking for obsolete dependencies: Running deptry" + @poetry run deptry . + +.PHONY: test +test: ## Test the code with pytest + @echo "🚀 Testing code: Running pytest" + @poetry run pytest --cov --cov-config=pyproject.toml --cov-report=xml + +.PHONY: build +build: clean-build ## Build wheel file using poetry + @echo "🚀 Creating wheel file" + @poetry build + +.PHONY: clean-build +clean-build: ## clean build artifacts + @rm -rf dist + +.PHONY: publish +publish: ## publish a release to pypi. + @echo "🚀 Publishing: Dry run." + @poetry config pypi-token.pypi $(PYPI_TOKEN) + @poetry publish --dry-run + @echo "🚀 Publishing." + @poetry publish + +.PHONY: build-and-publish +build-and-publish: build publish ## Build and publish. + +.PHONY: docs-test +docs-test: ## Test if documentation can be built without warnings or errors + @poetry run mkdocs build -s + +.PHONY: docs +docs: ## Build and serve the documentation + @poetry run mkdocs serve + +.PHONY: help +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' + +.DEFAULT_GOAL := help diff --git a/README.md b/README.md new file mode 100644 index 0000000..627b663 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# llm-github + +[![Release](https://img.shields.io/github/v/release/turbomam/llm-github)](https://img.shields.io/github/v/release/turbomam/llm-github) +[![Build status](https://img.shields.io/github/actions/workflow/status/turbomam/llm-github/main.yml?branch=main)](https://github.com/turbomam/llm-github/actions/workflows/main.yml?query=branch%3Amain) +[![codecov](https://codecov.io/gh/turbomam/llm-github/branch/main/graph/badge.svg)](https://codecov.io/gh/turbomam/llm-github) +[![Commit activity](https://img.shields.io/github/commit-activity/m/turbomam/llm-github)](https://img.shields.io/github/commit-activity/m/turbomam/llm-github) +[![License](https://img.shields.io/github/license/turbomam/llm-github)](https://img.shields.io/github/license/turbomam/llm-github) + +Tools for extracting knowledge from GitHub issues, PR comments, etc. + +- **Github repository**: +- **Documentation** + +## Getting started with your project + +First, create a repository on GitHub with the same name as this project, and then run the following commands: + +```bash +git init -b main +git add . +git commit -m "init commit" +git remote add origin git@github.com:turbomam/llm-github.git +git push -u origin main +``` + +Finally, install the environment and the pre-commit hooks with + +```bash +make install +``` + +You are now ready to start development on your project! +The CI/CD pipeline will be triggered when you open a pull request, merge to main, or when you create a new release. + +To finalize the set-up for publishing to PyPi or Artifactory, see [here](https://fpgmaas.github.io/cookiecutter-poetry/features/publishing/#set-up-for-pypi). +For activating the automatic documentation with MkDocs, see [here](https://fpgmaas.github.io/cookiecutter-poetry/features/mkdocs/#enabling-the-documentation-on-github). +To enable the code coverage reports, see [here](https://fpgmaas.github.io/cookiecutter-poetry/features/codecov/). + +## Releasing a new version + +- Create an API Token on [Pypi](https://pypi.org/). +- Add the API Token to your projects secrets with the name `PYPI_TOKEN` by visiting [this page](https://github.com/turbomam/llm-github/settings/secrets/actions/new). +- Create a [new release](https://github.com/turbomam/llm-github/releases/new) on Github. +- Create a new tag in the form `*.*.*`. + +For more details, see [here](https://fpgmaas.github.io/cookiecutter-poetry/features/cicd/#how-to-trigger-a-release). + +--- + +Repository initiated with [fpgmaas/cookiecutter-poetry](https://github.com/fpgmaas/cookiecutter-poetry). diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 0000000..058cfb7 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,9 @@ +coverage: + range: 70..100 + round: down + precision: 1 + status: + project: + default: + target: 90% + threshold: 0.5% diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..ed8f976 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,8 @@ +# llm-github + +[![Release](https://img.shields.io/github/v/release/turbomam/llm-github)](https://img.shields.io/github/v/release/turbomam/llm-github) +[![Build status](https://img.shields.io/github/actions/workflow/status/turbomam/llm-github/main.yml?branch=main)](https://github.com/turbomam/llm-github/actions/workflows/main.yml?query=branch%3Amain) +[![Commit activity](https://img.shields.io/github/commit-activity/m/turbomam/llm-github)](https://img.shields.io/github/commit-activity/m/turbomam/llm-github) +[![License](https://img.shields.io/github/license/turbomam/llm-github)](https://img.shields.io/github/license/turbomam/llm-github) + +Tools for extracting knowledge from GitHub issues, PR comments, etc. diff --git a/docs/modules.md b/docs/modules.md new file mode 100644 index 0000000..07e4b93 --- /dev/null +++ b/docs/modules.md @@ -0,0 +1 @@ +::: llm_github.foo diff --git a/llm_github/__init__.py b/llm_github/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/llm_github/foo.py b/llm_github/foo.py new file mode 100644 index 0000000..8b7396d --- /dev/null +++ b/llm_github/foo.py @@ -0,0 +1,17 @@ +def foo(bar: str) -> str: + """Summary line. + + Extended description of function. + + Args: + bar: Description of input argument. + + Returns: + Description of return value + """ + + return bar + + +if __name__ == "__main__": # pragma: no cover + pass diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..212a5b1 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,54 @@ +site_name: llm-github +repo_url: https://github.com/turbomam/llm-github +site_url: https://turbomam.github.io/llm-github +site_description: Tools for extracting knowledge from GitHub issues, PR comments, etc. +site_author: Mark Andrew Miller +edit_uri: edit/main/docs/ +repo_name: turbomam/llm-github +copyright: Maintained by Florian. + +nav: + - Home: index.md + - Modules: modules.md +plugins: + - search + - mkdocstrings: + handlers: + python: + setup_commands: + - import sys + - sys.path.append('../') +theme: + name: material + feature: + tabs: true + palette: + - media: "(prefers-color-scheme: light)" + scheme: default + primary: white + accent: deep orange + toggle: + icon: material/brightness-7 + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: black + accent: deep orange + toggle: + icon: material/brightness-4 + name: Switch to light mode + icon: + repo: fontawesome/brands/github + +extra: + social: + - icon: fontawesome/brands/github + link: https://github.com/turbomam/llm-github + - icon: fontawesome/brands/python + link: https://pypi.org/project/llm-github + +markdown_extensions: + - toc: + permalink: true + - pymdownx.arithmatex: + generic: true diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 0000000..ab1033b --- /dev/null +++ b/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = true diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..09d370a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,101 @@ +[tool.poetry] +name = "llm_github" +version = "0.0.1" +description = "Tools for extracting knowledge from GitHub issues, PR comments, etc." +authors = ["Mark Andrew Miller "] +repository = "https://github.com/turbomam/llm-github" +documentation = "https://turbomam.github.io/llm-github/" +readme = "README.md" +packages = [ + {include = "llm_github"} +] + +[tool.poetry.dependencies] +python = ">=3.8,<4.0" + +[tool.poetry.group.dev.dependencies] +pytest = "^7.2.0" +pytest-cov = "^4.0.0" +deptry = "^0.12.0" +mypy = "^1.5.1" +pre-commit = "^3.4.0" +tox = "^4.11.1" + +[tool.poetry.group.docs.dependencies] +mkdocs = "^1.4.2" +mkdocs-material = "^9.2.7" +mkdocstrings = {extras = ["python"], version = "^0.23.0"} + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" + +[tool.mypy] +files = ["llm_github"] +disallow_untyped_defs = "True" +disallow_any_unimported = "True" +no_implicit_optional = "True" +check_untyped_defs = "True" +warn_return_any = "True" +warn_unused_ignores = "True" +show_error_codes = "True" + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.ruff] +target-version = "py37" +line-length = 120 +fix = true +select = [ + # flake8-2020 + "YTT", + # flake8-bandit + "S", + # flake8-bugbear + "B", + # flake8-builtins + "A", + # flake8-comprehensions + "C4", + # flake8-debugger + "T10", + # flake8-simplify + "SIM", + # isort + "I", + # mccabe + "C90", + # pycodestyle + "E", "W", + # pyflakes + "F", + # pygrep-hooks + "PGH", + # pyupgrade + "UP", + # ruff + "RUF", + # tryceratops + "TRY", +] +ignore = [ + # LineTooLong + "E501", + # DoNotAssignLambda + "E731", +] + +[tool.ruff.format] +preview = true + +[tool.coverage.report] +skip_empty = true + +[tool.coverage.run] +branch = true +source = ["llm_github"] + + +[tool.ruff.per-file-ignores] +"tests/*" = ["S101"] diff --git a/tests/test_foo.py b/tests/test_foo.py new file mode 100644 index 0000000..42c9b38 --- /dev/null +++ b/tests/test_foo.py @@ -0,0 +1,5 @@ +from llm_github.foo import foo + + +def test_foo(): + assert foo("foo") == "foo" diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..a44a21b --- /dev/null +++ b/tox.ini @@ -0,0 +1,18 @@ +[tox] +skipsdist = true +envlist = py38, py39, py310, py311 + +[gh-actions] +python = + 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311 + +[testenv] +passenv = PYTHON_VERSION +allowlist_externals = poetry +commands = + poetry install -v + pytest --doctest-modules tests --cov --cov-config=pyproject.toml --cov-report=xml + mypy