Skip to content

Commit

Permalink
Merge pull request #178 from mwcraig/update-setup
Browse files Browse the repository at this point in the history
Switch to hatch/pyproject
  • Loading branch information
mwcraig authored Sep 19, 2024
2 parents bc9a35e + 315fff0 commit 82cc08e
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 2,325 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# Open update PRs in groups rather than one-by-one
groups:
actions:
patterns:
- "*"
55 changes: 55 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and upload to PyPI

on:
# Allow manual triggering of the workflow, but note that the upload
# to PyPI step will not run manual trigger.
workflow_dispatch:
# Run workflow on pullrequests, but note that the upload to PyPI step
# will not run on pull requests.
pull_request:
# Run workflow on push to main branch, but note that the upload to
# PyPI step will not run on pushes. We could change that if we wanted
# to have it publish on tags -- see the upload_pypi job below.
push:
branches:
- main
# Run workflow on GitHub release done through the UI -- this is the only
# time the upload to PyPI step will run.
release:
types:
- published

jobs:
build_wheel_sdist:
name: Build wheel and sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build wheel and sdist
run: pipx run build

- uses: actions/upload-artifact@v4
with:
name: wheel-sdist
path: dist/*

upload_pypi:
needs: [build_wheel_sdist]
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: wheel-sdist
path: dist
merge-multiple: true

- uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ reducer.egg-info
docs/_build
docs/api
.ropeproject
_version.py
56 changes: 56 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "reducer"
dynamic = ["version"]
description = "Process FITS files"
readme = "README.rst"
license = "BSD-3-clause"
authors = [
{ name = "Matt Craig", email = "[email protected]" },
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Astronomy",
]
dependencies = [
"astropy>=4.0",
"ccdproc>=2",
"dask",
"ipywidgets >=7.5",
"matplotlib",
"msumastro>=1",
"numpy",
"scikit-image",
"scipy",
]

[project.optional-dependencies]
docs = [
"numpydoc",
"sphinx-argparse",
"sphinx_rtd_theme",
]

[project.scripts]
reducer = "reducer:main"

[project.urls]
Homepage = "http://reducer.readthedocs.org"

[tool.hatch.version]
source = "vcs"

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

[tool.hatch.build.targets.sdist]
include = [
"/reducer",
]
Loading

0 comments on commit 82cc08e

Please sign in to comment.