Skip to content

Commit dae6712

Browse files
feat: add support for astropy >=5.1.1,<8 dependency in pyproject.yaml
feat: add support for astropy >=5.1.1,<8 dependency in pyproject.yaml
1 parent dd3b87c commit dae6712

File tree

5 files changed

+1081
-798
lines changed

5 files changed

+1081
-798
lines changed

.github/workflows/ci.yml

+15-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
branches:
66
- main
77
paths-ignore:
8-
- '__pycache__'
9-
- '.pytest_cache'
8+
- "__pycache__"
9+
- ".pytest_cache"
1010

1111
# Allows you to run this workflow manually from the Actions tab
1212
workflow_dispatch:
@@ -16,7 +16,11 @@ jobs:
1616
name: CI/CD Build & Test w/pytest
1717
strategy:
1818
matrix:
19-
os: [ ubuntu-latest ]
19+
os: [ubuntu-latest]
20+
python-version: ["3.11", "3.12", "3.13"]
21+
astropy-version: ["5.1.1", "5.3.4", "6.1.7", "7.0"]
22+
23+
fail-fast: false
2024

2125
runs-on: ${{ matrix.os }}
2226

@@ -34,7 +38,13 @@ jobs:
3438
cat .env
3539
3640
- name: Docker Compose Build
37-
run: docker compose -f docker-compose.yml build --build-arg INSTALL_DEV="true"
41+
run: |
42+
docker compose \
43+
-f docker-compose.yml \
44+
build \
45+
--build-arg INSTALL_DEV="true" \
46+
--build-arg PYTHON_VERSION="${{ matrix.python-version }}" \
47+
--build-arg ASTROPY_VERSION="${{ matrix.astropy-version }}"
3848
3949
- name: Run Pytest Suite
40-
run: docker compose -f docker-compose.yml run app pytest
50+
run: docker compose -f docker-compose.yml run app pytest

.github/workflows/publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
python-version: ["3.10"]
17-
os: [ ubuntu-latest ]
16+
os: [ubuntu-latest]
17+
python-version: ["3.13"]
1818

1919
runs-on: ${{ matrix.os }}
2020

@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Build Package 🐍
4444
run: poetry build
45-
45+
4646
- name: Dry-run Publish to PyPI 😬
4747
run: poetry publish --dry-run
4848

Dockerfile

+32-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
FROM python:3.11-buster
1+
# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
2+
3+
ARG PYTHON_VERSION=3.11
4+
5+
FROM python:${PYTHON_VERSION}-bookworm
6+
7+
# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
28

39
ENV PYTHONDONTWRITEBYTECODE 1
410
ENV PYTHONUNBUFFERED 1
511

12+
# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
13+
614
WORKDIR /usr/src/app
715

16+
# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
17+
818
# Install Poetry
919
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
1020
cd /usr/local/bin && \
@@ -16,9 +26,28 @@ COPY ./pyproject.toml ./poetry.lock* /usr/src/app/
1626

1727
# Allow installing dev dependencies to run tests
1828
ARG INSTALL_DEV=false
19-
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
29+
ARG ASTROPY_VERSION="7.0.0"
30+
31+
# Optionally "inject" the matrix version of astropy:
32+
# This modifies pyproject.toml/poetry.lock so that Poetry can pick up that version.
33+
RUN if [ -n "$ASTROPY_VERSION" ]; then \
34+
poetry add --lock "astropy==$ASTROPY_VERSION.*"; \
35+
fi
36+
37+
# Install dependencies (with or without dev)
38+
RUN bash -c "\
39+
if [ \"$INSTALL_DEV\" == 'true' ] ; then \
40+
poetry install --no-root --without docs; \
41+
else \
42+
poetry install --no-root --no-dev --without docs; \
43+
fi \
44+
"
45+
46+
# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
2047

2148
COPY . /usr/src/app
2249

2350
# Set the PYTHONPATH environment variable:
24-
ENV PYTHONPATH=/usr/src/app
51+
ENV PYTHONPATH=/usr/src/app
52+
53+
# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #

0 commit comments

Comments
 (0)