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

Ewm7212 conda package #4

Merged
merged 5 commits into from
Oct 9, 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
51 changes: 51 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: conda packaging and deployment

on:
workflow_dispatch:
push:
branches: [main]
tags: ['v*']
pull_request:

jobs:
linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
channels: conda-forge,defaults
use-mamba: true
environment-file: environment.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}

- name: build and verify wheel
run: |
python -m build --wheel --no-isolation
check-wheel-contents dist/mantidprofiler-*.whl

- name: build conda package
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
VERSION=$(versioningit ../) conda mambabuild --channel conda-forge --output-folder . .
conda verify noarch/mantidprofiler*.tar.bz2
- name: upload conda package 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/mantidprofiler*.tar.bz2
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ repos:
- id: check-added-large-files
args: [--maxkb=8192]
- id: check-yaml
exclude: "conda.recipe/meta.yaml"
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
46 changes: 46 additions & 0 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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 version_number = version.split('+')[0] %}
# change the build number by hand if you want to rebuild the package
{% set build_number = 0 %}

package:
name: mantidprofiler
version: {{ version_number }}

source:
path: ..

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

requirements:
host:
- python
- versioningit
- setuptools>=42
- wheel

build:
- setuptools>=42
- versioningit

run:
- python

about:
home: {{ url }}
license: {{ license }}
license_family: GPL
license_file: ../LICENSE
summary: {{ description }}
18 changes: 18 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: mantid-profiler
channels:
- conda-forge
dependencies:
- anaconda-client
- boa
- check-wheel-contents
- conda-build < 4
- conda-verify
- libmamba
- libarchive
- pre-commit
- psutil
- python-build
- setuptools
- toml
- versioningit
- wheel
30 changes: 29 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
[project]
name = "mantidprofiler"
description = "Uses psrecord and plotly.js to profile a mantid workflow"
dynamic = ["version"]
requires-python = ">=3.10"
readme = "README.md"
license = { text = "GPL3.0" }

[project.urls]
homepage = "https://github.com/mantidproject/mantid-profiler/"
repository = "https://github.com/mantidproject/mantid-profiler/"
issues = "https://github.com/mantidproject/mantid-profiler/issues"

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

[tool.setuptools.packages.find]
where = ["src"]

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

[tool.versioningit.vcs]
method = "git"
default-tag = "0.0.1"

[tool.versioningit.next-version]
method = "minor"

[tool.versioningit.format]
distance = "{next_version}.dev{distance}"
dirty = "{version}+d{build_date:%Y%m%d}"
distance-dirty = "{next_version}.dev{distance}+d{build_date:%Y%m%d%H%M}"

[tool.versioningit.write]
file = "src/mantidprofiler/_version.py"

[tool.ruff]
line-length = 120
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion diskrecord.py → src/mantidprofiler/diskrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import numpy as np
import psutil

from time_util import get_current_time, get_start_time


Expand Down
3 changes: 1 addition & 2 deletions mantid-profiler.py → src/mantidprofiler/mantidprofiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
from pathlib import Path
from threading import Thread

import numpy as np

import algorithm_tree as at
import numpy as np
from diskrecord import monitor as diskmonitor
from diskrecord import parse_log as parse_disk_log
from psrecord import monitor as cpumonitor
Expand Down
1 change: 0 additions & 1 deletion psrecord.py → src/mantidprofiler/psrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

import numpy as np
import psutil

from time_util import get_current_time, get_start_time


Expand Down
File renamed without changes.
Loading