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
25 changes: 0 additions & 25 deletions .github/workflows/pypi.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: 🚀 release

on:
push:
branches: [ main ]

concurrency:
group: release
cancel-in-progress: false

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest
env:
UV_PYTHON: "3.13"
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v4
- run: uv python install "${UV_PYTHON}"
- run: uv sync --all-extras --dev
- run: just lint
- run: just tests
- name: Check that the version files agree
run: |
version="$(uv run cz version --project)"
grep -qx "__version__ = '${version}'" userpic.py

tag:
needs: check
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.tag.outputs.version }}
env:
UV_PYTHON: "3.13"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v4
- run: uv python install "${UV_PYTHON}"
- run: uv sync --all-extras --dev
- name: Tag the release
id: tag
run: |
version="$(uv run cz version --project)"
if git rev-parse -q --verify "refs/tags/${version}" >/dev/null; then
echo "${version} is already tagged, nothing to release"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${version}" -m "${version}"
git push origin "${version}"
echo "version=${version}" >> "${GITHUB_OUTPUT}"

publish:
needs: tag
if: needs.tag.outputs.version != ''
runs-on: ubuntu-latest
permissions:
contents: write
env:
UV_PYTHON: "3.13"
VERSION: ${{ needs.tag.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.tag.outputs.version }}
fetch-depth: 0
- uses: astral-sh/setup-uv@v4
- run: uv python install "${UV_PYTHON}"
- run: uv sync --all-extras --dev
- name: Build and check that the artifacts match the tag
run: |
uv build
test -f "dist/tiny_userpic-${VERSION}-py3-none-any.whl"
test -f "dist/tiny_userpic-${VERSION}.tar.gz"
- run: uv publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}
- name: Publish the github release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
uv run cz changelog "${VERSION}" --dry-run > notes.md
gh release create "${VERSION}" --title "${VERSION}" --notes-file notes.md dist/*
29 changes: 24 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,45 @@
name: 🧐 test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
env:
UV_PYTHON: "3.13"
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v4
- run: uv python install "${UV_PYTHON}"
- run: uv sync --all-extras --dev
- run: just lint

tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
just-trigger:
- "lint"
- "tests"
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
env:
UV_PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v4
- run: uv python install ${{ matrix.python-version }}
- run: uv python install "${UV_PYTHON}"
- run: uv sync --all-extras --dev
- run: just ${{ matrix.just-trigger }}
- run: just tests
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.png
.svg
/*.png
/*.svg
.idea/

# Byte-compiled / optimized / DLL files
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
language: system
'types_or': [ python, pyi ]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.1"
rev: "v0.8.2"
hooks:
- id: ruff
args: [ --fix, --unsafe-fixes ]
Expand Down
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Changelog

All notable changes to this project are documented in this file.

Entries from 1.0.0 onwards are generated from [conventional commits](https://www.conventionalcommits.org/)
by [commitizen](https://commitizen-tools.github.io/commitizen/): run `just bump` in the pull request
to update the version and this file, and the release workflow tags and publishes it once the pull
request lands on `main`. Earlier releases predate that convention and are summarised by hand.

## 1.0.0 (2026-08-22)

### BREAKING CHANGE

- the padding default changed from (0, 0) to (20, 20) in
make_userpic_svg and in both *_from_string functions, make_userpic was removed,
and degenerate size/image_size/padding values now raise ValueError instead of
hanging or returning a broken image. The rendered pixels and the SVG markup
differ from 0.4.0, although the pattern for a given seed or string is unchanged.

### Feat

- declare the api stable and automate releases

### Fix

- pattern rendering, input validation and svg output

## 0.4.0 (2025-03-24)

### Feat

- add `make_userpic_image_from_string` and `make_userpic_svg_from_string`, deriving the pattern from
a SHA-256 digest of the input text
- add the `seed` parameter to the image and SVG generators for reproducible output
- add a test suite and the example images used by the readme

## 0.3.0 (2024-12-12)

### Refactor

- rewrite the library as a single `userpic.py` module
- drop the command line interface, leaving a library-only package
- make Pillow the only runtime dependency
- move the tooling to uv and just

Patch releases 0.3.1, 0.3.2 and 0.3.3 only touched the readme and the packaging metadata.

## 0.2.0 (2022-07-22)

### Refactor

- make CairoSVG an optional dependency instead of a required one
- replace typer with click in the command line interface

## 0.1.1 (2021-07-03)

Initial release: a `userpic` package with an SVG generator, a Cairo-backed PNG renderer and a
typer-based command line interface.
Loading
Loading