Skip to content

Commit

Permalink
switch: to using ds (metaist/LTS#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
metaist committed Oct 21, 2024
1 parent 6c7a427 commit 3cd38a0
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 572 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v4

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

Expand All @@ -32,26 +32,18 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
pip install -e ".[dev]"
- name: Format (black)
- name: Format & Lint (ruff, cspell)
run: |
pdm run black
ds lint
- name: Lint (ruff)
- name: Type check (pyright, mypy)
run: |
pdm run ruff
ds types
- name: Type check (mypy)
- name: Run tests (pytest, coverage)
run: |
pdm run mypy
ds test
# - name: Type check (pyright)
# run: |
# pdm run pyright

- name: Run tests
run: |
pdm run test
- name: Build docs
- name: Build docs (pdoc)
run: |
pdm run docs
ds docs
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ jobs:
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

# 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
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4

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

Expand Down
58 changes: 31 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# Contributing

## Toolchain

The top-level tool chain for managing this project is tested on Linux and macOS.
Here are links for installing the appropriate tools.

- [`cspell`](https://cspell.org/docs/installation/)
- [`ds`](https://github.com/metaist/ds#install)
- [`gh`](https://github.com/cli/cli#installation)
- [`git`](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
- [`uv`](https://github.com/astral-sh/uv#installation)

All remaining tools are installed below.

## 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
uv sync --extra dev
```

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

```bash
pdm lint # for type checks
pdm test # for unit tests
ds dev # check lint, type-checks, and run tests
```

This repo generally tries to maintain type-correctness (via `mypy` and `pyright`) and complete unit test coverage.
Expand All @@ -41,7 +45,13 @@ Update top-most `__init__.py`:
__version__ = "X.0.1"
```

Update `CHANGELOG.md`:
Update `CHANGELOG.md`. To see recently closed issues run:

```bash
ds recent-closed
```

You can also look at the [unreleased](https://github.com/metaist/attrbox/compare/prod...main) log too.

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

Expand All @@ -65,25 +75,19 @@ Sections order is: `Fixed`, `Changed`, `Added`, `Deprecated`, `Removed`, `Securi
**Security**
```

###
### Final checks, tag, and push

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

# update docs
pdm docs
# final checks again every supported python version
ds dev-all # requires uv >= 0.3.0

# check build
pip install -e .
# final build
ds docs build

# 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
# commit, push tags, create a new release
ds release: $VER
```

[Create the release on GitHub](https://github.com/metaist/attrbox/releases/new). The `pypi.yaml` workflow will attempt to publish it to PyPI.
[Review the release on GitHub](https://github.com/metaist/attrbox/releases). Once published, the `pypi.yaml` workflow will attempt to publish it to PyPI.
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ dependencies = [
"tomli==2.0.1; python_version < '3.11'",
]
optional-dependencies = { dev = [
# dev => latest
"black",
"build",
"coverage",
"ds-run>=1.3.0",
"mypy",
"pdm",
"pdoc3",
"pyright",
"pytest-cov",
Expand Down
Loading

0 comments on commit 3cd38a0

Please sign in to comment.