Skip to content

Commit

Permalink
Merge pull request #19 from larrybradley/packaging
Browse files Browse the repository at this point in the history
Move package metadata to pyproject.toml
  • Loading branch information
larrybradley authored Sep 19, 2023
2 parents 4cbc80a + 857e6ce commit 68e9dee
Show file tree
Hide file tree
Showing 23 changed files with 498 additions and 314 deletions.
100 changes: 74 additions & 26 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ name: CI Tests

on:
push:
branches: [ main ]
branches:
- main
tags:
- '*'
pull_request:
schedule:
# run every Monday at 6am UTC
- cron: '0 6 * * 1'
# run every Monday at 5am UTC
- cron: '0 5 * * 1'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -15,54 +19,98 @@ concurrency:
env:
TOXARGS: '-v'

permissions:
contents: read

jobs:
ci-tests:
name: ${{ matrix.os }}, ${{ matrix.tox_env }}
tests:
name: ${{ matrix.prefix }} ${{ matrix.os }}, ${{ matrix.tox_env }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.allow_failure }}
strategy:
matrix:
include:
- os: ubuntu-latest
python: '3.8'
tox_env: 'py38-test-alldeps'
- os: ubuntu-latest
python: '3.9'
tox_env: 'py39-test-alldeps'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.10'
tox_env: 'py310-test-alldeps'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
tox_env: 'py311-test-alldeps-cov'
toxposargs: --remote-data=any
allow_failure: false
prefix: ''

- os: macos-latest
python: '3.10'
tox_env: 'py310-test-alldeps'
python: '3.11'
tox_env: 'py311-test-alldeps'
allow_failure: false
prefix: ''

- os: windows-latest
python: '3.10'
tox_env: 'py310-test-alldeps'
python: '3.11'
tox_env: 'py311-test-alldeps'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.10'
tox_env: 'py310-test'
python: '3.11'
tox_env: 'py311-test'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.10'
python: '3.11'
tox_env: 'linkcheck'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.11'
tox_env: 'codestyle'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.10'
tox_env: 'linkcheck'
python: '3.11'
tox_env: 'pep517'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.10'
python: '3.11'
tox_env: 'bandit'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.8'
tox_env: 'py38-test-alldeps-astropylts-numpy118'
python: '3.9'
tox_env: 'py39-test-oldestdeps'
allow_failure: false
prefix: ''

- os: ubuntu-latest
python: '3.10'
tox_env: 'py310-test-alldeps-devdeps'
python: '3.11'
tox_env: 'py311-test-devdeps'
toxposargs: --remote-data=any
allow_failure: true
prefix: '(Allowed failure)'

steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install base dependencies
Expand All @@ -78,8 +126,8 @@ jobs:
- name: Run tests
run: tox -e ${{ matrix.tox_env }} -- ${{ matrix.toxposargs }}
- name: Upload coverage to codecov
if: "contains(matrix.tox_env, '-cov')"
if: ${{ contains(matrix.tox_env, '-cov') }}
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
files: ./coverage.xml
verbose: true
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Wheel building

on:
schedule:
# run every Monday at 5am UTC
- cron: '0 5 * * 1'
pull_request:
# We also want this workflow triggered if the 'Build all wheels'
# label is added or present when PR is updated
types:
- synchronize
- labeled
push:
branches:
- '*'
tags:
- '*'
- '!*dev*'
- '!*pre*'
- '!*post*'
workflow_dispatch:

permissions:
contents: read

jobs:
build_and_publish:
# This job builds the wheels and publishes them to PyPI for all
# tags, except those ending in ".dev". For PRs with the "Build all
# wheels" label, wheels are built, but are not uploaded to PyPI.

permissions:
contents: none

uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1

