-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from n-takumasa/env
dev: migrate to tox-uv and fix metadata
- Loading branch information
Showing
11 changed files
with
273 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,93 +3,96 @@ name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI | |
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
- "v*" | ||
|
||
jobs: | ||
build: | ||
name: Build distribution 📦 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version-file: "pyproject.toml" | ||
|
||
- name: Install Hatch | ||
run: pip install --upgrade hatch | ||
- name: Update pip | ||
run: python -m pip install --upgrade pip | ||
|
||
- name: Build a binary wheel and a source tarball | ||
run: hatch build | ||
- name: Install uv | ||
uses: astral-sh/setup-uv@v3 | ||
|
||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Build a binary wheel and a source tarball | ||
run: uv build | ||
|
||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-pypi: | ||
name: >- | ||
Publish Python 🐍 distribution 📦 to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
needs: | ||
- build | ||
- build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/json-with-comments | ||
url: https://pypi.org/p/janaf | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
name: >- | ||
Sign the Python 🐍 distribution 📦 with Sigstore | ||
and upload them to GitHub Release | ||
needs: | ||
- publish-to-pypi | ||
- publish-to-pypi | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
id-token: write # IMPORTANT: mandatory for sigstore | ||
contents: write # IMPORTANT: mandatory for making GitHub Releases | ||
id-token: write # IMPORTANT: mandatory for sigstore | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Sign the dists with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes "" | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Upload to GitHub Release using the `gh` CLI. | ||
# `dist/` contains the built packages, and the | ||
# sigstore-produced signatures and certificates. | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Sign the dists with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes "" | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Upload to GitHub Release using the `gh` CLI. | ||
# `dist/` contains the built packages, and the | ||
# sigstore-produced signatures and certificates. | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,9 @@ wheels/ | |
# lock | ||
.python-version | ||
requirements*.lock | ||
|
||
# hatch-vcs | ||
src/jsonc/_version.py | ||
|
||
# coverage | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,62 +2,75 @@ | |
requires = ["hatchling", "hatch-vcs"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.version] | ||
source = "vcs" | ||
[tool.hatch] | ||
version.source = "vcs" | ||
build.hooks.vcs.version-file = "src/jsonc/_version.py" | ||
build.targets.sdist.exclude = [ | ||
"/.github" | ||
] | ||
build.targets.wheel.packages = ["src/jsonc"] | ||
|
||
[project] | ||
dynamic = ["version"] | ||
name = "json-with-comments" | ||
description = "JSON with Comments (jsonc) for Python" | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
license = "MIT" | ||
license = { text = "MIT" } | ||
authors = [ | ||
{ name = "Takumasa Nakamura", email = "[email protected]" }, | ||
] | ||
keywords = ["jsonc", "json with comments"] | ||
classifiers = [ | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"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 :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
] | ||
dependencies = [] | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
Repository = "https://github.com/n-takumasa/json-with-comments" | ||
urls.Repository = "https://github.com/n-takumasa/json-with-comments" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
exclude = [ | ||
"/.github" | ||
] | ||
dependencies = [] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["jsonc"] | ||
[tool.uv] | ||
managed = false | ||
|
||
[[tool.hatch.envs.test.matrix]] | ||
python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | ||
|
||
[tool.ruff] | ||
target-version = "py38" | ||
line-length = 88 | ||
|
||
[tool.ruff.lint] | ||
select = ["ALL"] | ||
ignore = [ | ||
"ANN", # flake8-annotations | ||
"D", # pydocstyle | ||
"FIX", # flake8-fixme | ||
"TD", # flake8-todos | ||
"PTH123", # flake8-use-pathlib: builtin-open | ||
"PLR0913", # too-many-arguments | ||
# Conflicting lint rules | ||
"W191", "E111", "E114", "E117", "D206", "D300", "Q000", "Q001", "Q002", "Q003", | ||
"COM812", "COM819", "ISC001", "ISC002", "E501", | ||
lint.extend-select = [ | ||
"B", # flake8-bugbear | ||
"I", # isort | ||
"UP", # pyupgrade | ||
] | ||
|
||
[tool.ruff.lint.per-file-ignores] | ||
"__init__.py" = [ | ||
"F401", # Pyflakes: unused-import | ||
] | ||
"**/tests/**/*.py" = [ | ||
"S101", # flake8-bandit: assert | ||
"PLR2004", # magic-value-comparison | ||
[tool.pytest.ini_options] | ||
minversion = "6.0" | ||
addopts = "--doctest-modules --doctest-glob='*.md' --ignore='src/jsonc/_types.py'" | ||
|
||
[tool.coverage] | ||
run.source_pkgs = ["jsonc", "tests"] | ||
run.branch = true | ||
run.parallel = true | ||
report.exclude_lines = [ | ||
"no cov", | ||
"if __name__ == .__main__.:", | ||
"if TYPE_CHECKING:", | ||
"@overload", | ||
] | ||
|
||
[tool.mypy] | ||
files = "src" | ||
strict = true | ||
warn_unreachable = true | ||
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pytest | ||
pytest-cov | ||
ruff | ||
mypy[install-types] | ||
tox >= 4 | ||
tox-uv |
Oops, something went wrong.