Skip to content

Commit

Permalink
Move to setup.cfg based install (#61)
Browse files Browse the repository at this point in the history
* Move from poetry to standard setup.cfg based install
* Fix actions
* Fix requirements
* Add flake8 as dev dependency
* Update pre-commit versions
* Fix test
  • Loading branch information
stefsmeets authored Jan 17, 2023
1 parent 5a8051a commit 3b390b6
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 1,706 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.7
architecture: x64
python-version: 3.9

- name: Install with poetry
- name: Install dependencies
run: |
pip install poetry
- name: Build with poetry
run: poetry build

- name: Publish with poetry
run: |
poetry publish -u ${{ secrets.pypi_user }} -p ${{ secrets.pypi_pw }}
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
39 changes: 23 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
name: build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- main
workflow_dispatch:

jobs:
build:
Expand All @@ -16,30 +24,29 @@ jobs:
python-version: [3.7, 3.8, 3.9]

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 }}
architecture: x64

- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}

- name: Install
run: |
python -m pip install -e .[develop]
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --ignore E501
- name: Install with poetry
run: |
pip install poetry
# poetry install --no-dev
poetry install
- name: Test with pytest
run: |
poetry run pytest tests
- name: Build with poetry
run: poetry build
pytest tests
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
Expand All @@ -17,26 +17,26 @@ repos:
# - id: check-json
# - id: check-added-large-files
- repo: https://github.com/myint/docformatter
rev: v1.4
rev: v1.5.0
hooks:
- id: docformatter
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.5.0
rev: v3.9.0
hooks:
- id: reorder-python-imports
args: [--py3-plus]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.7
rev: v2.0.1
hooks:
- id: autopep8
args: ['--in-place', '--ignore=E501,W504']
- repo: https://github.com/asottile/pyupgrade
rev: v2.15.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: ['--py36-plus']
- repo: https://github.com/PyCQA/flake8
rev: '5.0.4'
- repo: https://github.com/PyCQA/flake8
rev: '6.0.0'
hooks:
- id: flake8
args: ['--statistics', '--ignore=F401,F403,F405,F821,F841,E265,E501,A003']
Expand All @@ -51,8 +51,8 @@ repos:
'flake8-type-annotations',
'flake8-builtins',
]
- repo: https://github.com/kynan/nbstripout
rev: 0.4.0
hooks:
- id: nbstripout
files: ".ipynb"
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
files: ".ipynb"
29 changes: 29 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
include .pre-commit-config.yaml
include THANKS.md
include LICENCE
include notebooks/*.ipynb
include notebooks/nav.nav
include notebooks/readme.md
include docs/*.md
include docs/*.png
include docs/*.py
include requirements.txt
include scripts/*.py
include setup_win.bat
include tests/*.py
include tests/config/*.yaml
include tests/config/*/*.yaml
include instamatic/camera/*.dll
include instamatic/camera/*.h
include instamatic/camera/*.lockfile
include instamatic/camera/*.md
include instamatic/camera/tpx/*.bpc
include instamatic/camera/tpx/*.dacs
include instamatic/camera/tpx/*.txt
include instamatic/config/*.yaml
include instamatic/config/alignments/*.yaml
include instamatic/config/calibration/*.yaml
include instamatic/config/camera/*.yaml
include instamatic/config/microscope/*.yaml
include instamatic/config/scripts/*.md
include instamatic.neural_network/*.p
Loading

0 comments on commit 3b390b6

Please sign in to comment.