Skip to content

Commit

Permalink
setup and meta.yaml files are added for setting up shiver wheel and c…
Browse files Browse the repository at this point in the history
…onda package creation, action added too
  • Loading branch information
mpatrou committed Aug 25, 2023
1 parent e234dab commit 2defd59
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,33 @@ jobs:
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3

conda-build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
mamba-version: "*"
environment-file: environment.yml
- name: Build python wheel
run: |
conda activate shiver
python -m build --wheel --no-isolation
check-wheel-contents dist/shiver-*.whl
- name: Build conda library
shell: bash -l {0}
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
VERSION=$(versioningit ../) conda mambabuild --output-folder . .
conda verify noarch/shiver*.tar.bz2
trigger-deploy:
runs-on: ubuntu-22.04
needs: [tests]
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: "DGS_SC_scripts/.*|.*\\.mat$"
exclude: "setup.*|DGS_SC_scripts/.*|.*\\.mat$"

ci:
skip: [pylint]
Expand Down
45 changes: 45 additions & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# load information from setup.cfg/setup.py
{% set data = load_setup_py_data() %}
{% set license = data.get('license') %}
{% set description = data.get('description') %}
{% set url = data.get('url') %}
# this will get the version set by environment variable
{% set version = environ.get('VERSION') %}
{% set version_number = environ.get('GIT_DESCRIBE_NUMBER', '0') | string %}


package:
name: shiver
version: {{ version_number }}

source:
path: ..

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

requirements:
host:
- python
- versioningit

build:
- setuptools
- versioningit
- mantidworkbench
- qtpy
- pytest

run:
- mantidworkbench

about:
home: {{ url }}
license: {{ license }}
license_family: GPL
license_file: ../LICENSE
summary: {{ description }}
5 changes: 5 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ channels:
- conda-forge
- mantid/label/nightly
dependencies:
- boa
- conda-build
- mantidworkbench
- pre-commit
- versioningit
Expand All @@ -11,7 +13,10 @@ dependencies:
- pytest-qt=4.2.0
- pytest-cov=4.0.0
- sphinx
- python-build
- pip
- pip:
- check-wheel-contents
- setuptools==47.0.0
- https://oncat.ornl.gov/packages/pyoncat-1.4.1-py3-none-any.whl
- sphinx-rtd-theme
75 changes: 75 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[metadata]
name = shiver
version = 0.0.1
distance = 0
description = Spectroscopy Histogram Visualizer for Event Reduction
long_description = file: README.md, LICENSE
long_description_content_type = text/markdown
url = https://github.com/neutrons/Shiver/
license = GPL3.0

[options]
package_dir =
=src
include_package_data = True
packages = find:
python_requires >= 3.8
install_requires =
mantidworkbench
pyoncat == 1.4.1
qtpy
tests_require =
pylint
flake8
black
mypy
pytest
mock

[options.entry_points]
console_scripts =
shiver = shiver.__init__:main

[options.packages.find]
where =
src
exclude =
tests*
DGS_SC_scripts*

[options.package_data]
* =
*.txt
*.yml
*.yaml
*.ini

[options.extras_require]
dev =
versioningit
tests = pytest

[flake8]
max-line-length = 120
ignore = E203, W503
exclude = conda.recipe/meta.yml

[versioning]
source-version-file = shiver/_version.py
version-pattern = {tag}
commit-message-pattern = {raw}
tag-message-pattern = {raw}

[coverage:run]
source = src/shiver
omit =
*/tests/*
conda.recipe/*
docs/*
DGS_SC_scripts/*

[coverage:report]
# temp set low until project is more developed, default 60
fail_under = 1
exclude_lines =
if __name__ == "__main__":
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# this file is necessary so conda can read the contents of setup.cfg using
# its load_setup_py_data function
from setuptools import setup
from versioningit import get_cmdclasses

setup(cmdclass=get_cmdclasses())

0 comments on commit 2defd59

Please sign in to comment.