Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: #2 FastAPI テンプレートを追加 #3

Merged
merged 1 commit into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/DISCUSSION_TEMPLATE/adr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
labels: [ADR]

body:
- type: textarea
attributes:
label: コンテキスト
description: この決定を行った状況について書いてください。
validations:
required: true

- type: textarea
attributes:
label: 決定
description: 決定とその根拠について書いてください。
validations:
required: true

- type: textarea
attributes:
label: 影響
description: 決定による影響や、比較・検討した内容について書いてください。
validations:
required: true

- type: textarea
attributes:
label: 備考
description: 関連情報や参考文献等あれば書いてください。
validations:
required: false
55 changes: 55 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Bug Report
description: File a bug report
labels: ['bug']

body:
- type: markdown
attributes:
value: |
## Bug Report

Thank you for taking the time to report a bug.
Please fill in as much of the template below as you're able.

- type: input
id: steps-to-reproduce
attributes:
label: Steps to reproduce
description: What are the steps to reproduce the issue?
validations:
required: true

- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: What did you expect to happen?
validations:
required: true

- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
description: What actually happened?
validations:
required: true

- type: input
id: environment
attributes:
label: Environment (OS, Browser, etc.)
validations:
required: false

- type: dropdown
id: priority
attributes:
label: Priority
description: How important is this issue?
options:
- Low
- Medium
- High
validations:
required: true
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Feature Request
description: Suggest an idea for this project
labels: ['enhancement']

body:
- type: markdown
attributes:
value: |
## Feature Request

Thank you for taking the time to suggest a new feature.
Please describe the feature request with as much detail as possible.

- type: input
id: feature-summary
attributes:
label: Feature Summary
description: Provide a brief summary of the feature.
validations:
required: true

- type: textarea
id: problem-to-solve
attributes:
label: Problem to solve
description: What problem does this feature solve? Why is it needed?
validations:
required: true

- type: textarea
id: proposed-solution
attributes:
label: Proposed Solution
description: How do you propose to implement this feature? Provide any technical details you can.
validations:
required: false

- type: dropdown
id: priority
attributes:
label: Priority
description: How important is this feature?
options:
- Low
- Medium
- High
validations:
required: true
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# About

- This pull request will be automatically approved by github-actions.

## Related Issue

- #issue_number

## Changes

- [ ] Add a new feature
- [ ] Fix a bug
- [ ] Refactor code
- [ ] Update an existing feature
- [ ] Remove a feature
- [ ] Other

## Description

- このプルリクで何をしたのかを簡潔に書く
39 changes: 39 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# GitHub Actions で CI を実行
# Ruff での静的解析とフォーマットチェックを行う

name: CI

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
Ruff:
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4

- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
cd app-template
python -m pip install --upgrade pip
pip install -r requirements-dev.lock

- name: Lint with Ruff
run: |
cd app-template
ruff check src/ --output-format=github

- name: Format with Ruff
run: |
cd app-template
ruff format src/ --check
18 changes: 18 additions & 0 deletions .github/workflows/pr-auto-approve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: PR Auto Approve
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
approve:
if: |
github.event.pull_request.user.login == github.repository_owner
&& ! github.event.pull_request.draft
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: hmarr/auto-approve-action@v4
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# local
.DS_Store
.github/workflows/coverage.yaml
*/.ruff_cache

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-json
- id: check-toml
- id: detect-private-key
- id: pretty-format-json
args: [--autofix]

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.1
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format

# - repo: local
# hooks:
# - id: pytest
# name: Run pytest
# entry: cd llm-server && rye run python -m pytest .
# language: system
# types: [python]
10 changes: 10 additions & 0 deletions app-template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# python generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info

# venv
.venv
1 change: 1 addition & 0 deletions app-template/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.2
3 changes: 3 additions & 0 deletions app-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# app-template

Describe your project here.
56 changes: 56 additions & 0 deletions app-template/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[project]
name = "app-template"
version = "0.1.0"
description = "Add your description here"
authors = [
{ name = "Shibuya Keita"}
]
dependencies = [
"fastapi>=0.111.0",
]
readme = "README.md"
requires-python = ">= 3.8"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = [
"ruff>=0.5.0",
"pytest>=8.2.2",
]

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src"]

[tool.ruff]
line-length = 100
target-version = "py312"
exclude = ["alembic"]

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"ARG001", # unused arguments in functions
]
ignore = [
"E501", # line too long, handled by black
"B008", # do not perform function calls in argument defaults
"W191", # indentation contains tabs
"B904", # Allow raising exceptions without from e, for HTTPException
]

[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true
Loading