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

Diff (formatted) #5

Open
wants to merge 12 commits into
base: py2-reformatted
Choose a base branch
from
Open
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
50 changes: 50 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Ignore Git repository files
.git
.gitignore

# Ignore Python virtual environments
.venv/
env/
venv/

# Ignore log files
*.log

# Ignore Python cache and compiled files
__pycache__/
*.py[cod]
*$py.class

# Ignore pytest cache
.pytest_cache/

# Ignore mypy cache
.mypy_cache/

# Ignore coverage reports
.coverage
htmlcov/

# Ignore temporary files
*.swp
*~
*.tmp
*.temp

# Ignore build artifacts
build/
dist/
.eggs/
*.egg-info/

# Ignore IDE/editor configurations
.vscode/
.idea/

# Ignore macOS Finder files
.DS_Store

# Ignore other system files
Thumbs.db
desktop.ini

32 changes: 32 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Docker Image

on:
push:
branches:
- main # Push to dockerhub when a new version is merged to `main`

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Check Out Code
uses: actions/checkout@v3

- name: Extract Package Version
# run: echo "PACKAGE_VERSION=$(python -c 'from jointly_hic import __version__; print(__version__)')" >> $GITHUB_ENV
run: echo 2.0.0

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: treimonn/ldsc-python3:latest, treimonn/ldsc-python3:${{ env.PACKAGE_VERSION }}
52 changes: 52 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will install Python dependencies using Poetry, run tests, and lint with multiple Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python Package CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry

- name: Install dependencies with Poetry
run: |
poetry install --no-interaction --no-root

- name: Lint with flake8 and black
run: |
# poetry run flake8 --max-line-length 120 ldscore test
poetry run black --check ldscore test

- name: Run tests with nose2
run: |
poetry run nose2

- name: Run type checks with mypy
run: |
# poetry run mypy ldscore


4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ coverage.xml
.ropeproject

# Django stuff:
*.log
*.pot

# Sphinx documentation
Expand Down Expand Up @@ -84,3 +83,6 @@ docs/_build/
# sublime text
*.idea*
*sublime*

# Env
.venv/
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.13.0
# hooks:
# - id: mypy

46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# --------------------- Stage 1: Build the wheel ---------------------
# Use the official Ubuntu 23.04 as the base image for the builder
FROM ubuntu:23.04 AS builder

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_NO_INTERACTION=1

# Update and install system dependencies for building
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
curl \
python3.11 \
python3.11-venv \
python3.11-dev \
&& rm -rf /var/lib/apt/lists/*

# Ensure python3 and pip3 are the default
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 10

# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 -

# Add Poetry to PATH
ENV PATH="/root/.local/bin:$PATH"

# Set the working directory inside the container
WORKDIR /app

# Copy pyproject.toml and poetry.lock if available
COPY pyproject.toml poetry.lock* /app/

# Install project dependencies without installing the package itself
RUN poetry install --only main

# Copy the rest of the project files
COPY . /app

# Install the package
RUN poetry install

# Set the entrypoint to ldsc
ENTRYPOINT ["poetry", "run"]
Loading
Loading