Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
e1feeee
doc: add gitignore
nglcobdai Jul 28, 2023
8d2f02f
doc: update setting.json
nglcobdai Aug 8, 2023
53365b9
doc: Dockerfile init
nglcobdai Aug 17, 2023
5091795
doc: update Dockerfile
nglcobdai Aug 19, 2023
c573401
doc: update poetry
nglcobdai Aug 19, 2023
1f4db5a
doc: .github
nglcobdai Aug 21, 2023
06e60d1
doc: add PYTHONPATH in Dockerfile
nglcobdai Aug 21, 2023
2a1c470
feat: main.py
nglcobdai Aug 21, 2023
5bff889
doc: add .devcondainer
nglcobdai Aug 25, 2023
3fd76f0
Merge pull request #2 from nglcobdai/feature/1_container_extension
nglcobdai Aug 25, 2023
6018188
doc: github workflow
nglcobdai Aug 26, 2023
f21513d
fix: poetry install in github workflow
nglcobdai Aug 26, 2023
0e66803
fix: poetry install
nglcobdai Aug 26, 2023
98bd87a
feat: code-review github workflow
nglcobdai Aug 27, 2023
b38d13a
fix: lint.yml
nglcobdai Aug 27, 2023
76ecf4a
fix: code-review.yml
nglcobdai Aug 27, 2023
c1ddd53
style: github workflow name
nglcobdai Aug 27, 2023
602337c
fix: code-review install flake8
nglcobdai Aug 27, 2023
68fc0df
fix: code-review.yml
nglcobdai Aug 27, 2023
fd2b919
fix: code-review.yml Approve
nglcobdai Aug 27, 2023
17d4c71
fix: code-review.yml
nglcobdai Aug 27, 2023
51a2dcb
fix: 組み込みの ${{ secrets.GITHUB_TOKEN }} トークンを使用
nglcobdai Aug 27, 2023
4dbca4a
fix: code-review
nglcobdai Aug 27, 2023
44215af
fix: code-review.yml
nglcobdai Aug 27, 2023
1c37c92
fix: code-review.yml
nglcobdai Aug 27, 2023
5bf62a1
fix: code-review.yml
nglcobdai Aug 27, 2023
62427c7
fix: use hmarr/auto-approve-action
nglcobdai Aug 27, 2023
f8d0e32
fix: AUTO_APPROVE token
nglcobdai Aug 27, 2023
ac0dea1
fix: use andymckay/labeler@master
nglcobdai Aug 27, 2023
5d780b1
fix: add permissions
nglcobdai Aug 27, 2023
997a2e8
fix: コードレビューではlinterのみ
nglcobdai Aug 28, 2023
73832dd
fix: push時のlinterは停止
nglcobdai Aug 28, 2023
420f14d
Merge pull request #4 from nglcobdai/feature/3_github_workflow
nglcobdai Aug 28, 2023
f8989e5
doc: add flake8 in devcontainer.json
nglcobdai Aug 29, 2023
a2a3991
style: update setting.json
nglcobdai Aug 29, 2023
f54a502
doc: 環境変数の整理
nglcobdai Aug 30, 2023
39ea1b5
fix: setup.cfg
nglcobdai Aug 30, 2023
0a148c5
Merge pull request #7 from nglcobdai/feature/5_env
nglcobdai Aug 30, 2023
7cf9e1f
doc: code spell checker
nglcobdai Aug 31, 2023
592840b
Merge pull request #9 from nglcobdai/feature/5_env
nglcobdai Aug 31, 2023
ceb3c37
doc: update poetry
nglcobdai Sep 27, 2023
9b2ea0f
doc: remove lint CI
nglcobdai Sep 27, 2023
55d7659
doc: update .github
nglcobdai Sep 27, 2023
7408ce0
doc: update .env
nglcobdai Sep 27, 2023
0e2dc0d
doc: update .gitignore
nglcobdai Sep 27, 2023
81d0059
doc: remove necessary comment
nglcobdai Sep 27, 2023
afa1daf
Merge pull request #13 from nglcobdai/feature/12_update_poetry_env
nglcobdai Sep 27, 2023
fb63fb2
fix: jupyter notebook setting
nglcobdai Sep 27, 2023
5c2882a
Merge pull request #15 from nglcobdai/hotfix/14_jupyternotebook
nglcobdai Sep 27, 2023
1feb5cb
doc: update README
nglcobdai Oct 21, 2023
ed53b5c
Merge pull request #16 from nglcobdai/feature/10_readme
nglcobdai Oct 21, 2023
7f45556
fix: Dockerfile
nglcobdai May 7, 2024
5b76943
fix: delete devcontainer
nglcobdai May 7, 2024
1b070df
style: add line
nglcobdai May 7, 2024
d922ab1
Merge pull request #17 from nglcobdai/fix/README
nglcobdai May 7, 2024
fb67003
doc: remove .cspell
nglcobdai Aug 30, 2024
032bd8a
fix: CI code-review
nglcobdai Aug 30, 2024
8a47be8
fix: dockerfile
nglcobdai Aug 30, 2024
39aad38
Merge pull request #19 from nglcobdai/bugfix/import
nglcobdai Aug 30, 2024
aa1319a
feat: pytest
nglcobdai Aug 30, 2024
ecee996
fix: pytest CI
nglcobdai Aug 30, 2024
fe8c682
fix: pytest CI
nglcobdai Aug 30, 2024
3c92fa3
fix: pytest CI
nglcobdai Aug 30, 2024
b9bda92
doc: update README
nglcobdai Aug 30, 2024
f1ea1ae
Merge pull request #20 from nglcobdai/feature/pytest
nglcobdai Aug 30, 2024
4a6a71b
Create LICENSE
nglcobdai Aug 30, 2024
41606c5
Merge pull request #21 from nglcobdai/nglcobdai-patch-1
nglcobdai Aug 30, 2024
c32651a
doc: sphinx
nglcobdai Dec 29, 2024
102f60e
Merge pull request #26 from nglcobdai/feature/sphinx
nglcobdai Dec 29, 2024
0fd41e5
v0.0.1
nglcobdai Dec 29, 2024
e91c320
Merge pull request #27 from nglcobdai/release/v0.0.1
nglcobdai Dec 29, 2024
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
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROJECT_NAME=project-template
DOCKER_SHM_SIZE=4g
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: 🐛 バグの報告
about: バグを見つけた場合はこちら
---

