Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
spapanik committed Nov 10, 2024
0 parents commit d6b5cd8
Show file tree
Hide file tree
Showing 24 changed files with 759 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
indent_style = space
tab_width = 4
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,yaml}]
indent_size = 2
2 changes: 2 additions & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: spapanik
liberapay: spapanik
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: build

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

jobs:
build-python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }} (${{ matrix.os }})
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install cli tools
run: |
python -m pip install --upgrade phosphorus yamk uv
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: pwsh
if: ${{ runner.os == 'Windows' }}
run: |
uv venv .venv
"VIRTUAL_ENV=.venv" | Out-File -FilePath $env:GITHUB_ENV -Append
"$PWD/.venv/Scripts" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Use cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ matrix.os }}-${{ matrix.python-version }}-lint-${{ hashFiles('pyproject.toml') }}
- name: Build the project
run: |
yam -e build
60 changes: 60 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: lint

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

jobs:
lint-python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }} (${{ matrix.os }})
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install cli tools
run: |
python -m pip install --upgrade phosphorus yamk uv
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: pwsh
if: ${{ runner.os == 'Windows' }}
run: |
uv venv .venv
"VIRTUAL_ENV=.venv" | Out-File -FilePath $env:GITHUB_ENV -Append
"$PWD/.venv/Scripts" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Use cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ matrix.os }}-${{ matrix.python-version }}-lint-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
yam install -g main -g lint -g test
- name: Lint the project
run: |
yam -e lint
60 changes: 60 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: tests

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

jobs:
unittest-python:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }} (${{ matrix.os }})
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install cli tools
run: |
python -m pip install --upgrade phosphorus yamk uv
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
uv venv .venv
echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV
echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Create and activate a virtual environment (${{ matrix.os }})
shell: pwsh
if: ${{ runner.os == 'Windows' }}
run: |
uv venv .venv
"VIRTUAL_ENV=.venv" | Out-File -FilePath $env:GITHUB_ENV -Append
"$PWD/.venv/Scripts" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Use cache
uses: actions/cache@v4
with:
path: .venv
key: ${{ matrix.os }}-${{ matrix.python-version }}-lint-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
yam install -g main -g test
- name: Test the project
run: |
yam -e tests
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# cache
__pycache__/
.mypy_cache/
.pytest_cache/
.ruff_cache/
.cov_cache/

# installation/build artifacts
.yamk/
dist/
p-lock.toml

# local dev
/cookbook.yaml.d/
local/
local.*
11 changes: 11 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# BSD 3-Clause License

Copyright © 2024 Stephanos Kuma.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 changes: 45 additions & 0 deletions cookbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
$globals:
shell: bash
version: "8.1"
vars:
p_sync: --sync

install:
phony: true
keep_ts: true
requires:
- p-lock.toml
commands:
- p install ${p_sync} ${.extra}

format:
phony: true
requires:
- install
commands:
- black .
- ruff check --fix-only .

lint:
phony: true
requires:
- install
commands:
- black --check .
- p check --lockfile
- ruff check .
- mypy .

tests:
phony: true
requires:
- install
commands:
- pytest ${.extra}

p-lock.toml:
update: true
requires:
- pyproject.toml
commands:
- p lock
11 changes: 11 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].

## [Unreleased]

[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
[0.1.0]: https://github.com/spapanik/joselib/releases/tag/v0.1.0
Loading

0 comments on commit d6b5cd8

Please sign in to comment.