Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pyproject.toml ... modernize build #51

Merged
merged 8 commits into from
Jul 24, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
# :(
[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
tlambert03 marked this conversation as resolved.
Show resolved Hide resolved

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:
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
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:
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
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,
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
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
tlambert03 marked this conversation as resolved.
Show resolved Hide resolved

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
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
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
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
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/
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
repos:
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved

- 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
args: ["--min-python-version=3.8.0"]

- 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
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 {} +
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
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
evamaxfield marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 0 additions & 3 deletions napari_aicsimageio/tests/__init__.py

This file was deleted.