Skip to content

Commit

Permalink
Add rye. (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasraabe authored Apr 26, 2024
1 parent 9fe1dce commit 90536cf
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 97 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ on:

jobs:

run-type-checking:

name: Run tests for type-checking
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: .python-version
allow-prereleases: true
cache: pip
- run: pip install tox-uv
- run: tox -e typing

run-tests:

name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
Expand Down
91 changes: 73 additions & 18 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,91 @@
name: PyPI
name: Publish Python 🐍 distribution 📦 to PyPI

on: push

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.8
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8

python-version: "3.x"
- name: Install pypa/build
run: >-
python -m
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
run: python3 -m 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
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pytask-latex
permissions:
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
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
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
runs-on: ubuntu-latest

permissions:
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:
password: ${{ secrets.PYPI_API_TOKEN }}
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 }}'
20 changes: 1 addition & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
args: [--branch, main]
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- id: python-check-mock-methods
Expand Down Expand Up @@ -48,24 +48,6 @@ repos:
hooks:
- id: codespell
args: [-L als, -L falsy]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.9.0'
hooks:
- id: mypy
additional_dependencies: [
attrs>=21.3.0,
click,
pytask>=0.4.0,
types-PyYAML,
types-setuptools
]
pass_filenames: false
- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
hooks:
- id: check-manifest
args: [--no-build-isolation]
additional_dependencies: [setuptools-scm, toml, wheel]
- repo: meta
hooks:
- id: check-hooks-apply
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12.2
10 changes: 7 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ This is a record of all past pytask-latex releases and what went into them in re
chronological order. Releases follow [semantic versioning](https://semver.org/) and all
releases are available on [Anaconda.org](https://anaconda.org/conda-forge/pytask-latex).

## 0.4.2 - 2023-xx-xx
## 0.4.3 - 2024-xx-xx

- {pull}`75` adds rye.

## 0.4.2 - 2023-11-30

- {pull}`65` simplifies dependency management.
- {pull}`66` removes using `MetaNode`.
- {pull}`72` updates syntax of tests.
- {pull}`72` updates the syntax of tests.

## 0.4.1 - 2023-10-12

Expand All @@ -26,7 +30,7 @@ releases are available on [Anaconda.org](https://anaconda.org/conda-forge/pytask

## 0.2.1 - 2022-04-19

- {pull}`40` fixes the error message which advises user to transition to the new
- {pull}`40` fixes the error message which advises the user to transition to the new
interface.

## 0.2.0 - 2022-04-16
Expand Down
30 changes: 0 additions & 30 deletions environment.yml

This file was deleted.

61 changes: 34 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "pytask_latex"
Expand All @@ -10,13 +10,17 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only"
"Programming Language :: Python :: 3 :: Only",
]
requires-python = ">=3.8"
dependencies = [ "latex-dependency-scanner>=0.1.1", "pluggy>=1.0.0", "pytask>=0.4.0"]
dynamic = [ "version" ]
authors = [ { name = "Tobias Raabe", email = "[email protected]"} ]
readme = { file = "README.md", content-type = "text/markdown"}
dependencies = [
"latex-dependency-scanner>=0.1.3",
"pluggy>=1.0.0",
"pytask>=0.4.0",
]
dynamic = ["version"]
authors = [{ name = "Tobias Raabe", email = "[email protected]" }]
readme = { file = "README.md", content-type = "text/markdown" }
license = { text = "MIT" }

[project.urls]
Expand All @@ -28,28 +32,32 @@ Tracker = "https://github.com/pytask-dev/pytask-latex/issues"

[project.optional-dependencies]
test = ["pytest", "pytest-cov", "pytest-xdist"]

[tool.setuptools]
include-package-data = true
zip-safe = false
platforms = [ "any",]
license-files = [ "LICENSE" ]

[tool.check-manifest]
ignore = ["src/pytask_latex/_version.py"]
typing = [
"mypy>=1.10.0",
]

[project.entry-points.pytask]
pytask_latex = "pytask_latex.plugin"

[tool.setuptools.package-dir]
"" = "src"
[tool.rye]
managed = true

[tool.hatch.build.hooks.vcs]
version-file = "src/pytask_latex/_version.py"

[tool.hatch.build.targets.sdist]
exclude = ["tests"]
only-packages = true

[tool.hatch.build.targets.wheel]
exclude = ["tests"]
only-packages = true

[tool.setuptools.packages.find]
where = [ "src" ]
namespaces = false
[tool.hatch.version]
source = "vcs"

[tool.setuptools_scm]
write_to = "src/pytask_latex/_version.py"
[tool.hatch.metadata]
allow-direct-references = true

[tool.mypy]
files = ["src", "tests"]
Expand All @@ -73,9 +81,9 @@ unsafe-fixes = true

[tool.ruff.lint]
extend-ignore = [
"ANN401", # Allow typing.Any.
"COM812", # Comply with ruff-format
"ISC001", # Comply with ruff-format
"ANN401", # Allow typing.Any.
"COM812", # Comply with ruff-format
"ISC001", # Comply with ruff-format
]
select = ["ALL"]

Expand All @@ -89,7 +97,6 @@ force-single-line = true
convention = "numpy"

[tool.pytest.ini_options]
# Do not add src since it messes with the loading of pytask-parallel as a plugin.
testpaths = ["src", "tests"]
markers = [
"wip: Tests that are work-in-progress.",
Expand Down
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ passenv = CI
extras = test
commands =
pytest {posargs}

[testenv:typing]
extras = typing
commands = mypy

0 comments on commit 90536cf

Please sign in to comment.