Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cruft #272

Merged
merged 2 commits into from
Jan 2, 2025
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
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/cthoyt/cookiecutter-snekpack",
"commit": "12edfcfa5f519467b5d834f0d4e706fb7cf4f065",
"commit": "b3664aa2dd1d01910b33ca36d9bc3493a61fa71c",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository
github:
- cthoyt
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!--
Thanks for contributing to `pyobo`.
To help us out with reviewing, please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?

Caution: the maintainers often take an active role in pull requests,
and may push to your branch. Therefore, you should always sync your
local copy of the repository with the remote before continuing your
work.
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->
21 changes: 17 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

name: Tests

# by default, give the GITHUB_TOKEN no permissions
# See https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions: { }

on:
push:
branches: [ main ]
Expand All @@ -13,11 +17,16 @@ on:
jobs:
lint:
name: Code Quality
permissions:
# give only read-only access to the contents of the repository
# this is the only permission this job requires, so keep it to the least privilege
# i.e., not to issues, discussions, actions, etc.
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.12", "3.10" ]
tox-command: ["manifest", "lint", "pyroma", "mypy"]
python-version: [ "3.13", "3.10" ]
tox-command: [ "lint", "pyroma", "mypy" ]
steps:
- uses: actions/checkout@v4
- name: "Install uv"
Expand All @@ -31,13 +40,15 @@ jobs:

docs:
name: Documentation
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
# We only test documentation on the latest version
# sphinx 8.0 / sphinx-rtd-theme 3.0 discontinued Python 3.9 support
# a year early, which prompted re-thinking about this.
python-version: [ "3.12" ]
python-version: [ "3.13" ]
steps:
- uses: actions/checkout@v4
- name: "Install uv"
Expand All @@ -56,11 +67,13 @@ jobs:
run: uvx -p ${{ matrix.python-version }} --with tox-uv tox -e docs-test
tests:
name: Tests
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.12", "3.10" ]
python-version: [ "3.13", "3.10" ]
steps:
- uses: actions/checkout@v4
- name: "Install uv"
Expand Down
15 changes: 9 additions & 6 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ build:
tools:
python: "3.12"

python:
install:
- method: pip
path: .
extra_requirements:
- docs
# adapted from uv recipe at https://docs.readthedocs.io/en/stable/build-customization.html#install-dependencies-with-uv
# and comment at https://github.com/readthedocs/readthedocs.org/issues/11289#issuecomment-2103832834
commands:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv venv $READTHEDOCS_VIRTUALENV_PATH
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH UV_PREVIEW=1 uv pip install .[docs]
- python -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs/source $READTHEDOCS_OUTPUT/html
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,16 @@ The final section of the README is for if you want to get involved by making a c
To install in development mode, use the following:

```console
git clone git+https://github.com/biopragmatics/pyobo.git
cd pyobo
python3 -m pip install -e .
$ git clone git+https://github.com/biopragmatics/pyobo.git
$ cd pyobo
$ uv --preview pip install -e .
```

Alternatively, install using legacy pip with `UV_PREVIEW` mode enabled
until the uv build backend becomes a stable feature:

```console
$ UV_PREVIEW=1 python3 -m pip install -e .
```

### Updating Package Boilerplate
Expand Down Expand Up @@ -578,7 +585,7 @@ You only have to do the following steps once.

#### Configuring your machine's connection to PyPI

You have to do the following steps once per machine.
You have to do the following steps once per machine.

