Skip to content

Commit

Permalink
feat: init font_fjallaone python package
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare committed Dec 30, 2022
0 parents commit 46d9325
Show file tree
Hide file tree
Showing 12 changed files with 1,087 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:

# Update pip dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "feat(deps): "
prefix-development: "chore(deps): "
open-pull-requests-limit: 20

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore(ci): "
open-pull-requests-limit: 10
33 changes: 33 additions & 0 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint and Test

on:
push:
branches-ignore:
- develop
- main
- gh-pages

jobs:
call-workflow:
uses: radiorabe/actions/.github/workflows/test-pre-commit.yaml@main
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.x', '3.9' ]
name: Test python ${{ matrix.python-version }}
steps:
- name: Checkout
uses: actions/checkout@v3

- run: pipx install poetry

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- run: poetry install

- run: poetry run pytest
43 changes: 43 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
pull_request:
release:
types: [created]

jobs:
pypi:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- run: pipx install poetry

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
cache: 'poetry'

- run: poetry install

- name: Configure poetry
run: poetry config pypi-token.pypi ${{ secrets.RABE_PYPI_TOKEN }}
if: ${{ github.event_name != 'pull_request' }}

- name: Set dry-run flag
id: dry-run
run: |
flag="--dry-run"
if ${{ github.event_name != 'pull_request' }}
then
flag=""
fi
echo "flag=$flag" >> $GITHUB_OUTPUT
- run: poetry version $(git describe --tags --abbrev=0 --exact-match || (git describe --tags --abbrev=0 --dirty=+dev|tr -d '\n'; echo "+dev"))

- run: poetry publish --build --no-interaction ${{ steps.dry-run.outputs.flag }}
12 changes: 12 additions & 0 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Semantic Release

on:
push:
branches:
- main

jobs:
call-workflow:
uses: radiorabe/actions/.github/workflows/semantic-release.yaml@main
secrets:
RABE_ITREAKTION_GITHUB_TOKEN: ${{ secrets.RABE_ITREAKTION_GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
__pycache__
.coverage
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
hooks:
- id: pyupgrade
args:
- --py39-plus
- repo: local
hooks:
- id: black
name: black
language: system
entry: black
types: [python]
- id: isort
name: isort
language: system
entry: isort
types: [python]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
exclude: ^src/api/client.js$
- id: end-of-file-fixer
exclude: ^src/api/client.js$
- id: check-symlinks
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-aws-credentials
args:
- --allow-missing-credentials
- id: detect-private-key
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Python Package with Fjalla One Font

Python Package with [Fjalla One](https://fonts.google.com/specimen/Fjalla+One) from
[Sorkin Type](https://github.com/pimoroni/fonts-python) as distributed by
[Google Fonts](https://fonts.google.com) for use with
[fonts-python](https://github.com/pimoroni/fonts-python).

## Installation

```bash
pip install font_fjallaone
```

## Usage

```python
from font_fjallaone import FjallaOne
```

## Release Management

The CI/CD setup uses semantic commit messages following the [conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/).
There is a GitHub Action in [.github/workflows/semantic-release.yaml](./.github/workflows/semantic-release.yaml)
that uses [go-semantic-commit](https://go-semantic-release.xyz/) to create new
releases.

The commit message should be structured as follows:

```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```

The commit contains the following structural elements, to communicate intent to the consumers of your library:

1. **fix:** a commit of the type `fix` patches gets released with a PATCH version bump
1. **feat:** a commit of the type `feat` gets released as a MINOR version bump
1. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:` gets released as a MAJOR version bump
1. types other than `fix:` and `feat:` are allowed and don't trigger a release

If a commit does not contain a conventional commit style message you can fix
it during the squash and merge operation on the PR.

Once a commit has landed on the `main` branch a release will be created and automatically published to [pypi](https://pypi.org/)
using the GitHub Action in [.github/workflows/release.yaml](./.github/workflows/release.yaml) which uses [poetry](https://python-poetry.org/)
to publish the package to pypi.

## Copyright

Copyright (c) 2022 [Radio Bern RaBe](http://www.rabe.ch)
18 changes: 18 additions & 0 deletions font_fjallaone/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Fjalla One from from Sorkin Type as distributed by Google Fonts."""

import glob
import os

font_directory = os.path.join(os.path.abspath(os.path.dirname(__file__)), "files")

font_files = {}

for font in list(glob.glob(os.path.join(font_directory, "*.ttf"))):
font_name = (
os.path.basename(font)
.replace(".ttf", "")
.replace("-Regular", "")
.replace("-", "")
)
font_files[font_name] = font
globals()[font_name] = font
Binary file added font_fjallaone/files/FjallaOne-Regular.ttf
Binary file not shown.
Loading

0 comments on commit 46d9325

Please sign in to comment.