Skip to content

Commit 355c2d3

Browse files
authored
Merge pull request #81 from rdkit/develop
Release 0.8.0
2 parents 3754f66 + b7786e1 commit 355c2d3

25 files changed

+2762
-900
lines changed

.github/dependabot.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
version: 2
2+
updates:
3+
# Python dependencies
4+
- package-ecosystem: "pip"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
open-pull-requests-limit: 8
11+
commit-message:
12+
prefix: "deps"
13+
prefix-development: "deps-dev"
14+
include: "scope"
15+
labels:
16+
- "dependencies"
17+
- "python"
18+
# Group updates to reduce PR noise
19+
groups:
20+
# Group all patch and minor updates
21+
non-breaking:
22+
patterns:
23+
- "*"
24+
update-types:
25+
- "minor"
26+
- "patch"
27+
# Group testing and dev tools
28+
dev-tools:
29+
patterns:
30+
- "pytest*"
31+
- "coverage*"
32+
- "ruff*"
33+
- "pre-commit*"
34+
- "bandit*"
35+
update-types:
36+
- "minor"
37+
- "patch"
38+
- "major"
39+
# Be conservative with major updates for core dependencies
40+
ignore:
41+
- dependency-name: "scikit-learn"
42+
update-types: ["version-update:semver-major"]
43+
- dependency-name: "rdkit"
44+
update-types: ["version-update:semver-major"]
45+
46+
# GitHub Actions
47+
- package-ecosystem: "github-actions"
48+
directory: "/"
49+
schedule:
50+
interval: "weekly"
51+
day: "monday"
52+
time: "09:00"
53+
open-pull-requests-limit: 3
54+
commit-message:
55+
prefix: "ci"
56+
include: "scope"
57+
labels:
58+
- "dependencies"
59+
- "github-actions"
60+
groups:
61+
actions:
62+
patterns:
63+
- "*"
64+
update-types:
65+
- "minor"
66+
- "patch"
67+
68+
# Pre-commit hooks (NEW!)
69+
- package-ecosystem: "pip"
70+
directory: "/"
71+
schedule:
72+
interval: "weekly"
73+
day: "monday"
74+
time: "09:15"
75+
open-pull-requests-limit: 3
76+
commit-message:
77+
prefix: "pre-commit"
78+
include: "scope"
79+
labels:
80+
- "dependencies"
81+
- "pre-commit"
82+
- "code-quality"
83+
# Only update pre-commit related dependencies
84+
allow:
85+
- dependency-name: "pre-commit"
86+
- dependency-name: "ruff*"
87+
- dependency-name: "bandit*"
88+
- dependency-name: "prettier*"
89+
groups:
90+
pre-commit-hooks:
91+
patterns:
92+
- "pre-commit*"
93+
- "ruff*"
94+
- "bandit*"
95+
update-types:
96+
- "minor"
97+
- "patch"
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Auto-publish Development Versions
2+
3+
# Trigger on pushes to develop or when PR is merged to develop
4+
on:
5+
push:
6+
branches:
7+
- develop
8+
- "feature/**"
9+
pull_request:
10+
types: [closed]
11+
branches:
12+
- develop
13+
14+
jobs:
15+
check-changes:
16+
name: Check if code changed
17+
runs-on: ubuntu-latest
18+
outputs:
19+
code-changed: ${{ steps.changes.outputs.code }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 2
24+
25+
- uses: dorny/paths-filter@v3
26+
id: changes
27+
with:
28+
filters: |
29+
code:
30+
- 'src/**'
31+
- 'pyproject.toml'
32+
- 'tests/**'
33+
34+
publish-dev:
35+
name: Publish development version
36+
runs-on: ubuntu-latest
37+
needs: check-changes
38+
# Only run if code changed and on correct triggers
39+
if: |
40+
needs.check-changes.outputs.code-changed == 'true' && (
41+
(github.event_name == 'push' && github.ref == 'refs/heads/develop') ||
42+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop')
43+
)
44+
defaults:
45+
run:
46+
shell: bash
47+
permissions:
48+
contents: read
49+
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@v4
53+
54+
- name: Install uv
55+
uses: astral-sh/setup-uv@v4
56+
with:
57+
version: "latest"
58+
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version: "3.10"
63+
64+
- name: Setup build environment
65+
run: |
66+
uv sync --group test --no-dev
67+
uv add --dev build twine
68+
69+
- name: Run tests before publishing
70+
run: |
71+
uv run coverage run -m pytest tests/ -x --tb=short
72+
73+
- name: Generate development version
74+
id: version
75+
run: |
76+
# Get base version
77+
BASE_VERSION=$(uv run python -c "import sys; sys.path.insert(0, 'src'); from laplaciannb import __version__; print(__version__)")
78+
echo "Base version: $BASE_VERSION"
79+
80+
# Generate dev version with short commit hash and timestamp
81+
SHORT_SHA=$(git rev-parse --short HEAD)
82+
TIMESTAMP=$(date +%Y%m%d%H%M)
83+
DEV_VERSION="${BASE_VERSION}.dev${TIMESTAMP}"
84+
85+
echo "Development version: $DEV_VERSION"
86+
echo "dev_version=$DEV_VERSION" >> $GITHUB_OUTPUT
87+
88+
# Update version in __init__.py
89+
sed -i "s/__version__ = \"$BASE_VERSION\"/__version__ = \"$DEV_VERSION\"/" src/laplaciannb/__init__.py
90+
91+
# Verify version was updated
92+
UPDATED_VERSION=$(uv run python -c "import sys; sys.path.insert(0, 'src'); from laplaciannb import __version__; print(__version__)")
93+
echo "Updated version: $UPDATED_VERSION"
94+
95+
- name: Build distribution
96+
run: |
97+
uv run python -m build
98+
99+
- name: Validate distribution
100+
run: |
101+
uv run twine check dist/*
102+
103+
# Test installation with uv
104+
uv run pip install dist/*.whl
105+
uv run python -c "import laplaciannb; print(f'Installed version: {laplaciannb.__version__}')"
106+
107+
- name: Publish to PyPI
108+
uses: pypa/gh-action-pypi-publish@release/v1
109+
with:
110+
password: ${{ secrets.PYPI_API_TOKEN }}
111+
verbose: true
112+
print-hash: true
113+
114+
- name: Create GitHub summary
115+
run: |
116+
echo "## 🚀 Development Version Published" >> $GITHUB_STEP_SUMMARY
117+
echo "" >> $GITHUB_STEP_SUMMARY
118+
echo "**Version:** \`${{ steps.version.outputs.dev_version }}\`" >> $GITHUB_STEP_SUMMARY
119+
echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
120+
echo "**Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
121+
echo "" >> $GITHUB_STEP_SUMMARY
122+
echo "### Installation" >> $GITHUB_STEP_SUMMARY
123+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
124+
echo "pip install laplaciannb==${{ steps.version.outputs.dev_version }}" >> $GITHUB_STEP_SUMMARY
125+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
126+
echo "" >> $GITHUB_STEP_SUMMARY
127+
echo "Or install latest development version:" >> $GITHUB_STEP_SUMMARY
128+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
129+
echo "pip install --pre laplaciannb" >> $GITHUB_STEP_SUMMARY
130+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
131+
132+
- name: Comment on PR (if applicable)
133+
if: github.event_name == 'pull_request'
134+
uses: actions/github-script@v7
135+
with:
136+
script: |
137+
github.rest.issues.createComment({
138+
issue_number: context.issue.number,
139+
owner: context.repo.owner,
140+
repo: context.repo.repo,
141+
body: `🚀 **Development version published!**\n\n**Version:** \`${{ steps.version.outputs.dev_version }}\`\n\nInstall with:\n\`\`\`bash\npip install laplaciannb==${{ steps.version.outputs.dev_version }}\n\`\`\``
142+
})

0 commit comments

Comments
 (0)