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

Use hatch for packaging and version bumping #669

Merged
merged 3 commits into from
Oct 18, 2023
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
71 changes: 45 additions & 26 deletions .github/workflows/sphinx-ext-pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sphinx Extensions PR
name: 'PR: esbonio-extensions'
on:
pull_request:
branches:
Expand All @@ -8,7 +8,43 @@ on:
- 'lib/esbonio-extensions/**'

jobs:
sphinx-exts:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-ext-pr-pip-deps-3.11

- run: |
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox hatch towncrier
name: Setup Environment

- run: |
set -e
./scripts/make_release.py extensions
name: Set Version

- name: Prepare Package Resources
run: |
cd lib/esbonio-extensions
python -m tox run -e pkg

- uses: hynek/build-and-inspect-python-package@v1
with:
path: lib/esbonio-extensions

test:
name: "Python v${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
Expand All @@ -22,36 +58,19 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-ext-pr-pip-deps-${{ matrix.python-version }}

- run: |
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox bump2version
python -m pip install --upgrade tox
name: Setup Environment

- run: |
set -e

# Despite the script's name, this is only used to obtain a
# dev version number e.g. v1.2.3-dev4
./scripts/make-release.sh extensions
name: Set Version
id: info
if: matrix.python-version == '3.10'

- run: |
cd lib/esbonio-extensions
python -m tox -e py`echo ${{ matrix.python-version }} | tr -d .`
name: Test

- name: Package
run: |
cd lib/esbonio-extensions
python -m tox -e pkg
if: matrix.python-version == '3.10'

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: 'dist'
path: lib/esbonio-extensions/dist
if: matrix.python-version == '3.10'
11 changes: 3 additions & 8 deletions .github/workflows/sphinx-ext-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,18 @@ jobs:

- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"

- run: |
sudo apt update
sudo apt install pandoc

python --version
python -m pip install --upgrade pip
python -m pip install --upgrade tox bump2version towncrier docutils
python -m pip install --upgrade tox hatch towncrier docutils
name: Setup Environment

- run: |
set -e

./scripts/make-release.sh extensions
./scripts/make_release.py extensions
name: Set Version
id: info

- name: Package
run: |
Expand Down
14 changes: 0 additions & 14 deletions lib/esbonio-extensions/.bumpversion.cfg

This file was deleted.

1 change: 1 addition & 0 deletions lib/esbonio-extensions/esbonio/ext/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.2.2"
9 changes: 9 additions & 0 deletions lib/esbonio-extensions/hatch.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[version]
path = "esbonio/ext/__init__.py"
validate-bump = false

[build.targets.sdist]
include = ["esbonio", "tests", "CHANGES.rst"]

[build.targets.wheel]
packages = ["esbonio"]
42 changes: 18 additions & 24 deletions lib/esbonio-extensions/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
[build-system]
requires = ["setuptools >= 61.0.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling>=1.17.1"]
build-backend = "hatchling.build"

[project]
name = "esbonio-extensions"
version = "0.2.2"
dynamic = ["version"]
description = "A collection of extensions for Sphinx and the Esbonio language server"
readme = "README.md"
requires-python = ">=3.8"
license = { text = "MIT" }
authors = [{ name = "Alex Carney", email = "[email protected]" }]
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Documentation",
"Topic :: Documentation :: Sphinx",
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Documentation",
"Topic :: Documentation :: Sphinx",
]
dependencies = ["esbonio", "platformdirs", "sphinx"]

[project.optional-dependencies]
dev = [
"black",
"flake8",
"pytest",
"pytest-cov",
"mock",
]
dev = ["black", "flake8", "pytest", "pytest-cov", "mock"]
spelling = ["pyspellchecker"]
tutorial = ["nbformat"]

Expand All @@ -42,8 +36,8 @@ tutorial = ["nbformat"]
"Documentation" = "https://swyddfa.github.io/esbonio/"
"Source Code" = "https://github.com/swyddfa/esbonio"

[tool.setuptools.packages.find]
exclude = ["tests*"]
[tool.check-wheel-contents]
ignore = ["W004"]

[tool.towncrier]
filename = "CHANGES.rst"
Expand Down
3 changes: 0 additions & 3 deletions lib/esbonio-extensions/setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions lib/esbonio-extensions/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ commands =
pytest --cov=esbonio

[testenv:pkg]
description = Prepare the resources to be shipped with the package
deps =
build
../esbonio
sphinx-design
usedevelop = True
usedevelop = true
allowlist_externals =
cp
mkdir
commands =

sphinx-build -b tutorial ../../docs/ ../../docs/_build/tutorial
mkdir esbonio/tutorial_demo
cp -r ../../docs/_build/tutorial/extensions esbonio/tutorial_demo/extensions
Expand Down