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

build: improve installation making use of pyproject.toml file only and setuptools #491

Merged
merged 68 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d30e96a
remove setuptools and generate .toml with poetry
gcroci2 Sep 6, 2023
874d237
fix include in toml file
gcroci2 Sep 9, 2023
8fe69e9
add metadata to project.toml
gcroci2 Sep 9, 2023
b9ef344
add torch to toml file
gcroci2 Sep 11, 2023
daa031a
add poetry to package install action and remove python 3.9
gcroci2 Sep 11, 2023
890d772
remove lock file
gcroci2 Sep 11, 2023
08c7e2d
fix torch_geometric additional dependencies installation
gcroci2 Sep 11, 2023
faaf314
move torch_geometric adds after poetry install
gcroci2 Sep 11, 2023
ebe0605
place torch installation out of poetry again
gcroci2 Sep 11, 2023
e7905f6
run tests with poetry
gcroci2 Sep 11, 2023
0a68583
try to fix the install python and package action
gcroci2 Sep 11, 2023
a08909f
print conda packages
gcroci2 Sep 11, 2023
486f5eb
add print for debugging
gcroci2 Sep 11, 2023
8bf697a
try to fix build
Sep 11, 2023
c0eac56
remove poetry from installation
Sep 11, 2023
734d02d
add pytest dependency
Sep 11, 2023
46cc202
remove lock file
Sep 11, 2023
fb6d5c0
add check pytest
Sep 11, 2023
ff3323f
add check for pytest
Sep 11, 2023
671486d
remove conda prefix
Sep 11, 2023
6b35457
fix error in build package yml
Sep 11, 2023
9041513
try to fix build
Sep 11, 2023
6f57188
try to fit build.yml
Sep 11, 2023
07e893a
fix error on build.yml
Sep 11, 2023
b534d09
try to fix build.yml
Sep 11, 2023
74e1fd0
add lock file
Sep 11, 2023
e2a8dac
add pytest installation
Sep 11, 2023
4834d63
use only extras in the toml file, remove groups
Sep 11, 2023
41130c2
remove conda list from workflow
Sep 11, 2023
008fd1d
add extra argument to build.yml
Sep 11, 2023
abb4bf4
add publishing extra
Sep 11, 2023
1b4f212
remove unnecessary python commands
Sep 11, 2023
4426fc2
add quotations to multiple extras installation
Sep 11, 2023
ae022c9
add pyroma to toml
Sep 11, 2023
8124cc6
remove unneded shell command
Sep 11, 2023
45d0737
add extras to coveralls.yml
Sep 11, 2023
5da48a8
update python version
Sep 11, 2023
39ed51c
fix files for release
Sep 11, 2023
67f5eb4
remove poetry and use setuptools instead
Sep 12, 2023
7b93238
remove msms dependency
Sep 12, 2023
7cc04e6
remove pytorch from pyproject.toml
Sep 12, 2023
0cba124
remove h5xplorer and reinsert msms installation in the action.yml file
Sep 12, 2023
f8ea6c7
remove h5xplorer
Sep 12, 2023
dd5a8a5
remove visualization tests
Sep 12, 2023
7fdad59
fix workflows for running the specified python version
Sep 12, 2023
e6e05ef
fix comment
Sep 12, 2023
5071ba8
update bumpversion.cfg with the toml file
Sep 12, 2023
80c36bb
remove unuseg pyg_lib
Sep 12, 2023
f87c7f6
update installation istructions
Sep 12, 2023
561dae1
remove remaining ref to h5xplorer
Sep 12, 2023
ef2fbe0
update external deps in action.yml
Sep 12, 2023
7854637
add badges for python version and OS
Sep 12, 2023
be7bcaa
try to add macos build
gcroci2 Sep 12, 2023
db98d7e
add deps for macos
gcroci2 Sep 12, 2023
47fa1f1
fix line ending issue
gcroci2 Sep 12, 2023
41905a5
add pytorch installation for macos
gcroci2 Sep 12, 2023
19c186e
try to fix dssp installation for macos
gcroci2 Sep 12, 2023
89d39c4
add deps for dssp for macos
gcroci2 Sep 12, 2023
30fa58c
update instructions for pytables for macos
gcroci2 Sep 13, 2023
3a068d6
remove macos build
gcroci2 Sep 13, 2023
95d43c9
add spaces to the list in the README.md
gcroci2 Sep 13, 2023
1de9e2f
add spaces to the list in installation.md
gcroci2 Sep 13, 2023
1e3c150
Update README.md
gcroci2 Sep 14, 2023
f7b64c9
Update README.md
gcroci2 Sep 14, 2023
d0f21db
Update README.md
gcroci2 Sep 14, 2023
c072dc6
Update README.md
gcroci2 Sep 14, 2023
5cfafa0
update installation instructions and add empty line to .gitignore
Sep 14, 2023
77837c8
fix codacy errors
Sep 15, 2023
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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ comment = The contents of this file cannot be merged with that of setup.cfg unti
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[bumpversion:file:setup.cfg]
[bumpversion:file:pyproject.toml]
search = version = {current_version}
replace = version = {new_version}

