Skip to content

Commit 4cfae50

Browse files
authored
Merge pull request #5 from michelin/dev/jmlr_revision
JMLR MLOSS revision: capabilities docs, uv migration, paper sync
2 parents da68c76 + 759d738 commit 4cfae50

237 files changed

Lines changed: 11007 additions & 2351 deletions

File tree

Some content is hidden

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

.github/workflows/code-quality.yml

Lines changed: 55 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -2,171 +2,69 @@ name: Code Quality
22

33
on:
44
push:
5-
branches: [ main, dev/jmlr, feature/gpu_fix ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main, dev/jmlr, feature/gpu_fix ]
7+
branches: [main]
88

99
jobs:
10-
code-quality:
10+
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
14-
15-
- name: Set up Python 3.9
16-
uses: actions/setup-python@v4
17-
with:
18-
python-version: "3.9"
19-
20-
- name: Cache pip dependencies
21-
uses: actions/cache@v3
22-
with:
23-
path: ~/.cache/pip
24-
key: ${{ runner.os }}-pip-quality-${{ hashFiles('pyproject.toml') }}
25-
restore-keys: |
26-
${{ runner.os }}-pip-quality-
27-
${{ runner.os }}-pip-
28-
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade pip
32-
pip install -e ".[dev, security, linting]"
33-
# pip install ruff mypy bandit safety
34-
35-
- name: Check code formatting with Black
36-
run: |
37-
black --check --diff torchsom/ tests/
38-
39-
- name: Check import sorting with isort
40-
run: |
41-
isort --check-only --diff torchsom/ tests/
42-
43-
- name: Lint with Ruff
44-
run: |
45-
ruff check torchsom/ tests/ --output-format=github
46-
47-
- name: Type checking with MyPy
48-
run: |
49-
mypy torchsom/ --ignore-missing-imports --strict
50-
# mypy torchsom/
51-
continue-on-error: true
52-
53-
- name: Check for security issues with Bandit (library code)
54-
run: |
55-
bandit -r torchsom/ -f json -o bandit-report-library.json --skip B101,B311,B601
56-
continue-on-error: true
57-
58-
- name: Check for security issues with Bandit (tests)
59-
run: |
60-
bandit -r tests/ -f json -o bandit-report-tests.json --skip B101,B311,B601
61-
continue-on-error: true
62-
63-
# - name: Check for known security vulnerabilities
64-
# run: |
65-
# safety check --json --output safety-report.json
66-
# continue-on-error: true
67-
68-
- name: Upload security reports
69-
uses: actions/upload-artifact@v4
70-
if: always()
71-
with:
72-
name: security-reports
73-
path: |
74-
bandit-report-library.json
75-
bandit-report-tests.json
76-
# safety-report.json
13+
- uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v5
17+
18+
- name: Set up Python
19+
run: uv python install 3.12
20+
21+
- name: Sync dependencies
22+
run: uv sync --extra linting
23+
24+
- name: Ruff format check
25+
run: uv run ruff format --check torchsom/ tests/
26+
27+
- name: Ruff lint
28+
run: uv run ruff check torchsom/ tests/ --output-format=github
29+
30+
- name: Type checking with mypy
31+
run: uv run mypy torchsom/ --ignore-missing-imports
32+
continue-on-error: true
7733

