Skip to content

Commit

Permalink
sync template
Browse files Browse the repository at this point in the history
  • Loading branch information
lwaekfjlk committed May 9, 2024
1 parent 832c5ae commit 0aa02bc
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 44 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/codebase_reorg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 🧹Codebase Reorg
description: Reorg, clean, format the codebase
title: "[WRT]: "
labels: ["writing"]
assignees: [""]
body:
- type: markdown
attributes:
value: |
Please make sure this codebase reorg request hasn't been already submitted by someone by looking through other open/closed issues
- type: textarea
id: description
attributes:
label: Description
description: Give us a brief description of the codebase reorg task you would like
validations:
required: true

- type: textarea
id: additional-information
attributes:
label: Additional Information
description: Give us some additional reason on why codebase reorg is necessary to do
31 changes: 31 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: codespell

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main

jobs:
codespell:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codespell==2.2.6 tomli==2.0.1
- name: Spelling check with codespell
run: |
codespell --toml pyproject.toml
31 changes: 31 additions & 0 deletions .github/workflows/isort.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: isort

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main

jobs:
isort:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install isort==5.13.2
- name: Run isort
run: |
isort . --check-only
22 changes: 16 additions & 6 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
name: Mypy
on: [push]
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main

jobs:
Static-Type-Checking:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: ["3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.11.2
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3
Expand All @@ -21,4 +31,4 @@ jobs:
run: |
# Run this mypy instance against our main package.
poetry run pip install types-protobuf==4.24.0.4
poetry run mypy --strict .
poetry run mypy --config-file pyproject.toml .
12 changes: 8 additions & 4 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ on:
jobs:
pre-commit:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.11.2
python-version: ${{ matrix.python-version }}
31 changes: 31 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: ruff

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main

jobs:
ruff:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff==0.1.5
- name: Analysing the code with ruff
run: |
ruff check .
15 changes: 10 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: Pytest
on: [push]
on:
pull_request:
push:
branches: [main]

jobs:
Pytest:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: ["3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.11.2
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3
Expand Down
32 changes: 10 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
repos:
- repo: local
hooks:
- id: poetry-update
name: Poetry Update
entry: poetry update
language: system
# Optional: specify types or files to trigger this hook
# files: pyproject.toml
# Always run this hook (not recommended for update; shown for illustrative purposes):
always_run: true
# Optional: prevent commit if the lock file changes
stages: [pre-commit]
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
Expand All @@ -24,16 +11,17 @@ repos:
hooks:
- id: prettier
types_or: [html]
- repo: https://github.com/psf/black
rev: 22.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.5
hooks:
- id: black
args: [--line-length=79]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black", --line-length=72]
# Run the linter.
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.0
hooks:
Expand Down
16 changes: 9 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "research-town"
name = "python-project-template"
version = "0.0.1"
description = "A multi-agent framework for research pipeline."
description = "A template for python-based research project"
authors = ["Haofei Yu <[email protected]>"]
license = "Apache 2.0 License"
readme = "README.md"
Expand Down Expand Up @@ -38,11 +38,13 @@ plugins = [
"pydantic.mypy"
]

[[tool.mypy.overrides]]
module = "transformers.*"
ignore_missing_imports = true


[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = "test_*.py"

[tool.codespell]
ignore-words-list = "dout, te, indicies, astroid"

[tool.isort]
use_parentheses = true
skip_gitignore = true

0 comments on commit 0aa02bc

Please sign in to comment.