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 #96

Merged
merged 28 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2defd59
setup and meta.yaml files are added for setting up shiver wheel and c…
mpatrou Aug 24, 2023
95b9579
remove explicit environment activation from workflow actions
mpatrou Aug 25, 2023
6938583
build-systems requires updated
mpatrou Aug 25, 2023
143afd2
readme listes as dynamic variable
mpatrou Aug 25, 2023
5a2a73e
conda-verify added in the environment
mpatrou Aug 25, 2023
94e1474
dynamic variables added in toml for values defined outside the file
mpatrou Aug 25, 2023
5b20239
add conditional action according to snapred
mpatrou Aug 25, 2023
1dd6ecb
conditional anaconda deploy added and unused packages removed from en…
mpatrou Aug 25, 2023
a815c56
actions and environment updates for deploy step
mpatrou Aug 25, 2023
10a8dc3
boa pckage is placed back
mpatrou Aug 25, 2023
e7fcc10
mypy removed
mpatrou Aug 25, 2023
8dc75ba
setup added in pre-commit hook
mpatrou Aug 28, 2023
27c03e8
comments addressed for setuptools version, and some build dependencies
mpatrou Aug 28, 2023
ff54cf8
setuptools added as conda dependency
mpatrou Aug 28, 2023
a25b812
check-wheel-contents added as aconda depndency
mpatrou Aug 28, 2023
a2a1426
check-wheel-contents added back as pip, conda cannot find the package
mpatrou Aug 28, 2023
e902401
oncat subversion removed
mpatrou Aug 28, 2023
d53f8c5
oncat subversion reverted due to No matching distribution found error
mpatrou Aug 28, 2023
e3719c3
move pyoncat to a newer version
mpatrou Aug 29, 2023
c6bd980
dynamic variables and definitons in setup.cfg removed
mpatrou Aug 29, 2023
5a1715c
long description removed
mpatrou Aug 29, 2023
e600b88
revert long_description_content_type
mpatrou Aug 29, 2023
61c5b22
removed setup.cfg and added some parameters at pyproject.toml
mpatrou Aug 29, 2023
db380ea
added only url and package data for template file
mpatrou Aug 29, 2023
d60778f
url moved to pyproject, updated to include .ini file in wheel on server
mpatrou Aug 29, 2023
5ec618f
removed setup.cfg again
mpatrou Aug 29, 2023
8bc2aee
setup.cfg with package data needed
mpatrou Aug 29, 2023
c6c7dc4
setup file removed
mpatrou Aug 29, 2023
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
40 changes: 39 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,47 @@ 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: |
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
- name: Deploy to Anaconda
shell: bash -l {0}
if: startsWith(github.ref, 'refs/tags/v')
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
IS_RC: ${{ contains(github.ref, 'rc') }}
run: |
# label is main or rc depending on the tag-name
CONDA_LABEL="main"
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
echo pushing ${{ github.ref }} with label $CONDA_LABEL
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/shiver*.tar.bz2

trigger-deploy:
runs-on: ubuntu-22.04
needs: [tests]
needs: [tests, conda-build]
# only trigger deploys from protected branches and tags
if: ${{ github.ref_protected || github.ref_type == 'tag' }}
steps:
Expand Down
42 changes: 42 additions & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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

run:
- mantidworkbench

about:
home: {{ url }}
license: {{ license }}
license_family: GPL
license_file: ../LICENSE
summary: {{ description }}
8 changes: 7 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ channels:
- conda-forge
- mantid/label/nightly
dependencies:
- boa
- conda-build
- conda-verify
- mantidworkbench
- pre-commit
- versioningit
- pylint=2.17.3
- pytest=7.2.1
- pytest-qt=4.2.0
- pytest-cov=4.0.0
- setuptools
- sphinx
- python-build
- pip
- pip:
- https://oncat.ornl.gov/packages/pyoncat-1.4.1-py3-none-any.whl
- https://oncat.ornl.gov/packages/pyoncat-1.6.1-py2.py3-none-any.whl
- sphinx-rtd-theme
- check-wheel-contents
15 changes: 12 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ dynamic = ["version"]
requires-python = ">=3.8"
dependencies = [
"mantidworkbench >= 6.6.20230517",
"pyoncat == 1.4.1"
"pyoncat == 1.6.1"
]

[project.urls]
"Homepage" = "https://github.com/neutrons/Shiver/"

[build-system]
requires = [
"setuptools >= 42",
"versioningit"
"setuptools",
"wheel",
"toml",
"versioningit"
]
build-backend = "setuptools.build_meta"

Expand All @@ -24,6 +29,10 @@ file = "src/shiver/_version.py"

[tool.setuptools.packages.find]
where = ["src"]
exclude = ["tests*", "DGS_SC_scripts*"]

[tool.setuptools.package-data]
"*" = ["*.yml","*.yaml","*.ini"]

[project.gui-scripts]
shiver = "shiver:main"
Expand Down
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
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())
Loading