Skip to content

Commit

Permalink
huge amount of misc maint fixes in preparation for 0.5 (#68)
Browse files Browse the repository at this point in the history
* huge amount of misc maint fixes

* add tools for release automation

* add numpy to setup py installs
  • Loading branch information
sappelhoff authored Jan 3, 2021
1 parent 8896a67 commit d2babe4
Show file tree
Hide file tree
Showing 15 changed files with 246 additions and 122 deletions.
27 changes: 11 additions & 16 deletions CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ navigate to the `/docs` directory and call `make html`. The HTML pages will
be in `_build/html`.

##### Making a release
(needs admin rights for GitHub and PyPi)

You will need admin rights for GitHub.
The PyPi credentials are handled via a "GitHub secret"

1. go to your python environment for `pybv`
1. Make sure all tests pass and the docs are built cleanly
Expand All @@ -46,28 +48,21 @@ be in `_build/html`.
[semantic versioning](https://semver.org/) with its `major.minor.patch`
style.
1. Update `docs/changelog.rst`, renaming the "current" headline to the new
version and adding all "Authors" for the release
version and (if applicable) extending the "Authors" section of the document
- "Authors" are all people who committed code or in other ways contributed
to `pybv` **for this release** (e.g., by reviewing PRs).
1. Commit the change and git push to master (or make a pull request). Include
"REL" in your commit message.
1. remove the `build/` and `dist/` directories from the pybv root directory
1. run `pip install -e .` and then `python setup.py sdist bdist_wheel`
1. upload to [test-pypi](https://test.pypi.org/):
1. `twine upload --repository-url https://test.pypi.org/legacy/ dist/*`
1. inspect it on [test-pypi](https://test.pypi.org/)
1. test installing it via
`pip install --index-url https://test.pypi.org/simple/ pybv`
1. if everything is OK, proceed
1. run `twine upload dist/*` to upload to pypi
1. make an annotated tag `git tag -a -m "v1.2.3" v1.2.3 upstream/master` (This
to `pybv` (e.g., by extensively reviewing PRs).
1. Commit the change and git push to master (or make a pull request and merge it).
Include "REL" in your commit message.
1. Then, make an annotated tag `git tag -a -m "v1.2.3" v1.2.3 upstream/master` (This
assumes that you have a git remote configured with the name "upstream" and
pointing to https://github.com/bids-standard/pybv). Note also that the
version from `__init__.py` is preprended with a `v`: `1.2.3` --> `v1.2.3`
**NOTE: Make sure you have your `master` branch up to date for this step!**
1. `git push --follow-tags upstream`
1. Make a [release on GitHub](https://help.github.com/en/articles/creating-releases),
using the git tag from the previous step (e.g., `v1.2.3`). Fill the tag name
into all fields of the release.
1. This will trigger a GitHub Action that will build the package and release it to PyPi.

Then the release is done and `master` has to be prepared for development of
the next release:
Expand All @@ -77,5 +72,5 @@ the next release:
[semantic versioning](https://semver.org/) so that the version will be
the version that is planned to be released next (e.g., `1.3.0`)
- append `.dev0` to the version (e.g., `1.3.0.dev0`)
1. add a "current" headline to `docs/changelog.rst`
1. add a "Current (unreleased)" headline to `docs/changelog.rst`
1. commit the changes and git push to master (or make a pull request)
51 changes: 51 additions & 0 deletions .github/workflows/python_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Python build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
create:
branches: [master]
tags: ['**']

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Update pip and wheel
run: python -m pip install --upgrade pip wheel

- uses: actions/checkout@v2
- name: Build sdist
run: python setup.py sdist
- name: Install sdist
run: pip install ./dist/pybv-*
- name: Clean up working directory
run: rm -rf ./*
- name: Try importing pybv
run: python -c 'import pybv; print(pybv.__version__)'
- name: Remove sdist install
run: pip uninstall -y pybv

- uses: actions/checkout@v2
- name: Build wheel
run: python setup.py bdist_wheel
- name: Install wheel
run: pip install ./dist/pybv-*.whl
- name: Clean up working directory
run: rm -rf ./*
- name: Try importing pybv
run: python -c 'import pybv; print(pybv.__version__)'
- name: Remove wheel install
run: pip uninstall -y pybv
31 changes: 31 additions & 0 deletions .github/workflows/python_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
6 changes: 2 additions & 4 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:


jobs:
build:
test:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -56,9 +56,7 @@ jobs:
- name: Check formatting
if: "matrix.platform == 'ubuntu-18.04'"
run: |
flake8 --docstring-convention numpy .
pycodestyle pybv
run: make pep

- name: Test with pytest
run: |
Expand Down
17 changes: 17 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
include MANIFEST.in
include README.rst
include LICENSE
include requirements.txt
include requirements-dev.txt

graft docs
graft pybv
graft specification

recursive-exclude pybv/__pycache__ *
recursive-exclude pybv/tests/__pycache__ *
recursive-exclude docs/_build *
recursive-exclude docs/generated *
recursive-exclude .github *

exclude .gitignore
exclude Makefile
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ all: inplace test
inplace:
$(PYTHON) setup.py develop

test-doc:
$(PYTESTS) --doctest-modules --doctest-ignore-import-errors pybv
test:
$(PYTESTS) --doctest-modules --cov=./pybv --cov-report=xml --verbose

flake:
@if command -v flake8 > /dev/null; then \
Expand All @@ -25,9 +25,14 @@ pydocstyle:
@echo "Running pydocstyle"
@pydocstyle

check-manifest:
@echo "Running check-manifest"
@check-manifest

pep:
@$(MAKE) -k flake pydocstyle
@$(MAKE) -k flake pydocstyle check-manifest

build-doc:
cd doc; make clean
cd doc; make html
cd docs; make clean
cd docs; make html
cd docs; make view
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ The development of ``pybv`` is taking place on
`GitHub <https://github.com/bids-standard/pybv>`_.

For more information, please see
`CONTRIBUTING.md <https://github.com/bids-standard/pybv/blob/master/CONTRIBUTING.md>`_
`CONTRIBUTING.md <https://github.com/bids-standard/pybv/blob/master/.github/CONTRIBUTING.md>`_

Usage
=====
Expand Down Expand Up @@ -132,6 +132,6 @@ Acknowledgements

This package was originally adapted from the
`Philistine package <https://gitlab.com/palday/philistine>`_ by
`palday <https://palday.bitbucket.io/>`_. It copies much of the BrainVision
exporting code, removes the dependence on MNE, and focuses the code around
BrainVision I/O.
`palday <https://palday.bitbucket.io/>`_.
It copies much of the BrainVision exporting code, but removes the dependence on MNE.
Several features have been added, such as support for individual units for each channel.
6 changes: 0 additions & 6 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
:orphan:

.. _api_documentation:

=================
API Documentation
=================

Here we list the Application Programming Interface (API) for pybv.

.. contents:: Contents
:local:
:depth: 2

pybv (:py:mod:`pybv`)
=====================

Expand Down
Loading

0 comments on commit d2babe4

Please sign in to comment.