Expand Down
85 changes: 60 additions & 25 deletions .github/actions/install-python-and-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ inputs:

python-version:
required: false
description: "The Python version to use. Specify major and minor version, e.g. '3.9'."
default: "3.9"
description: "The Python version to use. Specify major and minor version, e.g. '3.10'."
default: "3.10"

extras-require:
required: false
Expand All @@ -24,12 +24,6 @@ runs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'
cache-dependency-path: setup.cfg

- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
Expand All @@ -38,29 +32,70 @@ runs:
conda-channels: anaconda
- run: conda --version
shell: bash {0}
- run: which python
shell: bash {0}

- name: Upgrade pip and install dependencies
- name: Python info
shell: bash -e {0}
run: |
which python3
python3 --version
- name: Install dependencies on Linux
shell: bash {0}
env:
CMAKE_INSTALL_PREFIX: .local
if: runner.os == 'Linux'
run: |
python3 -m pip install --upgrade pip setuptools wheel
# Install dssp
# Install dependencies not handled by setuptools
## DSSP
sudo apt-get install -y dssp
# Only way to install msms is through conda
## MSMS
conda install -c bioconda msms
# Safest way to install PyTorch and PyTorch Geometric is through conda
conda install pytorch==2.0.0 torchvision=0.15.0 torchaudio=2.0.0 cpuonly -c pytorch
## PyTorch, PyG, PyG adds
### Installing for CPU only on the CI
conda install pytorch torchvision torchaudio cpuonly -c pytorch
conda install pyg -c pyg
# Install optional pyg dependencies
python3 -m pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-$(python3 -c "import torch; print(torch.__version__)")+cpu.html
# In the future, release h5xplorer on PyPI
pip install git+https://github.com/DeepRank/h5xplorer.git@master

- name: Install the package
pip install torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-$(python3 -c "import torch; print(torch.__version__)")+cpu.html
- name: Install dependencies on MacOS
shell: bash {0}
run: python3 -m pip install .[${{ inputs.extras-require }}]
env:
CONDA_PREFIX: /usr/share/miniconda
CMAKE_INSTALL_PREFIX: .local
if: runner.os == 'macOS'
run: |
# Install dependencies not handled by setuptools
## DSSP
git clone https://github.com/PDB-REDO/libcifpp.git --recurse-submodules
cd libcifpp
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
#######
git clone https://github.com/mhekkel/libmcfp.git
cd libmcfp
mkdir build
cd build
cmake ..
cmake --build .
cmake --install .
#######
git clone https://github.com/PDB-REDO/dssp.git
cd dssp
mkdir build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
## MSMS
cd /tmp/
wget http://mgltools.scripps.edu/downloads/tars/releases/MSMSRELEASE/REL2.6.1/msms_i86Linux2_2.6.1.tar.gz
sudo mkdir /usr/local/lib/msms
cd /usr/local/lib/msms
sudo tar zxvf /tmp/msms_i86Linux2_2.6.1.tar.gz
sudo ln -s /usr/local/lib/msms/msms.i86Linux2.2.6.1 /usr/local/bin/msms
sudo ln -s /usr/local/lib/msms/pdb_to_xyzr* /usr/local/bin
## PyTorch, PyG, PyG adds
### Installing for CPU only on the CI
conda install pytorch torchvision torchaudio cpuonly -c pytorch
pip install torch_geometric
pip install torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-$(python3 -c "import torch; print(torch.__version__)")+cpu.html
# PyTables via conda only for MacOS
conda install pytables
- name: Install the package
shell: bash {0}
run: pip install .'[${{ inputs.extras-require }}]'
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: ['3.9', '3.10']
python-version: ['3.10', '3.11']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: test, publishing
- name: Run unit tests
env:
CONDA_PREFIX: /usr/share/miniconda
run: |
pytest -v
run: pytest -v
- name: Verify that we can build the package
run: python3 setup.py sdist bdist_wheel
run: python3 -m build
7 changes: 5 additions & 2 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: [3.9]
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: test
- name: Run unit tests with coverage
run: pytest --cov --cov-append --cov-report xml --cov-report term --cov-report html
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
COVERALLS_FLAG_NAME: python-${{ matrix.os }}
run: |
coveralls --service=github
coveralls --service=github
7 changes: 5 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: [3.9]
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: test
- name: Check style against standards using prospector
run: prospector --die-on-tool-error
run: prospector --die-on-tool-error
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python-version: [3.9]
python-version: ['3.10']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/install-python-and-package
with:
python-version: ${{ matrix.python-version }}
extras-require: publishing
- name: Build wheel and source distribution
run: python -m build
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ docs/apidocs

