diff --git a/.github/workflows/sphinx-ext-pr.yml b/.github/workflows/sphinx-ext-pr.yml index 73a5319a..efd96812 100644 --- a/.github/workflows/sphinx-ext-pr.yml +++ b/.github/workflows/sphinx-ext-pr.yml @@ -1,4 +1,4 @@ -name: Sphinx Extensions PR +name: 'PR: esbonio-extensions' on: pull_request: branches: @@ -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: @@ -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' diff --git a/.github/workflows/sphinx-ext-release.yml b/.github/workflows/sphinx-ext-release.yml index d8e83f04..313bbbaa 100644 --- a/.github/workflows/sphinx-ext-release.yml +++ b/.github/workflows/sphinx-ext-release.yml @@ -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: | diff --git a/lib/esbonio-extensions/.bumpversion.cfg b/lib/esbonio-extensions/.bumpversion.cfg deleted file mode 100644 index ae95c4b8..00000000 --- a/lib/esbonio-extensions/.bumpversion.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[bumpversion] -current_version = 0.2.2 -commit = False -tag = False -parse = (?P\d+)\.(?P\d+)\.(?P\d+)(.dev(?P\d+))? -serialize = - {major}.{minor}.{patch}.dev{dev} - {major}.{minor}.{patch} - -[bumpversion:file:pyproject.toml] - -[bumpversion:file:esbonio/tutorial.py] - -[bumpversion:file:esbonio/relevant_to/__init__.py] diff --git a/lib/esbonio-extensions/esbonio/ext/__init__.py b/lib/esbonio-extensions/esbonio/ext/__init__.py index e69de29b..b5fdc753 100644 --- a/lib/esbonio-extensions/esbonio/ext/__init__.py +++ b/lib/esbonio-extensions/esbonio/ext/__init__.py @@ -0,0 +1 @@ +__version__ = "0.2.2" diff --git a/lib/esbonio-extensions/hatch.toml b/lib/esbonio-extensions/hatch.toml new file mode 100644 index 00000000..98c041cc --- /dev/null +++ b/lib/esbonio-extensions/hatch.toml @@ -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"] diff --git a/lib/esbonio-extensions/pyproject.toml b/lib/esbonio-extensions/pyproject.toml index 9d7539b0..b4c164a9 100644 --- a/lib/esbonio-extensions/pyproject.toml +++ b/lib/esbonio-extensions/pyproject.toml @@ -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 = "alcarneyme@gmail.com" }] 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"] @@ -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" diff --git a/lib/esbonio-extensions/setup.py b/lib/esbonio-extensions/setup.py deleted file mode 100644 index b908cbe5..00000000 --- a/lib/esbonio-extensions/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -import setuptools - -setuptools.setup() diff --git a/lib/esbonio-extensions/tox.ini b/lib/esbonio-extensions/tox.ini index 8005e6a4..b8d91c6b 100644 --- a/lib/esbonio-extensions/tox.ini +++ b/lib/esbonio-extensions/tox.ini @@ -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