if: (github.repository == 'larrybradley/lacosmic' && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Build all wheels')))
with:
# We upload to PyPI for all tag pushes, except tags ending in .dev
upload_to_pypi: ${{ startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '.dev') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}

test_extras: test
test_command: pytest -p no:warnings --pyargs lacosmic

secrets:
pypi_token: ${{ secrets.pypi_token }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ __pycache__
*/cython_version.py
MANIFEST
htmlcov
.coverage
.coverage*
.ipynb_checkpoints
.pytest_cache

Expand All @@ -41,6 +41,7 @@ pip-wheel-metadata
# Other
.cache
.tox
.tmp
.*.sw[op]
*~

Expand Down
86 changes: 86 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
ci:
autofix_prs: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
# Prevent giant files from being committed.
- id: check-ast
# Simply check whether files parse as valid python.
- id: check-case-conflict
# Check for files with names that would conflict on a case-insensitive
# filesystem like MacOS HFS+ or Windows FAT.
- id: check-json
# Attempts to load all json files to verify syntax.
- id: check-merge-conflict
# Check for files that contain merge conflict strings.
- id: check-symlinks
# Checks for symlinks which do not point to anything.
- id: check-toml
# Attempts to load all TOML files to verify syntax.
- id: check-xml
# Attempts to load all xml files to verify syntax.
- id: check-yaml
# Attempts to load all yaml files to verify syntax.
- id: debug-statements
# Check for debugger imports and py37+ breakpoint() calls in python
# source.
- id: detect-private-key
# Checks for the existence of private keys.
- id: end-of-file-fixer
# Makes sure files end in a newline and only a newline.
exclude: ".*(svg.*|extern.*|_templates.*)$"
- id: trailing-whitespace
# Trims trailing whitespace.
exclude: ".*(data.*|extern.*)$"

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-mock-methods
# Prevent common mistakes of assert mck.not_called(), assert
# mck.called_once_with(...) and mck.assert_called.
- id: rst-directive-colons
# Detect mistake of rst directive not ending with double colon.
- id: rst-inline-touching-normal
# Detect mistake of inline code touching normal text in rst.
- id: text-unicode-replacement-char
# Forbid files which have a UTF-8 Unicode replacement character.
- id: python-check-blanket-noqa
# Enforce that all noqa annotations always occur with specific codes.

- repo: https://github.com/asottile/pyupgrade
rev: v3.11.0
hooks:
- id: pyupgrade
args: ["--py39-plus"]
exclude: ".*(extern.*)$"

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
additional_dependencies: [toml]
- id: isort
name: isort (cython)
types: [cython]
additional_dependencies: [toml]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
args: ["--ignore", "E501,W503"]

- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa

# - repo: https://github.com/MarcoGorelli/absolufy-imports
# rev: v0.3.1
# hooks:
# - id: absolufy-imports
7 changes: 6 additions & 1 deletion .readthedocs.yml → .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ build:
apt_packages:
- graphviz
tools:
python: "3.10"
python: "3.11"
jobs:
post_checkout:
- git fetch --shallow-since=2022-04-01 || true
pre_install:
- git update-index --assume-unchanged docs/conf.py

sphinx:
builder: html
Expand Down
14 changes: 13 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
1.1.0 (unreleased)
------------------

- No changes yet
General
^^^^^^^

- The minimum required Python version is 3.9. [#19]

- The minimum required Numpy version is 1.22. [#19]

- The minimum required Scipy version is 1.7.2. [#19]

- The minimum required Astropy version is 5.0. [#19]

- The project metadata is now stored in ``pyproject.toml`` (PEP 621).
[#19]


1.0.0 (2022-04-19)
Expand Down
14 changes: 0 additions & 14 deletions MANIFEST.in

This file was deleted.

10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
comment: off
codecov:
branch: main
coverage:
status:
project:
default:
target: auto
# this allows a small drop from the previous base commit coverage
threshold: 0.05%
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@ linkcheck:
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
@echo "Run 'python setup.py test' in the root directory to run doctests " \
@echo "Run 'pytest' in the root directory to run doctests " \
@echo "in the documentation."
2 changes: 0 additions & 2 deletions docs/_templates/autosummary/base.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/_templates/autosummary/class.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/_templates/autosummary/module.rst

This file was deleted.

Loading

0 comments on commit 68e9dee

Please sign in to comment.