From 15e23444ac53330174873dabf0d613a7370a8032 Mon Sep 17 00:00:00 2001 From: WEN Hao Date: Tue, 10 Sep 2024 00:16:43 +0800 Subject: [PATCH] migrate package build system --- .github/workflows/publish.yml | 9 ++++-- .github/workflows/run-pytest.yml | 4 +-- pyproject.toml | 54 ++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4fd900d..a9e8020 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,11 +32,16 @@ jobs: cache: 'pip' # caching pip dependencies - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade pip setuptools wheel build pip install -r requirements.txt + - name: Install Hatch + uses: pypa/hatch@install + - name: List installed Python packages + run: | + python -m pip list - name: Build run: | - python setup.py sdist bdist_wheel + python -m build - name: Upload artifact uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/run-pytest.yml b/.github/workflows/run-pytest.yml index 8fa67b2..62eb8a2 100644 --- a/.github/workflows/run-pytest.yml +++ b/.github/workflows/run-pytest.yml @@ -12,7 +12,7 @@ on: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] @@ -34,7 +34,7 @@ jobs: python -m pip freeze - name: Run test with pytest and collect coverage run: | - pytest --cov=sphinx_emoji_favicon -v -s test + pytest --cov=sphinx_emoji_favicon -vv -s test - name: Upload coverage to Codecov if: matrix.python-version == '3.10' uses: codecov/codecov-action@v4 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bbc8dd8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,54 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "sphinx-emoji-favicon" +dynamic = ["version"] +description = "A simple sphinx extension to add emoji favicons to html pages." +readme = "README.md" +license = { file = "LICENSE" } +requires-python = ">=3.7" +authors = [ + { name = "DeepPSP", email = "wenh06@gmail.com" }, +] +classifiers = [ + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +dependencies = [ + "docutils", + "emoji", + "requests", + "sphinx", +] + +[project.optional-dependencies] +dev = [ + "emoji", + "sphinx-favicon", + "tqdm", +] +test = [ + "emoji", + "sphinx-favicon", + "tqdm", +] + +[project.urls] +Homepage = "https://github.com/DeepPSP/sphinx-emoji-favicon" + +[tool.hatch.version] +path = "sphinx_emoji_favicon/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/sphinx_emoji_favicon", +]