Skip to content

Commit

Permalink
update: LTS (closes #14)
Browse files Browse the repository at this point in the history
  • Loading branch information
metaist committed Dec 31, 2023
1 parent ffc8614 commit 4940bf5
Show file tree
Hide file tree
Showing 17 changed files with 287 additions and 227 deletions.
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"mypy",
"optvar",
"pdoc",
"pyright",
"setuptools",
"startswith",
"tomli"
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,23 @@ jobs:

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up caches
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py${{ matrix.python-version }}

- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 3

- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
Expand All @@ -49,6 +44,10 @@ jobs:
run: |
pdm run mypy
# - name: Type check (pyright)
# run: |
# pdm run pyright

- name: Run tests
run: |
pdm run test
Expand Down
72 changes: 15 additions & 57 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
# schedule:
# - cron: '35 7 * * 3'
branches: [main]

jobs:
analyze:
Expand All @@ -32,51 +19,22 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
language: ["python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
setup-python-dependencies: false
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
55 changes: 27 additions & 28 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,33 @@ on:
types: [published]

jobs:
deploy:

pypi-publish:
runs-on: ubuntu-latest

permissions:
id-token: write

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Check setup.py
run: |
pip install -e .
- name: Build package
run: |
python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install build
- name: Check install
run: |
pip install -e .
- name: Build package
run: |
python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ _seed.py
__pycache__

# test
.coverage*
.coverage
.mypy_cache
.pytest_cache
.ruff_cache
Expand Down
89 changes: 89 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Contributing

## Local Development

```bash
# get the code
git clone git@github.com:metaist/attrbox.git
cd attrbox

# create a virtual environment
python -m venv .venv --prompt attrbox
. .venv/bin/activate
pip install --upgrade pip

# install dependencies and dev tools
pip install -e ".[dev]"
pnpm install -g cspell
```

As you work on the code, you should periodically run:

```bash
pdm lint # for type checks
pdm test # for unit tests
```

This repo generally tries to maintain type-correctness (via `mypy` and `pyright`) and complete unit test coverage.

## Making a Release

Checkout `prod`:

```bash
git checkout prod
git merge --no-ff --no-edit main
```

Update top-most `__init__.py`:

```python
__version__ = "X.0.1"
```

Update `CHANGELOG.md`:

Sections order is: `Fixed`, `Changed`, `Added`, `Deprecated`, `Removed`, `Security`.

```markdown
---

[X.0.1]: https://github.com/metaist/attrbox/compare/X.0.0...X.0.1

## [X.0.1] - XXXX-XX-XXT00:00:00Z

**Fixed**

**Changed**

**Added**

**Deprecated**

**Removed**

**Security**
```

###

```bash
export VER="X.0.1"

# update docs
pdm docs

# check build
pip install -e .

# commit and push tags
git commit -am "release: $VER"
git tag $VER
git push
git push --tags
git checkout main
git merge --no-ff --no-edit prod
git push
```

[Create the release on GitHub](https://github.com/metaist/attrbox/releases/new). The `pypi.yaml` workflow will attempt to publish it to PyPI.
24 changes: 11 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# attrbox

_Attribute-based data structures._

[![Build Status](https://img.shields.io/github/actions/workflow/status/metaist/attrbox/.github/workflows/ci.yaml?branch=main&style=for-the-badge)](https://github.com/metaist/attrbox/actions)
[![attrbox on PyPI](https://img.shields.io/pypi/v/attrbox.svg?color=blue&style=for-the-badge)](https://pypi.org/project/attrbox)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/attrbox?style=for-the-badge)](https://pypi.org/project/attrbox)

[Changelog] - [Issues] - [Documentation]

[changelog]: https://github.com/metaist/attrbox/blob/main/CHANGELOG.md
[issues]: https://github.com/metaist/attrbox/issues
[documentation]: https://metaist.github.io/attrbox/
# attrbox: attribute-based data structures

<p align="center">
<a href="https://metaist.github.io/attrbox/"><img alt="Otto the Otter" width="200" src="https://raw.githubusercontent.com/metaist/attrbox/main/otter-box.png" /></a><br />
<em>Otto the Otter</em>
</p>
<p align="center">
<a href="https://github.com/metaist/attrbox/actions/workflows/ci.yaml"><img alt="Build" src="https://img.shields.io/github/actions/workflow/status/metaist/attrbox/.github/workflows/ci.yaml?branch=main&logo=github"/></a>
<a href="https://pypi.org/project/attrbox"><img alt="PyPI" src="https://img.shields.io/pypi/v/attrbox.svg?color=blue" /></a>
<a href="https://pypi.org/project/attrbox"><img alt="Supported Python Versions" src="https://img.shields.io/pypi/pyversions/attrbox" /></a>
</p>

## Why?

Expand Down
Empty file added docs/.nojekyll
Empty file.
Loading

0 comments on commit 4940bf5

Please sign in to comment.