#other
*_.ipynb
Untitled*
Untitled*
data_raw/
data_processed/
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

58 changes: 25 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
| **fairness** | [![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/6403/badge)](https://bestpractices.coreinfrastructure.org/projects/6403) |
| **package** | [![PyPI version](https://badge.fury.io/py/deeprank2.svg)](https://badge.fury.io/py/deeprank2) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/f3f98b2d1883493ead50e3acaa23f2cc)](https://app.codacy.com/gh/DeepRank/deeprank2?utm_source=github.com&utm_medium=referral&utm_content=DeepRank/deeprank2&utm_campaign=Badge_Grade) |
| **docs** | [![Documentation Status](https://readthedocs.org/projects/deeprank2/badge/?version=latest)](https://deeprank2.readthedocs.io/en/latest/?badge=latest) [![DOI](https://zenodo.org/badge/450496579.svg)](https://zenodo.org/badge/latestdoi/450496579) |
| **tests** | [![Build Status](https://github.com/DeepRank/deeprank2/actions/workflows/build.yml/badge.svg)](https://github.com/DeepRank/deeprank2/actions) ![Linting status](https://github.com/DeepRank/deeprank2/actions/workflows/linting.yml/badge.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/DeepRank/deeprank2/badge.svg?branch=main)](https://coveralls.io/github/DeepRank/deeprank2?branch=main) |
| **tests** | [![Build Status](https://github.com/DeepRank/deeprank2/actions/workflows/build.yml/badge.svg)](https://github.com/DeepRank/deeprank2/actions) ![Linting status](https://github.com/DeepRank/deeprank2/actions/workflows/linting.yml/badge.svg?branch=main) [![Coverage Status](https://coveralls.io/repos/github/DeepRank/deeprank2/badge.svg?branch=main)](https://coveralls.io/github/DeepRank/deeprank2?branch=main) ![Python](https://img.shields.io/badge/python-3.10-blue.svg) ![Python](https://img.shields.io/badge/python-3.11-blue.svg) |
| **running on** | ![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white) |
| **license** | [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/license/apache-2-0/) |


## Overview

![alt-text](./deeprank2.png)
Expand Down Expand Up @@ -46,35 +46,28 @@ DeepRank2 extensive documentation can be found [here](https://deeprank2.rtfd.io/
- [GraphDataset](#graphdataset)
- [GridDataset](#griddataset)
- [Training](#training)
- [h5x support](#h5x-support)
- [Package development](#package-development)

## Installation

The package officially supports ubuntu-latest OS only, whose functioning is widely tested through the continuous integration workflows.

### Dependencies

Before installing deeprank2 you need to install some dependencies. We advise to use a [conda environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) with Python >= 3.9 installed.

* [msms](https://ssbio.readthedocs.io/en/latest/instructions/msms.html): `conda install -c bioconda msms`. *For MacOS with M1 chip users*: you can follow [these instructions](https://ssbio.readthedocs.io/en/latest/instructions/msms.html).
* [PyTorch](https://pytorch.org/):
* CPU only: `conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 cpuonly -c pytorch`
* if using GPU: `conda install pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.7 -c pytorch -c nvidia`
* [pytorch-geometric](https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html): `conda install pyg -c pyg`
* [Dependencies for pytorch geometric from wheels](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html#installation-from-wheels): `pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html`.
- Here, `${TORCH}` and `${CUDA}` should be replaced by the pytorch and CUDA versions installed. You can find these using:
- `python -c "import torch; print(torch.__version__)"` and
- `python -c "import torch; print(torch.version.cuda)"`
- if this returns `None`, use `cpu` instead
- For example: `pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cpu.html`
* Check if [DSSP 4](https://swift.cmbi.umcn.nl/gv/dssp/) is installed: `dssp --version`
* if this gives an error or shows a version lower than 4:
* on ubuntu 22.04 or newer: `sudo apt-get install dssp`.
* If the package cannot be located, first run `sudo apt-get update`.
* on older versions of ubuntu or on mac or lacking sudo priviliges: install from [here](https://github.com/pdb-redo/dssp), following the instructions listed.
* Check if gcc is installed: `gcc --version`.
* if this gives an error, run `sudo apt-get install gcc`.

* For MacOS with M1 chip (otherwise ignore this): `conda install pytables`
Before installing deeprank2 you need to install some dependencies. We advise to use a [conda environment](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) with Python >= 3.10 installed. The following dependency installation instructions are updated as of 14/09/2023, but in case of issues during installation always refer to the official documentation which is linked below:

* [MSMS](https://anaconda.org/bioconda/msms): `conda install -c bioconda msms`.
* [Here](https://ssbio.readthedocs.io/en/latest/instructions/msms.html) for MacOS with M1 chip users.
* [PyTorch](https://pytorch.org/get-started/locally/)
* We support torch's CPU library as well as CUDA.
* [PyG](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html) and its optional dependencies: `torch_scatter`, `torch_sparse`, `torch_cluster`, `torch_spline_conv`.
* [DSSP 4](https://swift.cmbi.umcn.nl/gv/dssp/)
* Check if `dssp` is installed: `dssp --version`. If this gives an error or shows a version lower than 4:
* on ubuntu 22.04 or newer: `sudo apt-get install dssp`. If the package cannot be located, first run `sudo apt-get update`.
* on older versions of ubuntu or on mac or lacking sudo priviliges: install from [here](https://github.com/pdb-redo/dssp), following the instructions listed.
* [GCC](https://gcc.gnu.org/install/)
* Check if gcc is installed: `gcc --version`. If this gives an error, run `sudo apt-get install gcc`.
* For MacOS with M1 chip users only install [the conda version of PyTables](https://www.pytables.org/usersguide/installation.html).

### Deeprank2 Package

Expand All @@ -84,26 +77,29 @@ Once the dependencies are installed, you can install the latest stable release o
pip install deeprank2
```

Alternatively, get all the new developments by cloning the repo and installing the code with
Alternatively, get all the new developments by cloning the repo and installing the editable version of the package with:

```bash
git clone https://github.com/DeepRank/deeprank2
cd deeprank2
pip install -e ./
pip install -e .'[test]'
```

The `test` extra is optional, and can be used to install test-related dependencies useful during the development.

### Test installation

If you have installed the package from a cloned repository (second option above), you can check that all components were installed correctly, using pytest.
The quick test should be sufficient to ensure that the software works, while the full test (a few minutes) will cover a much broader range of settings to ensure everything is correct.

First, install [pytest](https://docs.pytest.org/): `pip install pytest`.
Then run `pytest tests/test_integration.py` for the quick test or just `pytest` for the full test (expect a few minutes to run).
Run `pytest tests/test_integration.py` for the quick test or just `pytest` for the full test (expect a few minutes to run).

### Contributing

If you would like to contribute to the package in any way, please see [our guidelines](CONTRIBUTING.rst).

## Quick start

The following section serves as a first guide to start using the package, using Protein-Protein Interface (PPI) queries as example.
For an enhanced learning experience, we provide in-depth [tutorial notebooks](https://github.com/DeepRank/deeprank2/tree/main/tutorials) for generating PPI data, generating variants data, and for the training pipeline.
For more details, see the [extended documentation](https://deeprank2.rtfd.io/).
Expand Down Expand Up @@ -319,10 +315,6 @@ trainer.test()

```

## h5x support

After installing `h5xplorer` (https://github.com/DeepRank/h5xplorer), you can execute the python file `deeprank2/h5x/h5x.py` to explorer the connection graph used by deeprank2. The context menu (right click on the name of the structure) allows to automatically plot the graphs using `plotly`.

## Package development

- Branching
Expand Down
11 changes: 0 additions & 11 deletions deeprank2/tools/plotgraph.py

This file was deleted.

Empty file.
21 changes: 0 additions & 21 deletions deeprank2/tools/visualization/baseimport.py

This file was deleted.

17 changes: 0 additions & 17 deletions deeprank2/tools/visualization/embedding.py

This file was deleted.

Loading
Loading