Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
broomva authored Jan 26, 2024
0 parents commit 593e3ea
Show file tree
Hide file tree
Showing 25 changed files with 3,286 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
databricks_experiment_name=''
databricks_experiment_id=''
databricks_host=''
databricks_token=''
databricks_username=''
databricks_password=''
databricks_cluster_id=''
databricks_sql_http_path=''
5 changes: 5 additions & 0 deletions .gitcommit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<type>(<scope>): <subject>

<body>

<footer>
60 changes: 60 additions & 0 deletions .github/workflows/python-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: python-cd

on:
repository_dispatch:
types: [python-ci] # trigger when pr is merged and ci is successful
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'CD Tags'
required: false
type: boolean
environment:
description: 'Environment to run CD'
type: environment
required: true

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# - name: Build the Docker image
# run: docker build . --file Dockerfile --tag llm_explorer:$(date +%s)
106 changes: 106 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: python-ci

permissions:
contents: write
pull-requests: write

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'CI Tags'
required: false
type: boolean
environment:
description: 'Environment to run CI'
type: environment
required: true

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install black pylint
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Modify Files using Current Branch Name
run: |
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
# Find and update Python files with Jinja pattern
find . -type f -name "*.py" -exec sh -c '
for file do
# Replace {{ git_branch }} with the current branch name
sed -i "s/{{ git_branch }}/$GITHUB_REF_NAME/g" "$file"
done
' sh {} +
fi
- name: Auto Lint with black, pylint
run: |
black .
black --diff --check $(git ls-files '*.py')
pylint --disable=all --enable=unused-import $(git ls-files '*.py')
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git commit -m "chore(versioning): versioning and linting changes" || echo "No changes to commit"
git push || echo "No changes to push"
- name: Handle Versioning
uses: google-github-actions/release-please-action@v3
with:
release-type: python
package-name: release-please-action


- name: Check if commit is a result of PR merge
id: check
run: |
commit_message=$(git log --format=%B -n 1 ${{ github.sha }})
if [[ "$commit_message" == *"Merge pull request #"* ]]; then
echo "::set-output name=is_pr_merge::true"
else
echo "::set-output name=is_pr_merge::false"
fi
- name: Dispatch custom event for python-cd workflow
if: ${{ steps.check.outputs.is_pr_merge == 'true' }}
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.PAT }} # assuming you've set this secret in your repo
repository: ${{ github.repository }}
event-type: python-ci
# release-please:
# runs-on: ubuntu-latest
# steps:
# - uses: google-github-actions/release-please-action@v3
# with:
# release-type: node
# package-name: release-please-action
167 changes: 167 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

.streamlit/secrets.toml

# C extensions
*.so

.DS_Store
.__pycache__

poetry.lock

# 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/

# 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/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.analysis.typeCheckingMode": "off"
}
Loading

0 comments on commit 593e3ea

Please sign in to comment.