Skip to content

Commit 47e29d2

Browse files
authored
Merge pull request #170 from cta-observatory/conda_cd
Update the workflow for deploying the package on anaconda
2 parents 0b61f99 + 2d1feaf commit 47e29d2

File tree

4 files changed

+125
-12
lines changed

4 files changed

+125
-12
lines changed

.github/conda/meta.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{% set name = "dl1_data_handler" %}
2+
{% set version = os.environ.get('PACKAGE_VERSION', '0.0.0+dev') %}
3+
4+
package:
5+
name: {{ name }}
6+
version: {{ version }}
7+
8+
source:
9+
10+
path: ../../
11+
12+
build:
13+
noarch: python
14+
number: 0
15+
script: "{{ PYTHON }} -m pip install . --no-deps -vv"
16+
17+
requirements:
18+
host:
19+
- python >=3.10
20+
- pip
21+
- setuptools >=65
22+
- setuptools_scm >=6.2
23+
run:
24+
- python >=3.10
25+
- astropy
26+
- numpy
27+
- pandas
28+
- pyyaml
29+
- scipy
30+
- traitlets
31+
- pydot
32+
- setuptools
33+
- ctapipe>=0.23,<0.26
34+
35+
36+
test:
37+
imports:
38+
- dl1_data_handler
39+
40+
about:
41+
home: https://github.com/cta-observatory/dl1-data-handler
42+
license: BSD-3-Clause
43+
summary: "Utilities for reading and processing CTA R1/DL0/DL1 data in a standardized format."
44+
description: |
45+
A package of utilities for reading and applying image processing to Cherenkov Telescope Array (CTA)
46+
R1/DL0/DL1 data in a standardized format. Created primarily for testing machine learning image
47+
analysis techniques on IACT data.
48+
dev_url: https://github.com/cta-observatory/dl1-data-handler
49+
50+
extra:
51+
recipe-maintainers:
52+
- Daniel Nieto
53+
- Tjark Miener
54+
- Alexander Cervino
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release Conda
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-22.04
11+
12+
steps:
13+
- name: Checkout repository and fetch tags
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Setup Miniconda and Conda Tools
19+
uses: conda-incubator/setup-miniconda@v3
20+
with:
21+
python-version: '3.10'
22+
channels: conda-forge
23+
auto-update-conda: true
24+
mamba-version: "*"
25+
activate-environment: false
26+
27+
- name: Install anaconda-client and conda-build
28+
shell: bash
29+
run: |
30+
mamba install anaconda-client conda-build -y
31+
32+
- name: Conda Build and Upload Package
33+
shell: bash
34+
env:
35+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
36+
run: |
37+
CONDA_RECIPE_DIR=".github/conda"
38+
ANACONDA_CHANNEL="ctlearn-project"
39+
40+
FULL_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0+dev")
41+
VERSION="${FULL_TAG#v}"
42+
VERSION="${VERSION#V}"
43+
44+
echo "Building package version: $VERSION"
45+
export PACKAGE_VERSION=$VERSION
46+
47+
conda run conda build $CONDA_RECIPE_DIR
48+
49+
PACKAGE_PATH=$(conda run conda build $CONDA_RECIPE_DIR --output)
50+
51+
if [[ "$VERSION" != "0.0.0+dev" ]]; then
52+
echo "Uploading $PACKAGE_PATH to $ANACONDA_CHANNEL channel..."
53+
conda run anaconda upload \
54+
"$PACKAGE_PATH" \
55+
--force \
56+
--user $ANACONDA_CHANNEL
57+
else
58+
echo "Skipping upload: Version is $VERSION (development)."
59+
fi

README.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,26 @@ Previously named image-extractor (v0.1.0 - v0.6.0). Currently under development,
3131
Installation
3232
------------
3333

34-
The following installation method (for Linux) is recommended:
34+
The lastest version fo this package can be installed as a conda or pip package:
3535

36-
Installing as a conda package
37-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
.. code-block:: bash
3837
39-
To install dl1-data-handler as a conda package, first install Anaconda by following the instructions here: https://www.anaconda.com/distribution/.
38+
conda install ctlearn-project::dl1_data_handler
4039
41-
The following command will set up a conda virtual environment, add the
42-
necessary package channels, and install dl1-data-handler specified version and its dependencies:
40+
or
4341

4442
.. code-block:: bash
4543
46-
DL1DH_VER=0.14.5
47-
wget https://raw.githubusercontent.com/cta-observatory/dl1-data-handler/v$DL1DH_VER/environment.yml
48-
conda env create -n [ENVIRONMENT_NAME] -f environment.yml
49-
conda activate [ENVIRONMENT_NAME]
50-
conda install -c ctlearn-project dl1_data_handler=$DL1DH_VER
44+
pip install dl1-data-handler
45+
46+
Installing as a conda package
5147

5248
This should automatically install all dependencies (NOTE: this may take some time, as by default MKL is included as a dependency of NumPy and it is very large).
5349

50+
Developers
51+
------------
52+
53+
We welcome contributions to this package! If you're interested in contributing, please make sure to follow the `ctapipe developer guidelines <https://ctapipe.readthedocs.io/en/latest/developer-guide/getting-started.html>`_.
5454

5555
Links
5656
-----

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- numpy
1111
- scipy
1212
- pip
13-
- ctapipe>=0.22,<0.26
13+
- ctapipe >=0.23,<0.26
1414
- traitlets
1515
- pyyaml
1616
- pandas

0 commit comments

Comments
 (0)