Skip to content

Commit

Permalink
Make Releasing A Lot Easier (#9)
Browse files Browse the repository at this point in the history
* ci: add .github yamls required for nicer releasing
* maint: use setuptools_scm like the rest of the hera stack
* maint: require pyuvdata for tests
  • Loading branch information
steven-murray authored Feb 22, 2023
1 parent 7cdd8b6 commit 555b74c
Show file tree
Hide file tree
Showing 16 changed files with 294 additions and 220 deletions.
21 changes: 21 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[flake8]
ignore =
E203 # No space before colon
W503
A003 # Class attribute shadows a python builtin -- not much chance of that causing a problem
D401 # First line should be in imperative mood -- cached_properties don't fit this bill.
D101 # Missing docstring in public class -- my docstrings are in the __init__ which seems to fail this ?
RST210 # Otherwise it flags down **kwargs in docstrings.
# These are the only things currently checked, but should be expanded.
# Would be much easier to use black.
select =
E9
F63
F7
F82
max-line-length = 127
max-complexity = 10
inline-quotes = double
per-file-ignores =
tests/*:D
**/__init__.py:F401
27 changes: 27 additions & 0 deletions .github/workflows/check-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check Distribution Build

on: push

jobs:
check-build:
name: Twine Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Build Tools
run: pip install build twine

- name: Build a binary wheel and a source tarball
run: |
python -m build -s .
- name: Check Distribution
run: |
twine check dist/*
18 changes: 18 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Labeler

on:
push:
branches:
- main

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v4.1.0
with:
skip-delete: true
31 changes: 31 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Python distributions to PyPI

on:
release:
types: [published]

jobs:
build-n-publish:
name: Make Release on PyPI and Github
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Build Tools
run: pip install build

- name: Build a binary wheel and a source tarball
run: |
python -m build -s .
ls dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
50 changes: 0 additions & 50 deletions .github/workflows/python-package-conda.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Update Draft Release

on: push

jobs:
draft-release:
name: Update Draft Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Publish the release notes
uses: release-drafter/release-drafter@v5.21.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run Tests

on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install
run: |
pip install .[dev]
- name: Test with pytest
run: pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
fail_ci_if_error: true
verbose: true
58 changes: 58 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
exclude: '^uvtools/data/'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
args: ['--maxkb=1000']
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: check-merge-conflict
- id: mixed-line-ending
args: ['--fix=no']

- repo: https://github.com/PyCQA/flake8
rev: '5.0.4' # pick a git hash / tag to point to
hooks:
- id: flake8
additional_dependencies:
- flake8-quotes
- flake8-comprehensions
- flake8-builtins
- flake8-eradicate
- pep8-naming
- flake8-docstrings
- flake8-rst-docstrings
- flake8-rst
- flake8-copyright

# - repo: https://github.com/psf/black
# rev: 22.10.0
# hooks:
# - id: black

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: rst-backticks

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]


- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py38-plus]
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

1 change: 0 additions & 1 deletion hera_filters/VERSION

This file was deleted.

12 changes: 10 additions & 2 deletions hera_filters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
from importlib.metadata import PackageNotFoundError, version

from . import dspec
from . import version

__version__ = version.version
try:
from ._version import version as __version__
except ModuleNotFoundError: # pragma: no cover
try:
__version__ = version("hera_filters")
except PackageNotFoundError:
# package is not installed
__version__ = "unknown"
Loading

0 comments on commit 555b74c

Please sign in to comment.