Skip to content

Commit 5aae7cf

Browse files
29rouclaudeCopilot
authored
OpenJij 開発環境の近代化 (#489)
# OpenJij開発環境の近代化 ## 📋 概要 OpenJijの開発環境を近代化しました。依存関係管理、ビルドシステムのモダン化等が含まれます。 **主要成果**: - uvの導入 - scikit-build-coreへの移行 - ruffの導入 ## ✨ 期待される改善効果 ### 🚀 開発効率の向上 - **環境構築時間**: uvを使用することで依存関係解決の高速化 - **品質チェック**: ruffによる簡単化 - **依存関係管理**: `uv.lock` によるバージョン固定化 ### 🛠️ 開発体験の改善 - **統一コマンド**: `uv run` による一貫した実行環境 - **設定の統合**: pyproject.toml への集約 ## 🔍 主要な技術変更 ### 1. UV移行による依存関係管理の現代化 **変更内容**: - PEP 735準拠の dependency-groups 構造を採用 - uv.lock による確定的な依存関係管理 - pip-tools廃止(setup.cfg, setup.py, *.inファイルの廃止) **技術的詳細**: ```toml [dependency-groups] build = ["build>=1.2"] test = ["pytest>=8.0", "pytest-mock", "pytest-cov", "pytest-randomly", "pytest-spec", "coverage", "scipy"] format = ["ruff>=0.5.0"] dev = [ {include-group = "build"}, {include-group = "test"}, {include-group = "format"} ] ``` ### 2. ビルドシステムの現代化 **変更内容**: - scikit-build-core移行によるPEP 517/518完全対応 - setup.py/setup.cfg廃止、pyproject.toml統合 ### 3. 開発ツールの統合 **変更内容**: - ruffによるlint/format統一 - pre-commit廃止、複数ツールから単一ツールへ - flake8 + black + isort → ruff統合 ## ⚠️ 破壊的変更と対応 ### 変更が必要な開発コマンド | 旧コマンド | 新コマンド | |-----------|----------| | `pip install -e .[dev]` | `uv sync --group dev` | | `black . && isort . && flake8` | `uv run ruff check . && uv run ruff format .` | | `pip-compile dev-requirements.in` | `uv lock` | | `pytest tests/` | `uv run pytest tests/` | ## 📚 技術的背景 ### 採用した標準・ツール - **PEP 735**: Dependency Groups - **PEP 517/518**: ビルドシステム標準 - **scikit-build-core**: 現代的なC++統合 - **uv**: 高速なPythonパッケージマネージャー - **ruff**: 高性能なPythonリンター・フォーマッターツール ## 🔗 関連リソース - [PEP 735: Dependency Groups](https://peps.python.org/pep-0735/) - [UV公式ドキュメント](https://docs.astral.sh/uv/) - [scikit-build-core](https://scikit-build-core.readthedocs.io/) - [ruff](https://docs.astral.sh/ruff/) - [cimod実装例](Jij-Inc/cimod#195) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e249246 commit 5aae7cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1298
-2223
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,27 @@
11
version: 2
2-
2+
33
updates:
4-
- package-ecosystem: docker
5-
directory: "/"
6-
schedule:
7-
interval: "daily"
8-
allow:
4+
- package-ecosystem: docker
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
allow:
99
# Allow both direct and indirect updates for all packages
1010
- dependency-type: "all"
11-
- package-ecosystem: github-actions
12-
directory: "/"
13-
schedule:
14-
interval: "daily"
15-
allow:
11+
- package-ecosystem: github-actions
12+
directory: "/"
13+
schedule:
14+
interval: "daily"
15+
allow:
1616
# Allow both direct and indirect updates for all packages
1717
- dependency-type: "all"
18-
19-
- package-ecosystem: pip
20-
directory: "/setup.py"
21-
insecure-external-code-execution: allow
22-
versioning-strategy: auto
23-
schedule:
24-
interval: "daily"
25-
allow:
26-
# Allow both direct and indirect updates for all packages
27-
- dependency-type: "all"
28-
labels:
29-
- "python"
30-
- "dependencies"
31-
32-
- package-ecosystem: pip
33-
directory: "/"
34-
insecure-external-code-execution: allow
35-
versioning-strategy: auto
36-
schedule:
37-
interval: "daily"
38-
allow:
18+
19+
- package-ecosystem: pip
20+
directory: "/"
21+
insecure-external-code-execution: allow
22+
versioning-strategy: auto
23+
schedule:
24+
interval: "daily"
25+
allow:
3926
# Allow both direct and indirect updates for all packages
4027
- dependency-type: "all"

.github/workflows/buid-doc.yml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
cancel-in-progress: false
1414

1515
env:
16-
Python_Version: '3.10'
16+
Python_Version: '3.12'
1717

1818
jobs:
1919
build_docs:
@@ -23,43 +23,18 @@ jobs:
2323
contents: write
2424
steps:
2525
- uses: actions/checkout@v4
26-
- uses: actions/setup-python@v5
27-
name: Install Python
26+
- name: Install uv and set Python version
27+
uses: astral-sh/setup-uv@v6
2828
with:
2929
python-version: ${{env.Python_Version}}
30-
- name: Python Cache Key
31-
shell: bash
32-
run: |
33-
echo $(which python) > /tmp/python_version.txt
34-
- name: Get pip cache dir
35-
shell: bash
36-
id: pip-cache
37-
run: |
38-
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
39-
- name: Pip-Tools
40-
shell: bash
41-
run: |
42-
python -m pip install pip-tools
43-
pip-compile
44-
pip-compile dev-requirements.in
45-
- name: pip cache
46-
uses: actions/cache@v4
47-
with:
48-
path: ${{ steps.pip-cache.outputs.dir }}
49-
key: ${{ runner.os }}-pip-${{ hashFiles('/tmp/python_version.txt') }}
50-
restore-keys: |
51-
${{ runner.os }}-pip-
52-
- name: Update
53-
run: |
54-
pip install --upgrade pip wheel setuptools build cmake ninja
5530
- name: Install Dependencies
5631
shell: bash
5732
run: |
5833
set -eux
59-
pip-sync requirements.txt dev-requirements.txt
34+
uv sync --locked --group build
6035
- name: Install Dep
6136
run: |
62-
pip install typing-extensions
37+
uv pip install typing-extensions
6338
sudo apt-get install -y libeigen3-dev lcov graphviz mscgen dia pdf2svg astyle
6439
sudo apt-get install -y doxygen doxygen-doxyparse fonts-liberation python3-breathe
6540
- name: Prepare
@@ -86,11 +61,6 @@ jobs:
8661
run: |
8762
set -eux
8863
cp -r ./build/html/* ./public/
89-
- name: du -a
90-
shell: bash
91-
if: always()
92-
run: |
93-
du -a
9464
- name: Prepare tag
9565
id: prepare_tag
9666
if: startsWith(github.ref, 'refs/tags/')
@@ -107,7 +77,7 @@ jobs:
10777
allow_empty_commit: true
10878
publish_dir: ./public
10979
publish_branch: main
110-
external_repository: OpenJij/OpenJij-Reference-Page
80+
external_repository: Jij-Inc/OpenJij-Reference-Page
11181
destination_dir: www
11282
user_name: 'github-actions[bot]'
11383
user_email: 'github-actions[bot]@users.noreply.github.com'

.github/workflows/build_and_upload.yaml

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
17-
- uses: actions/setup-python@v5
18-
name: Install Python
17+
- name: Install uv and set Python version
18+
uses: astral-sh/setup-uv@v6
1919
with:
20-
python-version: '3.11'
20+
python-version: '3.12'
2121
- name: Install dependencies
2222
run: |
23-
pip install --upgrade pip wheel setuptools build
23+
uv sync --locked --group build
2424
- name: Build sdist
2525
run: |
26-
python -m build --sdist --outdir ./dist
26+
uv run python -m build --sdist --outdir ./dist
2727
- uses: actions/upload-artifact@v4
2828
with:
2929
name: wheel-sdist
@@ -39,9 +39,6 @@ jobs:
3939
fail-fast: false
4040
matrix:
4141
include:
42-
- artifact: wheel-linux_x86_64_python38
43-
python: /opt/python/cp38-cp38/bin/python
44-
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
4542
- artifact: wheel-linux_x86_64_python39
4643
python: /opt/python/cp39-cp39/bin/python
4744
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
@@ -54,6 +51,9 @@ jobs:
5451
- artifact: wheel-linux_x86_64_python312
5552
python: /opt/python/cp312-cp312/bin/python
5653
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
54+
- artifact: wheel-linux_x86_64_python313
55+
python: /opt/python/cp313-cp313/bin/python
56+
container: ghcr.io/openjij/openjij-builder-minimum-manylinux_2_28_x86_64:latest
5757

5858
steps:
5959
- uses: actions/checkout@v4
@@ -64,29 +64,12 @@ jobs:
6464
ls /opt/python
6565
${{matrix.python}} --version > python_version.txt
6666
cat python_version.txt
67-
- name: Pip-Tools
68-
shell: bash
69-
run: |
70-
set -eux
71-
${{matrix.python}} -m pip install pip-tools
72-
${{matrix.python}} -m piptools compile setup.cfg
73-
${{matrix.python}} -m piptools compile build-requirements.in
74-
- uses: actions/cache@v4
75-
with:
76-
path: |
77-
~/.cache/pip
78-
/var/cache/dnf/
79-
key: ${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('build-requirements.txt') }}
80-
restore-keys: |
81-
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('build-requirements.txt') }}
82-
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}-${{ hashFiles('requirements.txt') }}
83-
${{ runner.os }}-intel-${{ hashFiles('python_version.txt') }}
84-
${{ runner.os }}-intel-
8567
- name: Install Dependencies
8668
shell: bash
8769
run: |
8870
set -eux
89-
${{matrix.python}} -m piptools sync requirements.txt build-requirements.txt
71+
${{matrix.python}} -m pip install --upgrade pip
72+
${{matrix.python}} -m pip install --upgrade build auditwheel
9073
- name: Build
9174
run: |
9275
set -x
@@ -117,9 +100,6 @@ jobs:
117100
run: |
118101
set -x
119102
source /opt/intel/oneapi/setvars.sh --force --config="/tmp/tmp/config.txt"
120-
${{matrix.python}} -m auditwheel -h
121-
${{matrix.python}} -m auditwheel show -h
122-
${{matrix.python}} -m auditwheel repair -h
123103
du -ah ./dist
124104
cd dist
125105
for f in *.whl; do ${{matrix.python}} -m auditwheel show $f; done
@@ -140,10 +120,6 @@ jobs:
140120
fail-fast: false
141121
matrix:
142122
include:
143-
- artifact: wheel-linux_aarch64_python38
144-
os: ubuntu-latest
145-
arch: aarch64
146-
CIBW_BUILD: cp38-manylinux_aarch64
147123
- artifact: wheel-linux_aarch64_python39
148124
os: ubuntu-latest
149125
arch: aarch64
@@ -160,6 +136,10 @@ jobs:
160136
os: ubuntu-latest
161137
arch: aarch64
162138
CIBW_BUILD: cp312-manylinux_aarch64
139+
- artifact: wheel-linux_aarch64_python313
140+
os: ubuntu-latest
141+
arch: aarch64
142+
CIBW_BUILD: cp313-manylinux_aarch64
163143
steps:
164144
- uses: actions/checkout@v4
165145
- name: Set up QEME
@@ -175,7 +155,6 @@ jobs:
175155
uses: pypa/cibuildwheel@v2.22.0
176156
env:
177157
CIBW_BUILD: ${{matrix.CIBW_BUILD}}
178-
CIBW_SKIP: "cp313-*"
179158
CIBW_ENVIRONMENT: ""
180159
CIBW_PLATFORM: linux
181160
CIBW_ARCHS: ${{matrix.arch}}
@@ -189,7 +168,7 @@ jobs:
189168
CIBW_BEFORE_BUILD_LINUX: >
190169
source scl_source enable gcc-toolset-11 &&
191170
pip install 'pybind11<3' cmake ninja
192-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.13"
171+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
193172
- uses: actions/upload-artifact@v4
194173
with:
195174
name: ${{matrix.artifact}}
@@ -216,10 +195,10 @@ jobs:
216195
- name: Build wheels on macos x86_64
217196
uses: pypa/cibuildwheel@v2.22.0
218197
env:
219-
CIBW_SKIP: "cp313-* pp*"
198+
CIBW_SKIP: "pp*"
220199
CIBW_PLATFORM: macos
221200
CIBW_ARCHS: x86_64
222-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.13"
201+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
223202
CIBW_ENVIRONMENT: >
224203
MACOSX_DEPLOYMENT_TARGET=${{ matrix.MACOSX_DEPLOYMENT_TARGET }}
225204
- uses: actions/upload-artifact@v4
@@ -248,10 +227,10 @@ jobs:
248227
- name: Build wheels on macos arm64
249228
uses: pypa/cibuildwheel@v2.22.0
250229
env:
251-
CIBW_SKIP: "cp313-* pp*"
230+
CIBW_SKIP: "pp*"
252231
CIBW_PLATFORM: macos
253232
CIBW_ARCHS: arm64
254-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.13"
233+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
255234
CIBW_ENVIRONMENT: "MACOSX_DEPLOYMENT_TARGET=${{ matrix.MACOSX_DEPLOYMENT_TARGET }}"
256235
- uses: actions/upload-artifact@v4
257236
with:
@@ -276,24 +255,6 @@ jobs:
276255
- name: Add msbuild to PATH
277256
if: ${{ matrix.os == 'windows-latest'}}
278257
uses: microsoft/setup-msbuild@v2.0.0
279-
- name: Prepare Cache
280-
if: ${{ matrix.os == 'windows-latest'}}
281-
shell: bash
282-
run: |
283-
set -eux
284-
ls C:/vcpkg
285-
MSBuild.exe -version > msbuild_version.txt
286-
cat msbuild_version.txt
287-
- name: Cache vcpkg
288-
uses: actions/cache@v4
289-
if: ${{ matrix.os == 'windows-latest'}}
290-
with:
291-
path: |
292-
C:/Users/runneradmin/AppData/Local/vcpkg/archives
293-
key: ${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
294-
restore-keys: |
295-
${{ matrix.os }}-vcpkg-${{ hashFiles('msbuild_version.txt') }}
296-
${{ matrix.os }}-vcpkg
297258
- name: Install Dependency
298259
shell: bash
299260
run: |
@@ -307,11 +268,10 @@ jobs:
307268
- name: Build wheels on ${{ matrix.CIBW_PLATFORM }} ${{matrix.arch}}
308269
uses: pypa/cibuildwheel@v2.22.0
309270
env:
310-
CIBW_SKIP: "cp313-*"
311271
CIBW_ENVIRONMENT: ${{ matrix.CIBW_ENVIRONMENT }}
312272
CIBW_PLATFORM: ${{ matrix.CIBW_PLATFORM }}
313273
CIBW_ARCHS: ${{matrix.arch}}
314-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.13"
274+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9,<3.14"
315275

316276
- uses: actions/upload-artifact@v4
317277
with:

0 commit comments

Comments
 (0)