Skip to content

Commit

Permalink
Add example conda-forge recipe, update readme and pdf slides
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Feb 6, 2024
1 parent 9793a98 commit c7e4859
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repos:
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
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@

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

Repo for the SSC compact course ["Python Packaging"](https://ssciwr.github.io/python-packaging).
Source code samples for the SSC compact course ["Python Packaging"](https://ssciwr.github.io/python-packaging).

### calculate-minimal

[calculate-minimal](https://github.com/ssciwr/python-packaging/tree/main/calculate) contains a bare-bones Python package that can be locally installed using pip.

### calculate-liam

[calculate-liam](https://github.com/ssciwr/python-packaging/tree/main/calculate-liam) contains a more complete Python package that is also automatically published to testPyPI using this [github action](https://github.com/ssciwr/python-packaging/blob/main/.github/workflows/pypi.yml)
13 changes: 11 additions & 2 deletions calculate-liam/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# calculate-liam

A simple example of a Python package from the [SSC Python Packaging course](https://ssciwr.github.io/python-packaging).
A simple example of a Python package from the [SSC Python Packaging course](https://ssciwr.github.io/python-packaging),
which is published on [testPyPI](https://test.pypi.org/project/calculate-liam/)

## testPyPI install
## install from testPyPI

First ensure that the dependencies are installed from (real) PyPI:

Expand Down Expand Up @@ -34,3 +35,11 @@ $ roll-dice --n-dice=2 --n-sides=12
5

```

## automatic testPyPI publishing

Tagged commits are automatically published on testPyPI using [this github action](https://github.com/ssciwr/python-packaging/blob/main/.github/workflows/pypi.yml)

## conda-forge recipe

An example recipe that could be used to submit this package to conda-forge is [meta.yaml](https://github.com/ssciwr/python-packaging/blob/main/calculate-liam/meta.yaml)
47 changes: 47 additions & 0 deletions calculate-liam/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% set name = "calculate-liam" %}
{% set version = "0.0.3" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/calculate_liam-{{ version }}.tar.gz
sha256: ad9fe95227ecae2e8d9c1151c5efd5367f4f3c9178670a7bd85a21e1ec300656

build:
entry_points:
- flip-coin = calculate_liam.cli:flip_coin_cli
- roll-dice = calculate_liam.cli:roll_dice_cli
noarch: python
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
number: 0

requirements:
host:
- python >=3.8
- hatchling
- pip
run:
- python >=3.8
- click
- numpy

test:
imports:
- calculate_liam
commands:
- pip check
- flip-coin --help
- roll-dice --help
requires:
- pip

about:
summary: An example package from the SSC Python Packaging course
license: MIT
license_file: LICENSE.md

extra:
recipe-maintainers:
- lkeegan
Binary file modified docs/slides/slides.pdf
Binary file not shown.

0 comments on commit c7e4859

Please sign in to comment.