Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
55 changes: 55 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile",
"target": "development"
},
"customizations": {
"vscode": {
"settings": {
"python.languageServer": "Pylance",
"python.testing.pytestEnabled": true,
"python.testing.pytestArgs": [
"tests"
],
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.defaultFormatter": "charliermarsh.ruff"
},
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000
},
"extensions": [
"ms-python.python",
"littlefoxteam.vscode-python-test-adapter",
"ms-vsliveshare.vsliveshare",
"mhutchie.git-graph",
"ms-toolsai.jupyter",
"charliermarsh.ruff"
]
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
68 changes: 68 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Lint and Test

on:
workflow_dispatch:
push:
branches: [ "mdmix3-dev" ]

pull_request:
branches: [ "mdmix3-dev" ]

jobs:
build-dev:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
REPOSITORY: ${{ steps.repository_lower.outputs.REPOSITORY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: set repository lower case
id: repository_lower
run: |
echo REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
tags: ghcr.io/${{ steps.repository_lower.outputs.REPOSITORY }}_dev
push: true
target: development
cache-from: type=gha
cache-to: type=gha,mode=max

test:
needs: build-dev
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ needs.build-dev.outputs.REPOSITORY }}_dev

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run ruff
run: |
ruff check .

- name: Run mypy
run: |
mypy .

- name: Run pytest
run: |
pytest -v .
71 changes: 2 additions & 69 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
*.pyc
addiwraptorepl.py
build/
makezip.sh
nbproject/
pyMDMix-0.1.6.zip
pyMDMix.egg-info/
src/mdmixscore.py

singularity

# do not save local vscode configuration for now
.vscode/**

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -39,12 +30,6 @@ share/python-wheels/
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand All @@ -63,55 +48,16 @@ coverage.xml
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
Expand All @@ -122,20 +68,7 @@ ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
43 changes: 22 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
FROM ggutierrezbio/ambertools20
ARG CONDA_PREFIX="/opt/SOFT/miniconda3"
ENV PATH="$CONDA_PREFIX/bin:${PATH}"
ARG PATH="$CONDA_PREFIX/bin:${PATH}"

SHELL [ "/bin/bash", "--login", "-c" ]
RUN apt-get update && apt-get install -y wget git && rm -rf /var/lib/apt/lists/*

RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash Miniconda3-latest-Linux-x86_64.sh -b -p $CONDA_PREFIX \
&& rm -f Miniconda3-latest-Linux-x86_64.sh
RUN conda --version

COPY ./environment_p27.yml ./environment_p27.yml
RUN conda env create -f environment_p27.yml
RUN echo ". $CONDA_PREFIX/etc/profile.d/conda.sh" >> ~/.bash_profile
RUN echo "conda activate mdmix-env" >> ~/.bash_profile
WORKDIR /mnt
SHELL ["conda", "run", "-n", "mdmix-env", "/bin/bash", "-c"]
ENTRYPOINT ["conda", "run", "-n", "mdmix-env", "mdmix"]
FROM continuumio/miniconda3 as base

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build-dev

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
Comment thread
ggutierrez-sunbright marked this conversation as resolved.
Outdated

ARG PYTHON_VERSION=3.12

# Create environment and install ambertools
RUN conda config --add channels defaults && \
conda config --add channels bioconda && \
conda config --add channels conda-forge

# RUN apt update && apt install libnetcdf-dev -y

RUN conda install -y python=${PYTHON_VERSION} ambertools

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

CMD ["bash"]

FROM base AS development

COPY requirements-dev.txt .
RUN python -m pip install -r requirements-dev.txt
33 changes: 0 additions & 33 deletions Licenses/license-mdmix.txt

This file was deleted.

3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

77 changes: 1 addition & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1 @@
## pyMDMix --- http://mdmix.sourceforge.net

The program is distributed under GNU GPLv3 license. Find the license file
under Licenses/ folder.

DOCUMENTATION
=============
All documentation on program usage is online at
http://mdmix.sourceforge.net

INSTALLATION
============

1- Dependencies
---------------
This version of pyMDMix depends on:
- ambertools>=12
- python>=2.7

make sure ambertools environment variables are set

2 - Installation process
------------------------
it is advised to install pyMDMix in a virtual environment

there are three recommended ways to install pyMDMix:
1. from the repository by
`python -m pip install [insert address here]`

2. from the project's local folder after cloning the repo by
`python -m pip install .`

3. Use conda or mamba: we will first create the correct conda environment which will already contain ambertools. We will then set the AMBERHOME variable within the environment and finally proceed to install pymdmix from the local git cloned files. Make sure `$CONDA_PREFIX` points to the conda installation directory (it may happen when you activate the new environment this varaible is lost, in that case change the variable for the explicit path).

```bash
git clone https://github.com/CBDD/pyMDmix.git
cd pyMDMix
conda env create -f environment_p27.yml
conda activate mdmix-env
conda env config vars set AMBERHOME=$CONDA_PREFIX/envs/mdmix-env
pip install .
```

3 - Testing
-----------

You can test the package has been successfuly installed by activating
the environment and, from a folder other than the cloned repository, running
`python -m pyMDMix`
if everything went fine, you will see something like
`Welcome to MDMix 2.6`

The main script should have been installed correclty also. check it by running
`mdmix -h`

Test the program works correctly:
Move again to the package source directory and type:
> python pyMDMix/test.py all
This will run a series of source code checks.
No test should fail.

4 - Using Docker
----------------
Build and run from a docker container using the provided Dockerfile.

- docker build -t pymdmix .
- docker run -v $PWD:/mnt pymdmix -h

The docker run command will mount the current working directory (windows users should replace $PWD by %cd%) so the container has access to the current location. Output will be also in the current working directory.
s

4 - Enjoy!
----------
Read program usage at online documentation.


# pyMDMix
Binary file removed dist/pyMDMix-0.2.6-py2.7.egg
Binary file not shown.
Loading