Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrxyz committed Oct 14, 2023
0 parents commit bd85d93
Show file tree
Hide file tree
Showing 15 changed files with 1,428 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: MIL discord-bot CI

# yamllint disable-line rule:truthy
on:
[push, workflow_dispatch]

env:
# Cache version to control pre-commit caches
CACHE_VERSION: 0
# 3.10 is recent enough
DEFAULT_PYTHON: 3.10.11
# Location of the pre-commit cache. This is set by pre-commit, not us!
PRE_COMMIT_CACHE: ~/.cache/pre-commit

# Cancels previous runs targeting the same hash
concurrency:
group: >
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON}}
cache: "pip"

- name: Generate pre-commit cache key
id: pre-commit_cache_key
run: >
echo "::set-output
name=key::${{ env.CACHE_VERSION }}-${{ env.DEFAULT_PYTHON }}-${{
hashFiles('.pre-commit-config.yaml') }}"
- name: Install pre-commit
run: |
pip install --upgrade pip
pip install "$(cat requirements.txt | grep pre-commit)"
- name: Restore base pre-commit environment
id: cache-pre-commmit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: >
${{ runner.os
}}-pre-commit-${{
steps.pre-commit_cache_key.outputs.key }}
- name: Install pre-commit dependencies if no cache
if: steps.cache-pre-commit.outputs.cache-hit != 'true'
run: |
pre-commit install-hooks
- name: Run hooks
run: >
SKIP=no-commit-to-branch
pre-commit run --all-files --show-diff-on-failure
160 changes: 160 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# 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/

# 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/
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
default_language_version:
python: python3.10

repos:
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.27.1
hooks:
- id: yamllint
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.260'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.1
hooks:
- id: pyupgrade
args: [--py310-plus]
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args:
- --ignore-words-list=nd,som
- --quiet-level=2
exclude_types: [csv, json]
- repo: https://github.com/hadolint/hadolint
rev: v2.10.0
hooks:
- id: hadolint
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-symlinks
- id: check-json
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- id: no-commit-to-branch
args:
- --branch=master
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 🤖 MIL Discord Bot

This is the internal Discord bot for the Machine Intelligence Laboratory Discord
server! This bot can be used for managing the chaos, brilliance, and fun of our
laboratory environment!

## Setup

```bash
git clone https://github.com/uf-mil/discord-bot
cd discord-bot
pip3 install -r requirements.txt
# Edit .env with config values
python3 -m src.bot
```

## Contributions

Contributions are always open, of course, especially to any lab member!
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
discord
PyGithub==1.59.1
pre-commit==2.20.0
23 changes: 23 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
extend-select = [
"UP", # pyupgrade
"I", # isort
"RUF", # ruff-specific rules
"RSE", # flake8-raise (exceptions)
"COM", # flake8-comma
"C4", # flake8-comprehensions
"SIM", # flake8-simplify
]

target-version = "py310"

ignore = [
"E501", # Line length
"F405", # Unknown import
"F403", # Unknown names
]

[per-file-ignores]
"__init__.py" = ["F401"]

[pydocstyle]
convention = "google"
Empty file added src/__init__.py
Empty file.
Loading

0 comments on commit bd85d93

Please sign in to comment.