7834
docstring-quality:
7935
runs-on: ubuntu-latest
8036
steps:
81-
- uses: actions/checkout@v4
82-
83-
- name: Set up Python 3.9
84-
uses: actions/setup-python@v4
85-
with:
86-
python-version: "3.9"
87-
88-
- name: Cache pip dependencies
89-
uses: actions/cache@v3
90-
with:
91-
path: ~/.cache/pip
92-
key: ${{ runner.os }}-pip-quality-${{ hashFiles('pyproject.toml') }}
93-
restore-keys: |
94-
${{ runner.os }}-pip-quality-
95-
${{ runner.os }}-pip-
96-
97-
- name: Install dependencies
98-
run: |
99-
python -m pip install --upgrade pip
100-
pip install -e ".[dev, docs]"
101-
# pip install pydocstyle interrogate
102-
103-
- name: Check docstring style
104-
run: |
105-
pydocstyle torchsom/ --convention=google
106-
continue-on-error: true
107-
108-
- name: Check docstring coverage
109-
run: |
110-
interrogate torchsom/ --verbose --ignore-init-method --ignore-magic --ignore-module --fail-under=80
111-
continue-on-error: true
112-
113-
complexity-analysis:
114-
runs-on: ubuntu-latest
115-
steps:
116-
- uses: actions/checkout@v4
117-
118-
- name: Set up Python 3.9
119-
uses: actions/setup-python@v4
120-
with:
121-
python-version: "3.9"
122-
123-
- name: Cache pip dependencies
124-
uses: actions/cache@v3
125-
with:
126-
path: ~/.cache/pip
127-
key: ${{ runner.os }}-pip-quality-${{ hashFiles('pyproject.toml') }}
128-
restore-keys: |
129-
${{ runner.os }}-pip-quality-
130-
${{ runner.os }}-pip-
131-
132-
- name: Install dependencies
133-
run: |
134-
python -m pip install --upgrade pip
135-
pip install -e ".[dev, linting]"
136-
# pip install radon
137-
138-
- name: Analyze code complexity
139-
run: |
140-
radon cc torchsom/ --show-complexity --min B
141-
radon mi torchsom/ --show --min B
142-
continue-on-error: true
143-
144-
check-dependencies:
37+
- uses: actions/checkout@v4
38+
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v5
41+
42+
- name: Set up Python
43+
run: uv python install 3.12
44+
45+
- name: Sync dependencies
46+
run: uv sync --extra docs
47+
48+
- name: Docstring coverage
49+
run: uv run interrogate torchsom/ --verbose --ignore-init-method --ignore-magic --ignore-module --fail-under=80
50+
continue-on-error: true
51+
52+
complexity:
14553
runs-on: ubuntu-latest
14654
steps:
147-
- uses: actions/checkout@v4
148-
149-
- name: Set up Python 3.9
150-
uses: actions/setup-python@v4
151-
with:
152-
python-version: "3.9"
153-
154-
- name: Cache pip dependencies
155-
uses: actions/cache@v3
156-
with:
157-
path: ~/.cache/pip
158-
key: ${{ runner.os }}-pip-quality-${{ hashFiles('pyproject.toml') }}
159-
restore-keys: |
160-
${{ runner.os }}-pip-quality-
161-
${{ runner.os }}-pip-
162-
163-
- name: Install pip-tools
164-
run: |
165-
python -m pip install --upgrade pip
166-
pip install -e ".[security]"
167-
# pip install pip-tools
168-
169-
- name: Check for dependency conflicts
170-
run: |
171-
pip-compile pyproject.toml --dry-run --verbose
172-
continue-on-error: true
55+
- uses: actions/checkout@v4
56+
57+
- name: Install uv
58+
uses: astral-sh/setup-uv@v5
59+
60+
- name: Set up Python
61+
run: uv python install 3.12
62+
63+
- name: Sync dependencies
64+
run: uv sync --extra linting
65+
66+
- name: Complexity analysis
67+
run: |
68+
uv run radon cc torchsom/ --show-complexity --min B
69+
uv run radon mi torchsom/ --show --min B
70+
continue-on-error: true

.github/workflows/docs.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,25 @@ name: Build and Deploy Docs
22

33
on:
44
push:
5-
branches: [main, dev/jmlr, feature/gpu_fix]
5+
branches: [main]
66

77
jobs:
88
build-and-deploy:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
1212

13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v5
15+
1316
- name: Set up Python
14-
uses: actions/setup-python@v4
15-
with:
16-
python-version: '3.9'
17+
run: uv python install 3.12
1718

18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install -e '.[dev, docs]'
22-
# pip install -e '.[dev]'
23-
# pip install sphinx sphinx-rtd-theme sphinx-autodoc-typehints
19+
- name: Sync dependencies
20+
run: uv sync --extra dev --extra docs
2421

2522
- name: Build docs
26-
run: |
27-
cd docs
28-
make html
23+
run: uv run sphinx-build -b html docs/source/ docs/build/html
2924

