Skip to content

Commit

Permalink
Improve packaging
Browse files Browse the repository at this point in the history
-  Improve some packaging stuff
- Remove versioneer in favour of versiongit
- removed old setup.py
- setup conda environments
- Added install instructions.
  • Loading branch information
hmacdope authored Mar 14, 2023
2 parents 67a8c5d + 09358b0 commit b3ed764
Show file tree
Hide file tree
Showing 13 changed files with 210 additions and 2,560 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
mtenn/_version.py export-subst
*/_version_git.py export-subst

14 changes: 7 additions & 7 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ jobs:
name: Test on ${{ matrix.os }}, Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macOS-latest, ubuntu-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
os: [macOS-latest, ubuntu-latest]
python-version: [3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- name: Additional info about the build
shell: bash
Expand All @@ -39,18 +40,17 @@ jobs:
# More info on options: https://github.com/conda-incubator/setup-miniconda
- uses: conda-incubator/setup-miniconda@v2
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
environment-file: devtools/conda-envs/test_env.yaml

channels: conda-forge,defaults

activate-environment: test
auto-update-conda: false
auto-activate-base: false
show-channel-urls: true

- name: Install package

# conda setup requires this special shell
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,41 @@ print(f'Using delta Model: {delta_e_new.item():0.5f}')
print(f'Using concat Model: {concat_e.item():0.5f}')
```

### Installation

Installation of pytorch is required. We provide a minimal environment file to install pytorch and conda dependencies for conda users in ```environment.yml```. You should create a new environment
like so:

```bash
conda env create --file environment.yml
conda activate mtenn
```

Training and inference is often faster using the GPU version of pytorch.
We provide a minimal environment file to install GPU versions of pytorch and conda dependencies for conda users in ```environment-gpu.yml```. You should create a new environment like so:

```bash
conda env create --file environment-gpu.yml
conda activate mtenn-gpu
```

If not using conda an installation of pytorch **MUST** be done before installing the package itself. See the pytorch documentation on how to best install pytorch for your system.

To install mtenn and its dependencies (excluding pytorch), run
```bash
pip install -e .
```

If not using conda some of the `mtenn` dependencies do not come with pre-built wheels for all platforms, so pip may need to build them from source. This requires a C++ compiler and may take a while.
For advanced users you can directly install the dependency packages listed in the `requirements.txt` using manually specified wheels you can find on `https://data.pyg.org/whl/`.

If compatibility is proving difficult you may need to purge your pip cache

```bash
pip cache purge
```


#### Acknowledgements

Project based on the
Expand Down
21 changes: 9 additions & 12 deletions devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
name: test
channels:

- conda-forge

- defaults
dependencies:
# Base depends
- python
- pip

# Testing
- pytorch
- pytorch_geometric
- pytorch_cluster
- pytorch_scatter
- pytorch_sparse
- numpy
- h5py
- e3nn
# testing dependencies
- pytest
- pytest-cov
- codecov

# Pip-only installs
#- pip:
# - codecov

13 changes: 13 additions & 0 deletions environment-gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: mtenn-gpu
channels:
- conda-forge
dependencies:
- pytorch
- pytorch-gpu
- pytorch_geometric
- pytorch_cluster
- pytorch_scatter
- pytorch_sparse
- numpy
- h5py
- e3nn
12 changes: 12 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: mtenn
channels:
- conda-forge
dependencies:
- pytorch
- pytorch_geometric
- pytorch_cluster
- pytorch_scatter
- pytorch_sparse
- numpy
- h5py
- e3nn
8 changes: 1 addition & 7 deletions mtenn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@
from .mtenn import *
from . import conversion_utils

# Handle versioneer
from ._version import get_versions

versions = get_versions()
__version__ = versions["version"]
__git_revision__ = versions["full-revisionid"]
del get_versions, versions
from ._version_git import __version__
Loading

0 comments on commit b3ed764

Please sign in to comment.