Skip to content

Commit b01ca8d

Browse files
committed
Update LensKit template code
1 parent 6bac084 commit b01ca8d

11 files changed

+231
-316
lines changed

.copier-answers.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 28184e6
2+
_commit: d7a66f4
33
_src_path: https://github.com/lenskit/lk-project-template
4+
owner: Drexel University and contributors
45
package_name: lenskit
6+
project_descr: Toolkit for recommender systems research, teaching, and more.
57
project_name: lenskit
8+
project_title: LensKit
69
require_lint: false
710
start_year: 2018
11+
typecheck: false

.github/workflows/check-sources.yml

+55-53
Original file line numberDiff line numberDiff line change
@@ -11,64 +11,66 @@ concurrency:
1111

1212
jobs:
1313
lint:
14-
name: Check Source Style
14+
name: Check Source Code
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- name: 📥 Check out source code
19-
uses: actions/checkout@v2
20-
with:
21-
fetch-depth: 0
18+
- name: 📥 Check out source code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
2222

23-
- name: 🐍 Set up Python
24-
uses: actions/setup-python@v4
25-
with:
26-
python-version: "3.11"
27-
cache: 'pip'
23+
- name: 🐍 Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.11"
27+
cache: "pip"
2828

29-
- name: 🛠️ Install tools
30-
run: |
31-
pip install ruff
29+
- name: 🛠️ Install development tools and dependencies
30+
run: |
31+
pip install -e .[dev]
3232
33-
- name: 🪮 Check source code formatting
34-
id: format
35-
run: |
36-
if pipx run ruff format --diff $PKG_DIR; then
37-
echo passed=yes >>"$GITHUB_OUTPUT"
38-
else
39-
echo passed=no >>"$GITHUB_OUTPUT"
40-
echo "::error::source code not formatted"
41-
fi
42-
env:
43-
PKG_DIR: lenskit
33+
- name: 🪮 Check source code formatting
34+
id: format
35+
run: |
36+
if ruff format --diff $PKG_DIR; then
37+
echo passed=yes >>"$GITHUB_OUTPUT"
38+
else
39+
echo passed=no >>"$GITHUB_OUTPUT"
40+
echo "::error::source code not formatted"
41+
fi
42+
env:
43+
PKG_DIR: lenskit
4444

45-
- name: 🐜 Check source code lint rules
46-
id: lint
47-
run: |
48-
if pipx run ruff check --output-format=github $PKG_DIR; then
49-
echo passed=yes >>"$GITHUB_OUTPUT"
50-
else
51-
echo passed=no >>"$GITHUB_OUTPUT"
52-
echo "::error::source code lint check failed"
53-
fi
54-
env:
55-
PKG_DIR: lenskit
45+
- name: 🐜 Check source code lint rules
46+
id: lint
47+
run: |
48+
if ruff check --output-format=github $PKG_DIR; then
49+
echo passed=yes >>"$GITHUB_OUTPUT"
50+
else
51+
echo passed=no >>"$GITHUB_OUTPUT"
52+
echo "::error::source code lint check failed"
53+
fi
54+
env:
55+
PKG_DIR: lenskit
5656

57-
- name: 🧾 Checking results
58-
run: |
59-
if [ "$FMT_PASSED" = no ]; then
60-
echo "::error::format failed, failing build"
61-
exit 1
62-
fi
63-
if [ "$LINT_PASSED" = no ]; then
64-
if [ "$LINT_REQUIRED" = true ]; then
65-
echo "::error::lint failed, failing build"
66-
exit 2
67-
else
68-
echo "::error::lint failed but non-mandatory"
69-
fi
70-
fi
71-
env:
72-
FMT_PASSED: ${{ steps.fmt.outputs.passed }}
73-
LINT_PASSED: ${{ steps.lint.outputs.passed }}
74-
LINT_REQUIRED: False
57+
- name: 🧾 Checking lint and format results
58+
run: |
59+
if [ "$FMT_PASSED" = no ]; then
60+
echo "::error::format failed, failing build"
61+
exit 1
62+
fi
63+
if [ "$LINT_PASSED" = no ]; then
64+
if [ "$LINT_REQUIRED" = true ]; then
65+
echo "::error::lint failed, failing build"
66+
exit 2
67+
else
68+
echo "::error::lint failed but non-mandatory"
69+
fi
70+
fi
71+
env:
72+
FMT_PASSED: ${{ steps.format.outputs.passed }}
73+
LINT_PASSED: ${{ steps.lint.outputs.passed }}
74+
LINT_REQUIRED: False
75+
76+

