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

Conda Package Build Process #154

Merged
merged 18 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions .github/workflows/unittest.yml → .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
conda-build:
python-build:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -54,21 +54,50 @@ jobs:
- conda-forge
- mcvine
- mantid
- name: install multiphonon
run: |
python -m pip install -e .
- name: building python wheel
- name: Build python wheel
shell: bash -l {0}
run: |
python -m build --wheel --no-isolation
check-wheel-contents dist/multiphonon-*.whl
- name: Upload python wheel in the repo # the artifact is saved for building the conda package
uses: actions/upload-artifact@v4
with:
name: multiphonon_wheel
path: dist/multiphonon-*.whl
conda-build:
needs: python-build
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
environment-file: conda_environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/conda_environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/conda_environment.yml') }}
condarc: |
channels:
- conda-forge
- mantid
- mcvine
- name: Download python wheel from python-build
uses: actions/download-artifact@v4
with:
name: multiphonon_wheel
path: dist
- shell: bash -l {0}
run: |
# show files
ls -la
- name: build conda package
shell: bash -l {0}
run: |
# set up environment
# enter conda
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
CHANNELS="--channel mcvine --channel mantid --channel conda-forge"
VERSION=$(versioningit ../) conda mambabuild --output-folder . .
conda verify noarch/multiphonon*.tar.bz2
- name: upload conda package to anaconda
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
conda.recipe/
src/multiphonon/_version.py
!conda.recipe/meta.yaml

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@ This code converts a S(Q,E) INS spectrum to DOS.
* Intermediate results are saved for further investigation
* Handle inputs in nxs and nxspe files for sample and empty can measurements (requires Mantid)

## Development Installation and Testing

Create and activate conda environment for shiver development

```bash
conda env create
# or
mamba env create

conda activate multiphonon
```
The environment.yml is used for building the code in editable mode and creating the python wheel

Install multiphonon (in editable mode)

```bash
python -m pip install -e .

```

```bash
pytest

```

The conda_environment.yml is only used to build the multiphonon as a conda package.

## Installation

Installation is handled with conda. Please see [Installation instructions](https://sns-chops.github.io/multiphonon/installation.html) for details.
Expand Down
1 change: 0 additions & 1 deletion conda-recipe/bld.bat

This file was deleted.

3 changes: 0 additions & 3 deletions conda-recipe/build.sh

This file was deleted.

37 changes: 0 additions & 37 deletions conda-recipe/meta.yaml

This file was deleted.

1 change: 0 additions & 1 deletion conda-recipe/run-build.sh

This file was deleted.

54 changes: 54 additions & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# load information from pyproject.toml
{% set pyproject = load_file_data('pyproject.toml') %}
{% set project = pyproject.get('project', {}) %}
{% set license = project.get('license').get('text') %}
{% set description = project.get('description') %}
{% set project_url = pyproject.get('project', {}).get('urls') %}
{% set url = project_url.get('homepage') %}
# this will get the version set by environment variable
{% set version = environ.get('VERSION') %}
{% set git_describe_number = environ.get('GIT_DESCRIBE_NUMBER', '0') | string %}

package:
name: multiphonon
version: {{version}}

channels:
- conda-forge

source:
path: ..

build:
noarch: python
number: {{ git_describe_number }}
string: py{{py}}
script: {{ PYTHON }} -m pip install . --no-deps --ignore-installed -vvv

requirements:
host:
- python
- versioningit

build:
- setuptools
- versioningit

run:
- numpy
- histogram
- scipy
- matplotlib
- mantid

test:
imports:
- multiphonon


about:
home: {{ url }}
license: {{ license }}
license_family: GPL
license_file: ../LICENSE
summary: {{ description }}
37 changes: 37 additions & 0 deletions conda_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#Only for conda build with boa depedency
#Only use for building a conda package: conda mambabuild
name: multiphonon_conda_build_only
channels:
- conda-forge
- mantid
- mcvine
dependencies:
- anaconda-client
- boa
- check-wheel-contents
- conda-build
- conda-verify
- coverage
- mantid >= 6.4
- matplotlib
- libmamba
- libarchive
- pre-commit
- python >=3.8
- pytest
- pytest-cov
- python-build
- sphinx
- sphinx-rtd-theme
- numpydoc
- versioningit
- setuptools
- coveralls
- ipywidgets # used in one test
- pyre == 0.8.3
- histogram
- pip
- pip:
- numpy #<2.0.0
- scipy
- ipywe == 0.1.3a1
18 changes: 10 additions & 8 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#default environment for installing python package
#Note: Use this
name: multiphonon
channels:
- conda-forge
- mcvine
- mantid
dependencies:
- anaconda-client
- boa
#- anaconda-client
#- boa
- check-wheel-contents
- conda-build
- conda-verify
#- conda-build
#- conda-verify
- coverage
- histogram == 0.3.9
- numpy == 1.20.3
- scipy == 1.9.0
- numpy >= 1.20.3,< 2.0
- scipy >= 1.9.0,< 1.14.0
- python >=3.8
- pyre == 0.8.3
- mantid == 6.4
- matplotlib
- libmamba
- libarchive
#- libmamba
#- libarchive
- pre-commit
- pytest
- pytest-cov
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ requires = [
"wheel",
"toml",
"versioningit",
"numpy == 1.20.3",
"scipy == 1.9.0"
"numpy >= 1.20.3, <2.0",
"scipy >= 1.9.0, < 1.14.0"
]
build-backend = "setuptools.build_meta"

Expand Down
Loading