Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: John Strunk <[email protected]>
Signed-off-by: John Strunk <[email protected]>
  • Loading branch information
JohnStrunk committed Apr 3, 2024
0 parents commit 965b5d4
Show file tree
Hide file tree
Showing 14 changed files with 2,414 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Python",
"image": "mcr.microsoft.com/devcontainers/python:3.12-bookworm",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2.10.2": {},
"ghcr.io/devcontainers/features/github-cli:1.0.11": {},
"ghcr.io/devcontainers/features/node:1.4.1": {},
"ghcr.io/devcontainers-contrib/features/act:1.0.14": {},
"ghcr.io/devcontainers-contrib/features/pipenv:2.0.17": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2.0.17": {}
},

"customizations": {
"vscode": {
"extensions": [
"ms-toolsai.jupyter"
]
}
},

"containerEnv": {
"PIPENV_SITE_PACKAGES": "false",
"PIPENV_VENV_IN_PROJECT": "true"
},

"postCreateCommand": {
"Initialize pre-commit environment": "nohup sh -c 'pre-commit install -f --install-hooks &' < /dev/null > /dev/null 2>&1",
"Install python dependencies": "rm -rf .venv && pipenv sync --dev -v"
}
}
33 changes: 33 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# https://docs.mergify.com/

pull_request_rules:
- name: Automatic merge on approval
conditions:
- base=main
- "#approved-reviews-by>=1"
- "#changes-requested-reviews-by=0"
- label!=do-not-merge
# Branch protection rules are automatically enforced by GitHub/Mergify and
# need not be repeated here
actions:
queue:
merge_method: merge

- name: Automatic merge PRs from trusted contributors
conditions:
- base=main
- or:
- author=renovate-bot # Renovate bot - dependency updates
- "#changes-requested-reviews-by=0"
- label!=do-not-merge
actions:
queue:
merge_method: merge

queue_rules:
- name: default
queue_conditions:
- base=main
- "#changes-requested-reviews-by=0"
- label!=do-not-merge
69 changes: 69 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
// JSON5 spec: https://json5.org/
// Renovate docs: https://docs.renovatebot.com/configuration-options/

"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended", // Use recommended settings
"helpers:pinGitHubActionDigests", // Pin GitHub action digests
":enablePreCommit", // Enable updates to pre-commit repos
":gitSignOff" // Add Signed-off-by line to commit messages
],
// Files to ignore
// "ignorePaths": [
// "docs/requirements.txt"
// ],
"labels": [
"dependencies"
],
"lockFileMaintenance": {"enabled": true},
"packageRules": [
{
"description": "Update golang tag in dockerfile & golang version in workflows in a single PR",
"groupName": "golang version",
"matchDepNames": [
"^golang$"
]
},
{
"description": "Update devcontainer images in a single PR",
"groupName": "devcontainer",
"matchFileNames": [".devcontainer/devcontainer.json"]
},
{
"description": "Update renovatebot/pre-commit-hooks weekly to decrease noise",
"matchPackageNames": ["renovatebot/pre-commit-hooks"],
"schedule": ["before 9am on monday"]
}
],
"customManagers": [
{
"customType": "regex",
"description": "devcontainer base image",
"fileMatch": [
"^.devcontainer/devcontainer.json$"
],
"matchStrings": [
"\"image\"\\s*:\\s*\"(?<depName>.*?):(?<currentValue>.*?)(@(?<currentDigest>sha256:[a-f0-9]+))?\""
],
"datasourceTemplate": "docker"
},
{
"customType": "regex",
"description": "devcontainer feature images",
"fileMatch": [
"^.devcontainer/devcontainer.json$"
],
"matchStrings": [
// devcontainer features don't support sha256 digests
"\"(?<depName>.*?):(?<currentValue>.*?)\"\\s*:\\s*"
],
"datasourceTemplate": "docker"
}
],
// "schedule": [
// "before 7am on Tuesday" // Update weekly
// ],
"semanticCommits": "disabled",
"timezone": "America/New_York"
}
47 changes: 47 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: "Pre-commit"

