Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
# build the calculate-liam package and store outputs in dist folder
- run: pipx run build calculate-liam -o dist
# check the files in dist are valid
Expand All @@ -36,9 +36,9 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
python-version: ["3.8", "3.13"]
python-version: ["3.10", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
# install the calculate-liam package including the optional test dependencies
- run: pip install -e .[test]
working-directory: calculate-liam
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/slides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Slides

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
- run: npm install --global @marp-team/marp-cli
- run: marp slides/index.md -o slides/index.html
- run: marp slides/index.md --pdf -o slides/slides.pdf
- run: marp slides/index.md --image png -o slides/slides-thumb.png
- uses: actions/upload-pages-artifact@v5
with:
path: ./slides

deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v5
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,8 @@ dmypy.json

# Cython debug symbols
cython_debug/

# Marp build outputs (generated in CI; locally with `marp slides -w`)
slides/*.html
slides/slides.pdf
slides/slides-thumb.png
3 changes: 3 additions & 0 deletions .marprc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
themeSet:
- slides/ssc.css
allowLocalFiles: true
26 changes: 7 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
repos:
# Run Black - the uncompromising Python code formatter
- repo: https://github.com/psf/black
rev: 25.1.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.8
hooks:
- id: black-jupyter
- id: ruff-check
types_or: [python, pyi, jupyter]
args: [--fix]
- id: ruff-format
types_or: [python, pyi, jupyter]

# Add some general purpose useful hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Make sure that contained YAML files are well-formed
- id: check-yaml
exclude: meta.yaml
# Trim trailing whitespace of all sorts
- id: trailing-whitespace
# Apply a file size limit of 500kB
- id: check-added-large-files
# Simple parser validation of e.g. pyproject.toml
- id: check-toml
# Unify file endings
- id: end-of-file-fixer

# Make sure that Jupyter notebooks under version control
# have their outputs stripped before committing
- repo: https://github.com/kynan/nbstripout
rev: 0.8.1
hooks:
- id: nbstripout
files: ".ipynb"
46 changes: 39 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,46 @@

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Source code samples for the SSC compact course ["Python Packaging"](https://ssciwr.github.io/python-packaging).
Source code samples and slides for the SSC compact course ["Python Packaging"](https://www.ssc.uni-heidelberg.de/en/compact-course-python-packaging).

## calculate-minimal
## Description

- [calculate-minimal](https://github.com/ssciwr/python-packaging/tree/main/calculate-minimal) contains a bare-bones Python package
- it can be locally installed using pip
In this course we will learn how to package a Python library, how to publish it on PyPI and on conda-forge, as well as look at more advanced topics like building pre-compiled wheels including c++ extensions using pybind11, and automatically publishing new releases using continuous integration and cibuildwheel.

## calculate-liam
## Slides

- [calculate-liam](https://github.com/ssciwr/python-packaging/tree/main/calculate-liam) contains a more complete Python package
- it is also automatically published to [testPyPI](https://test.pypi.org/project/calculate-liam/) using [this github action](https://github.com/ssciwr/python-packaging/blob/main/.github/workflows/pypi.yml)
[![Course slides](https://ssciwr.github.io/python-packaging/slides-thumb.png)](https://ssciwr.github.io/python-packaging)

[Open slides](https://ssciwr.github.io/python-packaging) | [Download as PDF](https://ssciwr.github.io/python-packaging/slides.pdf) | [Course description](https://www.ssc.uni-heidelberg.de/en/compact-course-python-packaging)

## Python Package Examples

### Pure Python Package

- [calculate-minimal](https://github.com/ssciwr/python-packaging/tree/main/calculate-minimal)
- A bare-bones minimal Python package that can be locally installed
- [calculate-liam](https://github.com/ssciwr/python-packaging/tree/main/calculate-liam)
- A more complete version of this Python package that is [published on testPyPI](https://test.pypi.org/project/calculate-liam)
- This [github action](https://github.com/ssciwr/python-packaging/blob/main/.github/workflows/pypi.yml) automatically publishes new versions to testPyPI on tagged commits

### Python Package with C++ compiled extensions

- [pybind11-numpy-example](https://github.com/ssciwr/pybind11-numpy-example)
- a simple example of packaging including c++ compiled extensions
- an example [meta.yaml](https://github.com/conda-forge/staged-recipes/pull/25040/files) conda-forge recipe for this package
- the resulting [conda-forge feedstock](https://github.com/conda-forge/pybind11-numpy-example-feedstock) for this package
- [hammingdist](https://github.com/ssciwr/hammingdist)
- a more advanced example with a compiled extension making use of OpenMP and CUDA

## Recommended resources

- Pure Python packaging
- [Python Packaging Tutorial](https://packaging.python.org/en/latest/tutorials/packaging-projects)
- [Scientific Python Simple packaging](https://learn.scientific-python.org/development/guides/packaging-simple)
- Python packaging with compiled extensions
- [Scientific Python Compiled packaging](https://learn.scientific-python.org/development/guides/packaging-compiled)
- [scikit-build-core getting started](https://scikit-build-core.readthedocs.io/en/latest/getting_started.html)
- [pypackaging-native](https://pypackaging-native.github.io/)
- Cookiecutters to generate your own GitHub repo for a Python package
- [ssciwr/cookiecutter-python-package](https://github.com/ssciwr/cookiecutter-python-package)
- [scientific-python/cookie](https://github.com/scientific-python/cookie)
4 changes: 0 additions & 4 deletions docs/_config.yml

This file was deleted.

143 changes: 0 additions & 143 deletions docs/_layouts/default.html

This file was deleted.

39 changes: 0 additions & 39 deletions docs/assets/css/style.scss

This file was deleted.

Binary file removed docs/assets/images/favicon.ico
Binary file not shown.
41 changes: 0 additions & 41 deletions docs/index.md

This file was deleted.

Binary file removed docs/slides/slides.pdf
Binary file not shown.
Binary file added slides/favicon.ico
Binary file not shown.
Loading
Loading