Skip to content

Commit 9d887d2

Browse files
authored
✨ update template to poetry v2
1 parent 1cb0735 commit 9d887d2

File tree

9 files changed

+82
-56
lines changed

9 files changed

+82
-56
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "Default Linux Universal",
3-
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
2+
"name": "Ubuntu",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
44
"features": {
5-
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
5+
"ghcr.io/devcontainers-extra/features/poetry:2": {},
6+
"ghcr.io/meaningful-ooo/devcontainer-features/fish:2": {}
67
},
78
"postCreateCommand": "poetry config virtualenvs.in-project true && poetry install && poetry run pre-commit install",
89
"customizations": {
910
"vscode": {
1011
"settings": {
1112
"python.analysis.diagnosticMode": "workspace",
12-
"ruff.organizeImports": false,
1313
"[python]": {
1414
"editor.defaultFormatter": "charliermarsh.ruff",
1515
"editor.codeActionsOnSave": {
@@ -46,7 +46,6 @@
4646
"extensions": [
4747
"ms-python.python",
4848
"ms-python.vscode-pylance",
49-
"ms-python.isort",
5049
"charliermarsh.ruff",
5150
"EditorConfig.EditorConfig",
5251
"esbenp.prettier-vscode"

.github/actions/setup-python/action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ inputs:
55
python-version:
66
description: Python version
77
required: false
8-
default: "3.10"
8+
default: "3.13"
9+
args:
10+
description: Additional arguments to pass to the install command
11+
required: false
912

1013
runs:
1114
using: "composite"
@@ -14,11 +17,10 @@ runs:
1417
run: pipx install poetry
1518
shell: bash
1619

17-
- uses: actions/setup-python@v4
20+
- uses: actions/setup-python@v5
1821
with:
1922
python-version: ${{ inputs.python-version }}
20-
architecture: "x64"
2123
cache: "poetry"
2224

23-
- run: poetry install
25+
- run: poetry install --all-extras
2426
shell: bash

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
groups:
8+
actions:
9+
patterns:
10+
- "*"
11+
12+
- package-ecosystem: github-actions
13+
directory: "/.github/actions/setup-python"
14+
schedule:
15+
interval: daily
16+
groups:
17+
actions:
18+
patterns:
19+
- "*"

.github/workflows/pyright.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Pyright Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
pyright:
11+
name: Pyright Lint
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Python environment
18+
uses: ./.github/actions/setup-python
19+
20+
- name: Run Pyright
21+
uses: jakebailey/pyright-action@v2
22+
with:
23+
pylance-version: latest-release

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
id-token: write
1313
contents: write
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616

1717
- name: Setup Python environment
1818
uses: ./.github/actions/setup-python

.github/workflows/ruff.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
name: Ruff Lint
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515

1616
- name: Run Ruff Lint
17-
uses: chartboost/ruff-action@v1
17+
uses: astral-sh/ruff-action@v3

.gitignore

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ----- Project -----
22

3-
# Created by https://www.toptal.com/developers/gitignore/api/python,node,visualstudiocode,jetbrains,macos,windows,linux
4-
# Edit at https://www.toptal.com/developers/gitignore?templates=python,node,visualstudiocode,jetbrains,macos,windows,linux
3+
# Created by https://www.toptal.com/developers/gitignore/api/node,linux,macos,python,windows,jetbrains,visualstudiocode
4+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,linux,macos,python,windows,jetbrains,visualstudiocode
55

66
### JetBrains ###
77
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
@@ -467,14 +467,19 @@ cython_debug/
467467
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
468468
poetry.toml
469469

470+
# ruff
471+
.ruff_cache/
472+
473+
# LSP config files
474+
pyrightconfig.json
470475

471476
### VisualStudioCode ###
472477
.vscode/*
473-
!.vscode/settings.json
474-
!.vscode/tasks.json
475-
!.vscode/launch.json
476-
!.vscode/extensions.json
477-
!.vscode/*.code-snippets
478+
# !.vscode/settings.json
479+
# !.vscode/tasks.json
480+
# !.vscode/launch.json
481+
# !.vscode/extensions.json
482+
# !.vscode/*.code-snippets
478483

479484
# Local History for Visual Studio Code
480485
.history/
@@ -513,4 +518,4 @@ $RECYCLE.BIN/
513518
# Windows shortcuts
514519
*.lnk
515520

516-
# End of https://www.toptal.com/developers/gitignore/api/python,node,visualstudiocode,jetbrains,macos,windows,linux
521+
# End of https://www.toptal.com/developers/gitignore/api/node,linux,macos,python,windows,jetbrains,visualstudiocode

.pre-commit-config.yaml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,12 @@ repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
1010
rev: v0.12.7
1111
hooks:
12-
- id: ruff
12+
- id: ruff-check
1313
args: [--fix, --exit-non-zero-on-fix]
1414
stages: [pre-commit]
1515
- id: ruff-format
1616
stages: [pre-commit]
1717

18-
- repo: https://github.com/pycqa/isort
19-
rev: 6.0.1
20-
hooks:
21-
- id: isort
22-
stages: [pre-commit]
23-
24-
- repo: https://github.com/pre-commit/mirrors-prettier
25-
rev: v4.0.0-alpha.8
26-
hooks:
27-
- id: prettier
28-
stages: [pre-commit]
29-
3018
- repo: https://github.com/nonebot/nonemoji
3119
rev: v0.1.4
3220
hooks:

pyproject.example.toml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
1-
[tool.poetry]
1+
[project]
22
name = "Project Name"
33
version = "0.1.0"
44
description = ""
5-
authors = ["Your Name <[email protected]>"]
5+
authors = [
6+
{ name = "Your Name", email = "[email protected]" }
7+
]
68
license = "MIT"
79
readme = "README.md"
8-
homepage = ""
9-
repository = ""
10-
documentation = ""
1110
keywords = []
1211
classifiers = []
12+
requires-python = ">=3.9, <4.0"
13+
dependencies = []
1314

14-
[tool.poetry.dependencies]
15-
python = "^3.8"
15+
[project.optional-dependencies]
1616

1717
[tool.poetry.group.dev.dependencies]
18-
ruff = "^0.3.0"
19-
isort = "^5.10.1"
18+
ruff = "^0.12.0"
2019
nonemoji = "^0.1.2"
21-
pre-commit = "^3.1.0"
22-
23-
[tool.isort]
24-
profile = "black"
25-
line_length = 88
26-
length_sort = true
27-
skip_gitignore = true
28-
force_sort_within_sections = true
29-
extra_standard_library = ["typing_extensions"]
20+
pre-commit = "^4.0.0"
3021

3122
[tool.ruff]
3223
line-length = 88
@@ -40,7 +31,7 @@ select = [
4031
"F", # Pyflakes
4132
"W", # pycodestyle warnings
4233
"E", # pycodestyle errors
43-
# "I", # isort
34+
"I", # isort
4435
"UP", # pyupgrade
4536
"ASYNC", # flake8-async
4637
"B", # flake8-bugbear
@@ -63,7 +54,6 @@ ignore = [
6354
]
6455

6556
[tool.ruff.lint.isort]
66-
length-sort = true
6757
force-sort-within-sections = true
6858
extra-standard-library = ["typing_extensions"]
6959

@@ -75,14 +65,14 @@ mark-parentheses = false
7565
keep-runtime-typing = true
7666

7767
[tool.pyright]
68+
pythonVersion = "3.9"
69+
pythonPlatform = "All"
70+
7871
typeCheckingMode = "standard"
7972
reportPrivateImportUsage = false
8073
reportShadowedImports = false
8174
disableBytesTypePromotions = true
8275

83-
pythonPlatform = "All"
84-
pythonVersion = "3.8
85-
8676
[build-system]
8777
requires = ["poetry_core>=1.0.0"]
8878
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)