on: # yamllint disable-line rule:truthy
push:
branches:
- main
tags: ["*"]
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
workflow_dispatch:

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Set up Python
id: setup-py
# https://github.com/actions/setup-python
# yamllint disable-line rule:line-length
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
with:
python-version: "3.12"

- name: Enable cache for pre-commit hooks
# https://github.com/actions/cache
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: ~/.cache/pre-commit
# yamllint disable-line rule:line-length
key: pre-commit|${{ steps.setup-py.outputs.python-version}}|${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit|${{ steps.setup-py.outputs.python-version}}|
pre-commit|
- name: Run pre-commit checks
run: pipx run pre-commit run -a

- name: Run pre-commit gc
run: pipx run pre-commit gc
21 changes: 21 additions & 0 deletions .github/yamllint-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# https://yamllint.readthedocs.io/en/stable/configuration.html

extends: default

# Files to ignore can be added to pre-commit config
# ignore: |
# hack/crds/*
# config/**
# bundle/**

rules:
comments: # renovate-bot dosen't put 2 spaces before the version number
ignore: |
.github/workflows/*
indentation:
indent-sequences: consistent
line-length:
allow-non-breakable-inline-mappings: true
new-lines:
type: platform
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/__pycache__/
/.mypy_cache/
/.pytest_cache/
/.env
/.venv/
114 changes: 114 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

# Install in your local dev environment
# > pip install --upgrade --user pre-commit
# Enable the hooks for this repo
# > pre-commit install

# yamllint disable rule:line-length

# Completely exclude certain files from checks
# exclude: |
# (?x)^(
# vendor/.**|
# dir2/.*
# )$

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files # Prevents giant files from being committed
- id: check-docstring-first # Prevent code before docstring
- id: check-json # Check that JSON files are valid
exclude: |
(?x)^(
.devcontainer/devcontainer.json
)$
- id: check-merge-conflict # Check merge conflict strings
- id: check-symlinks # Ensure symlinks have a valid target
- id: check-toml # Ensure toml files are valid
- id: check-xml # Check that XML files are valid
- id: debug-statements # debugger imports and breakpoint() calls
- id: end-of-file-fixer # File is empty or ends with one newline
- id: fix-byte-order-marker # Forbid utf-8 byte order marker
- id: trailing-whitespace # Trims trailing whitespace
args: [--markdown-linebreak-ext=md]
# exclude: |
# (?x)^(
# test\.py|
# testdata/.*
# )$

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
# Lint restructuredText files
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
# Forbid UTF-8 replacement character
- id: text-unicode-replacement-char

- repo: https://github.com/adrienverge/yamllint
rev: "v1.35.1"
hooks:
# Lint yaml files
- id: yamllint
args: ["--strict", "-c", ".github/yamllint-config.yaml"]

- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
# Lint Dockerfiles
- id: hadolint

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: "v0.39.0"
hooks:
# Lint markdown files
- id: markdownlint
exclude: |
(?x)^(
.github/pull_request_template.md
)$
- repo: https://github.com/psf/black
rev: "24.3.0"
hooks:
# Standardized Python code formatting
- id: black

- repo: https://github.com/PyCQA/isort
rev: "5.13.2"
hooks:
# Sort Python imports
- id: isort
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: "37.252.1"
hooks:
# Validate Renovate's configuration file
- id: renovate-config-validator

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck

- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
# Prevent secrets from being committed
- id: detect-secrets
# args: ['--baseline', '.secrets.baseline']
# exclude: package.lock.json

- repo: https://gitlab.com/bmares/check-json5
rev: "v1.0.0"
hooks:
# Check that JSON files are valid JSON5
- id: check-json5
23 changes: 23 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
atlassian-python-api = "*"
langchain = "*"

[dev-packages]
ipykernel = "*"
mypy = "*"
pylint = "*"
pytest = "*"
pytest-pylint = "*"
pytest-mypy = "*"

[requires]
python_version = "3.12"

[scripts]
# pipenv run tests
tests = "pytest -v"
Loading

0 comments on commit 965b5d4

Please sign in to comment.