Skip to content

Commit

Permalink
feat: add support for astropy >=5.1.1,<8 dependency in pyproject.yaml
Browse files Browse the repository at this point in the history
feat: add support for astropy >=5.1.1,<8 dependency in pyproject.yaml
  • Loading branch information
michealroberts committed Jan 3, 2025
1 parent dd3b87c commit 5dd57e7
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
branches:
- main
paths-ignore:
- '__pycache__'
- '.pytest_cache'
- "__pycache__"
- ".pytest_cache"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -16,7 +16,11 @@ jobs:
name: CI/CD Build & Test w/pytest
strategy:
matrix:
os: [ ubuntu-latest ]
os: [ubuntu-latest]
python-version: ["3.11", "3.12", "3.13"]
astropy-version: ["5.1.1", "6.1.7", "7.0"]

fail-fast: false

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

Expand All @@ -34,7 +38,13 @@ jobs:
cat .env
- name: Docker Compose Build
run: docker compose -f docker-compose.yml build --build-arg INSTALL_DEV="true"
run: |
docker compose \
-f docker-compose.yml \
build \
--build-arg INSTALL_DEV="true" \
--build-arg PYTHON_VERSION="${{ matrix.python-version }}" \
--build-arg ASTROPY_VERSION="${{ matrix.astropy-version }}"
- name: Run Pytest Suite
run: docker compose -f docker-compose.yml run app pytest
run: docker compose -f docker-compose.yml run app pytest
35 changes: 32 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
FROM python:3.11-buster
# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #

ARG PYTHON_VERSION=3.11

FROM python:${PYTHON_VERSION}-bookworm

# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #

WORKDIR /usr/src/app

# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #

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

# Allow installing dev dependencies to run tests
ARG INSTALL_DEV=false
RUN bash -c "if [ $INSTALL_DEV == 'true' ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi"
ARG ASTROPY_VERSION="7.0.0"

# Optionally "inject" the matrix version of astropy:
# This modifies pyproject.toml/poetry.lock so that Poetry can pick up that version.
RUN if [ -n "$ASTROPY_VERSION" ]; then \
poetry add --lock "astropy==$ASTROPY_VERSION.*"; \
fi

# Install dependencies (with or without dev)
RUN bash -c "\
if [ \"$INSTALL_DEV\" == 'true' ] ; then \
poetry install --no-root ; \
else \
poetry install --no-root --no-dev ; \
fi \
"

# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #

COPY . /usr/src/app

# Set the PYTHONPATH environment variable:
ENV PYTHONPATH=/usr/src/app
ENV PYTHONPATH=/usr/src/app

# //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ repository = "https://github.com/lgrcia/twirl"
keywords = ["astronomy", "astrometry", "plate-solving"]

[tool.poetry.dependencies]
python = "^3.9"
astropy = "^5.1.1"
python = ">=3.11,<3.14"
astropy = ">=5.1.1,<8"
astroquery = "^0.4.6"
matplotlib = "^3.6.2"
numpy = "^1.23.5"
Expand Down Expand Up @@ -122,7 +122,6 @@ fixable = [
"RUF",
"SIM",
"SLF",
"TCH",
"TID",
"TRY",
"UP",
Expand Down

0 comments on commit 5dd57e7

Please sign in to comment.