chore: Migrate from Poetry to Hatch (#617)

This commit is contained in:
Jim Brännlund 2023-04-02 21:18:21 +02:00 committed by GitHub
parent aa9c5291b4
commit 142bd4a608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 169 additions and 217 deletions

View File

@ -1,105 +0,0 @@
name: Main
on:
create: # is used for publishing to PyPI and TestPyPI
tags: # any tag regardless of its name, no branches
push: # only publishes pushes to the main branch to TestPyPI
branches: # any maintenance branch but not tag
# avoid generic ** as it duplicates builds from temporary branches
- "master"
- "stable/**"
tags-ignore:
- >-
**
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install tox
run: python -m pip install --upgrade tox
- name: Build docs with tox
run: tox -e docs
tests:
uses: ./.github/workflows/tests.yml
publish:
if: github.repository_owner == 'pytest-dev'
name: Publish to PyPI registry
needs:
- tests
runs-on: ubuntu-latest
env:
PY_COLORS: 1
steps:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Check out src from Git
uses: actions/checkout@v3
with:
# Get shallow Git history (default) for tag creation events
# but have a complete clone for any other workflows.
# Both options fetch tags but since we're going to remove
# one from HEAD in non-create-tag workflows, we need full
# history for them.
fetch-depth: >-
${{
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
) &&
1 || 0
}}
- name: Drop Git tags from HEAD for non-tag-create events
if: >-
github.event_name != 'create' ||
github.event.ref_type != 'tag'
run: git tag --points-at HEAD | xargs git tag --delete
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1
- name: Download Package
uses: actions/download-artifact@v3
with:
name: Packages
path: dist
- name: Publish to test.pypi.org
if: >-
(
github.event_name == 'push' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
) ||
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
)
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'create' &&
github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}

View File

@ -1,10 +0,0 @@
name: Nightly tests
on:
schedule:
- cron: '1 0 * * *' # Run daily at 0:01 UTC
jobs:
tests:
if: github.repository_owner == 'pytest-dev'
uses: ./.github/workflows/tests.yml

42
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Publish
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
jobs:
publish:
if: github.repository == 'pytest-dev/pytest-html'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install dependencies
run: npm ci
- name: Build app.js
run: npm run build:ci
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1
- name: Download Package
uses: actions/download-artifact@v3
with:
name: Packages
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}

View File

@ -1,11 +1,62 @@
name: Tests
on:
workflow_call:
push:
branches:
- master
schedule:
- cron: '1 0 * * *' # Run daily at 0:01 UTC
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install tox
run: python -m pip install --upgrade tox
- name: Build docs with tox
run: tox -e docs
build_package:
name: Build Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install dependencies
run: npm ci
- name: Build app.js
run: npm run build:ci
- name: Build and Check Package
uses: hynek/build-and-inspect-python-package@v1
test_javascript:
name: javascript
name: Run javascript unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

2
.gitignore vendored
View File

@ -56,3 +56,5 @@ docs/_build/
assets/
.nyc_output
.venv/

View File

@ -1,9 +0,0 @@
module.exports = function(grunt) {
grunt.initConfig({
qunit: {
src: 'testing/js_test_report.html'
}
});
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.registerTask('test', 'qunit:src');
};

View File

@ -1,65 +1,87 @@
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
build-backend = "hatchling.build"
requires = [
"hatch-vcs>=0.3",
"hatchling>=1.13",
]
[tool.poetry]
[project]
name = "pytest-html"
description = "pytest plugin for generating HTML reports"
version = "4.0.0-rc0"
license = "MPL-2.0"
authors = [
"Dave Hunt <dhunt@mozilla.com>",
"Jim Brannlund <jimbrannlund@fastmail.com>"
]
readme = "README.rst"
homepage = "https://github.com/pytest-dev/pytest-html"
repository = "https://github.com/pytest-dev/pytest-html"
license = "MPL-2.0"
requires-python = ">=3.7"
keywords = [
"pytest",
"html",
"report",
]
authors = [
{ name = "Dave Hunt", email = "dhunt@mozilla.com" },
{ name = "Jim Brannlund", email = "jimbrannlund@fastmail.com" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Pytest",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
"Topic :: Utilities",
]
packages = [
{ include = "pytest_html", from = "src" },
dependencies = [
"pytest>=7.0.0",
"pytest-metadata>=2.0.2",
"Jinja2>=3.0.0",
]
include = [
{ path = "testing", format = "sdist" },
{ path = "docs", format = "sdist" },
"src/pytest_html/resources",
"src/pytest_html/resources/app.js",
dynamic = [
"version",
]
[tool.poetry.dependencies]
python = ">=3.7"
pytest = ">=7.0.0"
pytest-metadata = ">=2.0.2"
Jinja2 = ">=3.0.0"
[project.optional-dependencies]
test = [
"assertpy>=1.1",
"beautifulsoup4>=4.11.1",
"black>=22.1.0",
"flake8>=4.0.1",
"pre-commit>=2.17.0",
"pytest-xdist>=2.4.0",
"pytest-mock>=3.7.0",
"selenium>=4.3.0",
"tox>=3.24.5",
]
[tool.poetry.dev-dependencies]
assertpy = ">=1.1"
beautifulsoup4 = ">=4.11.1"
black = ">=22.1.0"
flake8 = ">=4.0.1"
pre-commit = ">=2.17.0"
pytest-xdist = ">=2.4.0"
pytest-mock = ">=3.7.0"
selenium = ">=4.3.0"
tox = ">=3.24.5"
[project.urls]
Homepage = "https://github.com/pytest-dev/pytest-html"
Tracker = "https://github.com/pytest-dev/pytest-html/issues"
Source = "https://github.com/pytest-dev/pytest-html"
[tool.poetry.plugins.pytest11]
html = "pytest_html.plugin"
[project.entry-points.pytest11]
env = "pytest_html.plugin"
[tool.setuptools_scm]
local_scheme = "no-local-version"
write_to = "src/pytest_html/__version.py"
[tool.hatch.version]
source = "vcs"
[tool.hatch.build.targets.wheel]
exclude = [
"src/pytest_html/scripts/*",
]
[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
]
[tool.hatch.build.hooks.vcs]
version-file = "src/pytest_html/__version.py"

View File

@ -1,2 +0,0 @@
[bdist_wheel]
universal = 0

View File

@ -1,39 +0,0 @@
from setuptools import setup
setup(
name="pytest-html",
use_scm_version={"local_scheme": "no-local-version"},
description="pytest plugin for generating HTML reports",
long_description=open("README.rst").read(),
author="Dave Hunt",
author_email="dhunt@mozilla.com",
url="https://github.com/pytest-dev/pytest-html",
package_dir={"": "src"},
packages=["pytest_html"],
package_data={"pytest_html": ["resources/*", "scripts/*"]},
entry_points={"pytest11": ["html = pytest_html.plugin"]},
setup_requires=["setuptools_scm"],
install_requires=["pytest>=5.0,!=6.0.0", "pytest-metadata", "jinja2>=3.0,<4.0"],
license="Mozilla Public License 2.0 (MPL 2.0)",
keywords="py.test pytest html report",
python_requires=">=3.6",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Framework :: Pytest",
"Intended Audience :: Developers",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
"Topic :: Utilities",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3 :: Only",
],
)