3025
- name: Deploy to GitHub Pages
3126
uses: peaceiris/actions-gh-pages@v3

.github/workflows/release.yml

Lines changed: 48 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
77

88
jobs:
99
test-before-release:
@@ -19,72 +19,60 @@ jobs:
1919
id-token: write
2020

2121
steps:
22-
- uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 0
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
2525

26-
- name: Set up Python
27-
uses: actions/setup-python@v4
28-
with:
29-
python-version: "3.9"
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v5
3028

31-
- name: Cache pip dependencies
32-
uses: actions/cache@v3
33-
with:
34-
path: ~/.cache/pip
35-
key: ${{ runner.os }}-pip-release-${{ hashFiles('pyproject.toml') }}
36-
restore-keys: |
37-
${{ runner.os }}-pip-release-
38-
${{ runner.os }}-pip-
29+
- name: Set up Python
30+
run: uv python install 3.12
3931

40-
- name: Install build dependencies
41-
run: |
42-
python -m pip install --upgrade pip
43-
pip install build twine commitizen pygithub
32+
- name: Sync release dependencies
33+
run: uv sync --extra release
4434

45-
- name: Generate CHANGELOG
46-
run: |
47-
if git log $(git describe --tags --abbrev=0)..HEAD --oneline | grep -q .; then
48-
cz changelog
49-
else
50-
echo "No new commits"
51-
fi
35+
- name: Generate CHANGELOG
36+
run: |
37+
if git log $(git describe --tags --abbrev=0)..HEAD --oneline | grep -q .; then
38+
uv run cz changelog
39+
else
40+
echo "No new commits"
41+
fi
5242
53-
- name: Commit updated CHANGELOG.md
54-
run: |
55-
git config user.name "github-actions[bot]"
56-
git config user.email "github-actions[bot]@users.noreply.github.com"
57-
git add CHANGELOG.md
58-
git commit -m "chore: update changelog for $GITHUB_REF_NAME" || echo "No changes to commit"
59-
git push origin HEAD:main
43+
- name: Commit updated CHANGELOG.md
44+
run: |
45+
git config user.name "github-actions[bot]"
46+
git config user.email "github-actions[bot]@users.noreply.github.com"
47+
git add CHANGELOG.md
48+
git commit -m "chore: update changelog for $GITHUB_REF_NAME" || echo "No changes to commit"
49+
git push origin HEAD:main
6050
61-
- name: Build package
62-
run: |
63-
python -m build
51+
- name: Build package
52+
run: uv build
6453

65-
- name: Check package
66-
run: |
67-
twine check dist/*
54+
- name: Check package
55+
run: uv run twine check dist/*
6856

69-
- name: Extract changelog
70-
id: changelog
71-
run: |
72-
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
73-
sed -n '/## \['"$GITHUB_REF_NAME"'\]/,/^## \[/{/^## \[/b;p}' CHANGELOG.md >> $GITHUB_ENV
74-
echo "EOF" >> $GITHUB_ENV
57+
- name: Extract changelog
58+
id: changelog
59+
run: |
60+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
61+
sed -n '/## \['"$GITHUB_REF_NAME"'\]/,/^## \[/{/^## \[/b;p}' CHANGELOG.md >> $GITHUB_ENV
62+
echo "EOF" >> $GITHUB_ENV
7563
76-
- name: Create Release with changelog notes
77-
uses: actions/create-release@v1.1.4
78-
env:
79-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80-
with:
81-
tag_name: ${{ github.ref_name }}
82-
release_name: Release ${{ github.ref }}
83-
body: ${{ env.RELEASE_NOTES }}
84-
draft: false
85-
prerelease: false
64+
- name: Create Release
65+
uses: actions/create-release@v1.1.4
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
tag_name: ${{ github.ref_name }}
70+
release_name: Release ${{ github.ref }}
71+
body: ${{ env.RELEASE_NOTES }}
72+
draft: false
73+
prerelease: false
8674

87-
- name: Publish to PyPI
88-
uses: pypa/gh-action-pypi-publish@release/v1
89-
with:
90-
password: ${{ secrets.PYPI_API_TOKEN }}
75+
- name: Publish to PyPI
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
with:
78+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)