```console
$ uv tool install keyring
Expand Down
3 changes: 3 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,6 @@

todo_include_todos = True
todo_emit_warnings = True

# Output SVG inheritance diagrams
graphviz_output_format = "svg"
9 changes: 6 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ The most recent release can be installed from

.. code-block:: shell

pip install pyobo
python3 -m pip install pyobo

The most recent code and data can be installed directly from GitHub with:

.. code-block:: shell

pip install git+https://github.com/biopragmatics/pyobo.git
python3 -m pip install git+https://github.com/biopragmatics/pyobo.git

To install in development mode, use the following:

.. code-block:: shell

git clone git+https://github.com/biopragmatics/pyobo.git
cd pyobo
pip install -e .
UV_PREVIEW=1 python3 -m pip install -e .

Note that the ``UV_PREVIEW`` environment variable is required to be
set until the uv build backend becomes a stable feature.
34 changes: 15 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# See https://setuptools.readthedocs.io/en/latest/build_meta.html
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["uv>=0.5.13,<0.6.0"]
# The uv backend entered preview mode in https://github.com/astral-sh/uv/pull/8886/files
# with the 0.5.0 release. See also https://github.com/astral-sh/uv/issues/3957 for tracking.
build-backend = "uv"

[project]
name = "pyobo"
Expand All @@ -26,11 +27,14 @@ classifiers = [
"Framework :: Pytest",
"Framework :: tox",
"Framework :: Sphinx",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3 :: Only",
"Typing :: Typed",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Chemistry",
]
Expand All @@ -47,10 +51,11 @@ keywords = [
"OBO",
]

# License Information. This can be any valid SPDX identifiers that can be resolved
# with URLs like https://spdx.org/licenses/MIT
# See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license
license = { file = "LICENSE" }
# License Information.
# See PEP-639 at https://peps.python.org/pep-0639/#add-license-files-key
license-files = [
"LICENSE",
]

requires-python = ">=3.10"
dependencies = [
Expand Down Expand Up @@ -86,7 +91,7 @@ dependencies = [
[project.optional-dependencies]
tests = [
"pytest",
"coverage",
"coverage[toml]",
]
docs = [
"sphinx>=8",
Expand All @@ -96,22 +101,13 @@ docs = [
]

# See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#urls
# and also https://packaging.python.org/en/latest/specifications/well-known-project-urls/
[project.urls]
"Bug Tracker" = "https://github.com/biopragmatics/pyobo/issues"
Homepage = "https://github.com/biopragmatics/pyobo"
Repository = "https://github.com/biopragmatics/pyobo.git"
Documentation = "https://pyobo.readthedocs.io"

[tool.setuptools]
package-dir = { "" = "src" }

[tool.setuptools.packages.find]
# this implicitly sets `packages = ":find"`
where = ["src"] # list of folders that contain the packages (["."] by default)

# See https://setuptools.pypa.io/en/latest/userguide/datafiles.html
[tool.setuptools.package-data]
"*" = ["*.*"]
Funding = "https://github.com/sponsors/cthoyt"

[project.scripts]
pyobo = "pyobo.cli:main"
Expand Down
38 changes: 25 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ envlist =
format
# format-docs
# Code quality assessment
manifest
pyroma
lint
mypy
Expand All @@ -28,7 +27,12 @@ envlist =
py
doctests
# always keep coverage-report last
# coverage-report
coverage-report

[testenv:.pkg]
# this special environment configures the build that tox does itself
set_env =
UV_PREVIEW=1

[testenv]
description = Run unit and integration tests.
Expand All @@ -41,6 +45,10 @@ commands =
extras =
# See the [project.optional-dependencies] entry in pyproject.toml for "tests"
tests
set_env =
# this setting gets inherited into all environments, meaning
# that things that call uv commands don't require a --preview
UV_PREVIEW=1

[testenv:coverage-clean]
description = Remove testing coverage artifacts.
Expand Down Expand Up @@ -85,12 +93,6 @@ skip_install = true
commands =
rstfmt docs/source/

[testenv:manifest]
deps = check-manifest
skip_install = true
commands = check-manifest
description = Check that the MANIFEST.in is written properly and give feedback on how to fix it.

[testenv:lint]
description = Check code quality using ruff and other tools.

Expand Down Expand Up @@ -168,11 +170,9 @@ allowlist_externals =
mkdir

[testenv:coverage-report]
# TODO this is broken
deps = coverage
deps = coverage[toml]
skip_install = true
commands =
coverage combine
coverage report

####################
Expand All @@ -199,7 +199,6 @@ deps =
skip_install = true
deps =
uv
setuptools
commands =
uv build --sdist --wheel --no-build-isolation

Expand All @@ -219,7 +218,7 @@ commands =
# 7. Add your token to keyring with `keyring set https://upload.pypi.org/legacy/ __token__`

[testenv:release]
description = Release the code to PyPI so users can pip install it
description = Release the code to PyPI so users can pip install it, using credentials from keyring
skip_install = true
deps =
{[testenv:build]deps}
Expand All @@ -229,6 +228,19 @@ commands =
{[testenv:build]commands}
uv publish --username __token__ --keyring-provider subprocess --publish-url https://upload.pypi.org/legacy/

[testenv:release-via-env]
description = Release the code to PyPI so users can pip install it, using credentials from the environment.
skip_install = true
deps =
{[testenv:build]deps}
uv
commands =
{[testenv:build]commands}
uv publish --publish-url https://upload.pypi.org/legacy/
passenv =
UV_PUBLISH_USERNAME
UV_PUBLISH_PASSWORD

[testenv:finish]
description =
Run a workflow that removes -dev from the version, creates a tagged release on GitHub,
Expand Down
Loading