Skip to content

Commit

Permalink
use pyproject.toml ... modernize build (#51)
Browse files Browse the repository at this point in the history
* convert to pyproject

* update tests

* update pyproject

* working build

* update test run line

* rename build main

* fix typo

* update lint
  • Loading branch information
tlambert03 authored Jul 24, 2022
1 parent efee3a9 commit cba1f91
Show file tree
Hide file tree
Showing 13 changed files with 259 additions and 306 deletions.
16 changes: 16 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://github.com/c4urself/bump2version/issues/42
# :(
[bumpversion]
current_version = 0.7.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}
commit = True
tag = True

[bumpversion:file:setup.py]
search = version="{current_version}"
replace = version="{new_version}"

[bumpversion:file:napari_aicsimageio/__init__.py]
search = {current_version}
replace = {new_version}
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
commit-message:
prefix: "ci(dependabot):"
65 changes: 32 additions & 33 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
name: Build Main
name: CI

on:
push:
branches:
- main
schedule:
# <minute [0,59]> <hour [0,23]> <day of the month [1,31]> <month of the year [1,12]> <day of the week [0,6]>
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07
# Run every Monday at 18:00:00 UTC (Monday at 10:00:00 PST)
- cron: "0 18 * * 1"
pull_request:
branches:
- main
workflow_dispatch:

jobs:
check-manifest:
name: Check Manifest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- run: pip install check-manifest && check-manifest

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
os: [
ubuntu-18.04,
ubuntu-20.04,
windows-latest,
macOS-10.15,
]
python-version: [3.8, 3.9, "3.10"]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Install qt support libs
Expand All @@ -53,50 +57,45 @@ jobs:
- name: Test with pytest
uses: GabrielBB/xvfb-action@v1
with:
run: python -m pytest --cov-report xml --cov=napari_aicsimageio napari_aicsimageio/tests/
run: python -m pytest --cov-report=xml --cov=napari_aicsimageio
- name: Upload codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Lint with flake8
run: |
flake8 napari_aicsimageio --count --verbose --show-source --statistics
isort napari_aicsimageio --check-only
mypy napari_aicsimageio
black --check --exclude vendor napari_aicsimageio
pip install pre-commit
- name: Lint with pre-commit
run: pre-commit run --all-files

publish:
if: "contains(github.event.head_commit.message, 'Bump version')"
needs: [test, lint]
needs: [check-manifest, test, lint]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install build wheel
- name: Build Package
run: |
python setup.py sdist bdist_wheel
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: aicspypi
password: ${{ secrets.PYPI_TOKEN }}
70 changes: 0 additions & 70 deletions .github/workflows/test-and-lint.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ ENV/
workbench.ipynb

# Ignore test resources directory
resources/
writer_products/
*/tests/resources/
writer_products/
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
repos:

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args: ["--in-place", "--remove-all-unused-imports"]

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

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies:
- flake8-typing-imports>=1.9.0
- flake8-pyprojecttoml

- repo: https://github.com/tlambert03/napari-plugin-checks
rev: v0.2.0
hooks:
- id: napari-plugin-checks

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
hooks:
- id: mypy
exclude: scripts

10 changes: 0 additions & 10 deletions MANIFEST.in

This file was deleted.

4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ clean: ## clean all build, python, and testing files
find . -name '*.pyo' -exec rm -fr {} +
find . -name '*~' -exec rm -fr {} +
find . -name '__pycache__' -exec rm -fr {} +
rm -fr .tox/
rm -fr .coverage
rm -fr coverage.xml
rm -fr htmlcov/
rm -fr .pytest_cache

build: ## run tox / run tests and lint
tox
3 changes: 0 additions & 3 deletions napari_aicsimageio/tests/__init__.py

This file was deleted.

Loading

0 comments on commit cba1f91

Please sign in to comment.