.github/workflows/package.yml

+51-36
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,61 @@
1-
name: Build Packages
1+
name: Package and Publish
2+
23
on:
34
push:
45
branches:
56
- main
67
release:
78
types: [published]
9+
810
jobs:
9-
sdist:
10-
name: Build and upload packages
11+
dist:
12+
name: Build Packages
1113
runs-on: ubuntu-latest
1214

1315
steps:
14-
- uses: actions/checkout@v2
15-
16-
- name: Fetch Git tags
17-
run: git fetch --tags
18-
19-
- name: Set up Python
20-
uses: actions/setup-python@v2
21-
with:
22-
python-version: 3.8
23-
24-
- name: Install Python packaging deps
25-
run: pip install -U flit
26-
27-
- name: Build source dist
28-
run: flit build
29-
30-
- name: Save archive
31-
uses: actions/upload-artifact@v1
32-
with:
33-
name: pypi-pkgs
34-
path: dist
35-
36-
- name: List dist dir
37-
run: ls -R dist
38-
39-
- name: Publish PyPI packages
40-
if: github.event_name == 'release'
41-
run: |
42-
flit publish
43-
env:
44-
TWINE_NON_INTERACTIVE: y
45-
FLIT_USERNAME: __token__
46-
FLIT_PASSWORD: ${{ secrets.TWINE_TOKEN }}
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Fetch Git tags
21+
run: git fetch --tags
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.10"
27+
28+
- name: Install Python deps
29+
run: pip install -U build
30+
31+
- name: Build distribution
32+
run: python -m build
33+
34+
- name: Save archive
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: pypi-pkgs
38+
path: dist
39+
40+
- name: List dist dir
41+
run: ls -R dist
42+
43+
pypi-publish:
44+
name: Publish to PyPI
45+
runs-on: ubuntu-latest
46+
needs: [dist]
47+
if: github.event_name == 'release'
48+
49+
environment: release
50+
permissions:
51+
id-token: write
52+
53+
steps:
54+
- name: Fetch compiled package distributions
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: pypi-pkgs
58+
path: dist
59+
60+
- name: Publish package distributions to PyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ scratch/
2727
# build outputs
2828
build/
2929
dist/
30+
*.egg-info
3031
*.pyd
3132
*.so
3233
*.dll

.header.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root: true
2+
start_year: 2018
3+
owner: Drexel University and contributors
4+
substring: This file is part of
5+
template: |-
6+
{comment_start} This file is part of LensKit.
7+
{comment_middle} Copyright (C) {start_year}-2023 Boise State University
8+
{comment_middle} Copyright (C) 2023-{end_year} Drexel University
9+
{comment_middle} Licensed under the MIT license, see LICENSE.md for details.
10+
{comment_middle} SPDX-License-Identifier: MIT
11+
{comment_end}

.vscode/settings.json

+19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
{
22
"[python]": {
33
"editor.defaultFormatter": "charliermarsh.ruff",
4+
"editor.codeActionsOnSave": {
5+
"source.organizeImports.ruff": "explicit"
6+
},
47
"editor.formatOnSave": true,
58
},
9+
"[jsonc]": {
10+
"editor.formatOnSave": true,
11+
},
12+
"[yaml]": {
13+
"editor.defaultFormatter": "redhat.vscode-yaml",
14+
"editor.formatOnSave": true,
15+
},
16+
"[toml]": {
17+
"editor.defaultFormatter": "tamasfe.even-better-toml",
18+
"editor.formatOnSave": true,
19+
},
20+
"python.testing.pytestArgs": [
21+
"tests"
22+
],
23+
"python.testing.unittestEnabled": false,
24+
"python.testing.pytestEnabled": true,
625
}

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Copyright (c) 2018–2023 Boise State University
2-
Copyright (c) 2023 Michael Ekstrand
2+
Copyright (c) 2023-2024 Drexel University and contributors
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
prune envs
2+
prune .github
3+
prune .vscode
4+
exclude .*.yml
5+
exclude .*.yaml

0 commit comments

Comments
 (0)