## 🐛 概要

## 📸 スクリーンショット

## 👀 再現手順

## 🎨 期待する挙動

## 📦️ 環境

- macOS / Windows / Linux / iOS / Android
- Chrome / Safari / Firefox / Edge

## 💡 解決策

## ✅ タスク
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: 🚀 仕様変更
about: 仕様変更はこちら
---

## ✨ 概要

## 🔥 ゴール

## ✅ タスク
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: ✨ 新機能について
about: 新機能についてはこちら
---

## ✨ 概要

## 🔥 ゴール

## 📷 スクリーンショット

## 📄 参考資料

## ✅ タスク
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/survey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: 🔎 調査
about: 調査周りはこちら
---

## 🔎 概要

## ✅ タスク
9 changes: 9 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 🔨 変更内容

## 💡 特筆事項

## 📸 スクリーンショット

## ✅ 解決するイシュー

## 🤝 関連するイシュー
34 changes: 34 additions & 0 deletions .github/workflows/code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 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: Code Review

on:
pull_request:
types: [opened, synchronize, reopened, edited, ready_for_review]

permissions:
contents: read

jobs:
code-review:
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 pip
run: python -m pip install --upgrade pip
- name: Install poetry
run: pip install poetry
- name: poetry install
run: poetry install --no-root
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
73 changes: 73 additions & 0 deletions .github/workflows/deploy-document.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Workflow for deploying Sphinx documentation built within a Docker container to GitHub Pages
name: Deploy Sphinx Document to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Set permissions for the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping queued runs, but do not cancel in-progress ones
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the repository
- uses: actions/checkout@v3

# Step 2: Install Docker Compose
- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

# Step 3: Create an .env file if required
- name: Make .env file
run: |
if [ -f .env.example ]; then
cp .env.example .env
fi

# Step 4: Build and Start the containers
- name: Build and Start Docker Containers
run: |
docker-compose -f docker-compose.yml --env-file .env up --build -d

# Step 5: Run commands inside the Docker container to build Sphinx documentation
- name: Build Sphinx Documentation inside Container
run: |
docker-compose -f docker-compose.yml --env-file .env exec -T dev bash -c "
cd docs && \
poetry run make dirhtml"

# Step 6: Set up Pages configuration for deployment
- name: Setup Pages
uses: actions/configure-pages@v3

# Step 7: Upload the generated HTML files as artifacts for deployment
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: "./docs/build"

# Step 8: Deploy to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
40 changes: 40 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: pytest

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read

jobs:
pytest:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
environment:
name: development

steps:
- uses: actions/checkout@v3

- name: Install Docker Compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Make .env file
run: |
cp .env.example .env

- name: Build the containers & Start the containers
run: |
docker-compose -f docker-compose.yml --env-file .env up --build -d

- name: Test with pytest
run: |
docker-compose -f docker-compose.yml --env-file .env exec -T project pytest

- name: Clean up
if: always()
run: |
docker-compose -f docker-compose.yml --env-file .env down
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Byte-compiled / optimized / DLL files
__pycache__/

# Jupyter Notebook
.ipynb_checkpoints

# Environments
.env

# output
.DS_Store

# Sphinx documentation
docs/build/**
45 changes: 29 additions & 16 deletions .vscode/setting.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
{
"editor.defaultFormatter": null,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.lintOnSave": true,
"python.formatting.provider": "black",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"[linting]": {
"enabled": true,
"flake8Enabled": true,
"pylintEnabled": false,
"lintOnSave": true
},
"[editor]": {
"formatOnSave": true,
"formatOnPaste": true,
"formatOnType": true,
"defaultFormatter": "ms-python.black-formatter"
},
"formatting.provider": "black",
"sortImports.path": "isort",
"analysis.extraPaths": [
"/usr/local/lib/python3.9/site-packages",
"/workspace/"
],
"languageServer": "Pylance"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"

"jsonc.editor.defaultFormatter": "esbenp.prettier-vscode",
"markdown.editor.defaultFormatter": "esbenp.prettier-vscode",
"cSpell.customDictionaries": {
"custom-dictionary-workspace": {
"name": "custom-dictionary-workspace",
"path": "${workspaceFolder:python}/.cspell/custom-dictionary-workspace.txt",
"addWords": true,
"scope": "workspace"
}
}
}
56 changes: 56 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM ubuntu:22.04

ENV LANG=C.UTF-8 \
LANGUAGE=en_US \
PYTHONPATH="/root/workspace/src:$PYTHONPATH" \
DEBIAN_FRONTEND=noninteractive \
TZ=Asia/Tokyo

# Pythonのインストール
RUN apt-get update && apt-get install -y python3.10 python3-pip \
&& ln -s /usr/bin/python3.10 /usr/bin/python \
&& rm -rf /var/lib/apt/lists/*

# システム依存のライブラリをインストール
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*

# jupyter notebookの設定
# pipをアップグレードし、必要なパッケージをインストール
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir notebook==6.4.6 jupyter_contrib_nbextensions jupyter_nbextensions_configurator

## Jupyterのnbextensionsをインストールし、nbextensions_configuratorを有効化
RUN jupyter contrib nbextension install --system && \
jupyter nbextensions_configurator enable --system

## 特定のnbextensionsを有効にする
RUN jupyter nbextension enable codefolding/main && \
jupyter nbextension enable contrib_nbextensions_help_item/main && \
jupyter nbextension enable code_font_size/code_font_size && \
jupyter nbextension enable collapsible_headings/main && \
jupyter nbextension enable move_selected_cells/main && \
jupyter nbextension enable printview/main

WORKDIR /root/workspace

# Poetryのインストールと依存関係のインストール
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --upgrade poetry

# pyproject.toml、poetry.lock、poetry.tomlをコピーする
COPY pyproject.toml poetry.lock poetry.toml $WORKDIR/

# Clear cache to free up space
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN poetry install --no-root

# Jupyter notebookの設定
RUN python -m ipykernel install --user --name python3.10 --display-name "Python 3.10"

# Clear cache to free up space
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 KodaiYamashita

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# python
# python-template

This is a template repository for Python projects.

| | |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **License** | ![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) |
| **Environment** | ![Python](https://img.shields.io/badge/-Python_3.10-F9DC3E.svg?logo=python&style=flat) ![Poetry](https://img.shields.io/badge/-Poetry-2c2d72.svg?logo=python&style=flat) |

## Documentation

Refer to the [Official Documentation](https://nglcobdai.github.io/python-template/) for Installation, Quick Start, and API Reference.
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.3"
services:
project:
build:
context: .
dockerfile: ./Dockerfile
volumes:
- .:/root/workspace
env_file:
- .env
tty: true # retain container up
command: /bin/bash
shm_size: ${DOCKER_SHM_SIZE}
Loading
Loading