Skip to content

Commit 135fceb

Browse files
authored
Installation procedure (#70)
* Replace setup.py with pyproject.toml * Update CI workflows to install with just pip install * Change tests pip install to editable and update install instructions on readme.md * Add macos to test * Update path for lib in macos
1 parent edade23 commit 135fceb

File tree

6 files changed

+111
-89
lines changed

6 files changed

+111
-89
lines changed

.github/workflows/run_test.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ jobs:
1414
test:
1515
if: github.event.pull_request.draft == false
1616
name: Grouper Tests (python)
17-
runs-on: ubuntu-latest
17+
runs-on: ${{ matrix.os }}
1818

1919
strategy:
2020
fail-fast: false
2121
matrix:
22+
os: [macOS-latest, ubuntu-latest]
2223
python-version: [3.9, 3.12]
2324

2425
defaults:
@@ -27,7 +28,7 @@ jobs:
2728

2829
steps:
2930
- name: Checkout code
30-
uses: actions/checkout@v2
31+
uses: actions/checkout@v4
3132

3233
- name: Install environment
3334
uses: mamba-org/setup-micromamba@v2
@@ -40,10 +41,10 @@ jobs:
4041
run: micromamba activate grouper-dev
4142

4243
- name: List libraries in grouper-dev
43-
run: ls /home/runner/micromamba/envs/grouper-dev/lib | grep omp
44+
run: ls ${MAMBA_ROOT_PREFIX}/envs/grouper-dev/lib | grep omp
4445

4546
- name: Install package
46-
run: micromamba run -n grouper-dev python setup.py build_ext --inplace;micromamba run -n grouper-dev pip install .
47+
run: micromamba run -n grouper-dev pip install -e .
4748

4849
- name: Run tests with pytest
4950
run: micromamba run -n grouper-dev pytest Grouper/tests

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ notebooks
77
foo
88
.benchmarks
99
# Data files
10-
*.txt
1110
*.pkl
1211

1312
foo.ipynb

CMakeLists.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(${SKBUILD_PROJECT_NAME} LANGUAGES CXX)
3+
4+
# Set C++ standard
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
8+
# Find required packages
9+
find_package(pybind11 REQUIRED CONFIG)
10+
11+
# Get conda prefix
12+
if(DEFINED ENV{CONDA_PREFIX})
13+
set(CONDA_PREFIX $ENV{CONDA_PREFIX})
14+
else()
15+
message(FATAL_ERROR "CONDA_PREFIX environment variable not set")
16+
endif()
17+
18+
# Platform-specific settings
19+
if(APPLE)
20+
set(CMAKE_OSX_ARCHITECTURES "arm64")
21+
set(PLATFORM_COMPILE_FLAGS "-Xpreprocessor" "-fopenmp")
22+
elseif(UNIX AND NOT APPLE)
23+
set(PLATFORM_COMPILE_FLAGS "-D_Thread_local=thread_local")
24+
endif()
25+
26+
# Include directories
27+
set(INCLUDE_DIRS
28+
${CONDA_PREFIX}/include
29+
${CONDA_PREFIX}/include/cairo
30+
${CONDA_PREFIX}/include/boost
31+
${CONDA_PREFIX}/include/rdkit
32+
${CONDA_PREFIX}/include/omp
33+
${CONDA_PREFIX}/include/nauty
34+
${CONDA_PREFIX}/include/libpq
35+
${CMAKE_CURRENT_SOURCE_DIR}/Grouper
36+
)
37+
38+
# Library directories
39+
set(LIBRARY_DIRS
40+
${CONDA_PREFIX}/lib
41+
${CONDA_PREFIX}/lib/cairo
42+
)
43+
44+
# Libraries to link
45+
set(LIBRARIES
46+
RDKitFileParsers
47+
RDKitSmilesParse
48+
RDKitGraphMol
49+
RDKitRDGeneral
50+
omp
51+
nauty
52+
pq
53+
)
54+
55+
# Source files
56+
set(SOURCES
57+
Grouper/dataStructures.cpp
58+
Grouper/binding.cpp
59+
Grouper/processColoredGraphs.cpp
60+
Grouper/generate.cpp
61+
Grouper/fragmentation.cpp
62+
)
63+
64+
# Create pybind11 module
65+
pybind11_add_module(_Grouper ${SOURCES})
66+
67+
# Set target properties
68+
target_include_directories(_Grouper PRIVATE ${INCLUDE_DIRS})
69+
target_link_directories(_Grouper PRIVATE ${LIBRARY_DIRS})
70+
target_link_libraries(_Grouper PRIVATE ${LIBRARIES})
71+
72+
# Compiler flags
73+
target_compile_options(_Grouper PRIVATE
74+
-fPIC
75+
${PLATFORM_COMPILE_FLAGS}
76+
)
77+
78+
# Install the module
79+
install(TARGETS _Grouper DESTINATION Grouper)

README.md

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<!-- PROJECT LOGO -->
1414
<br />
1515
<div align="center">
16-
<a href="https://github.com/kierannp/Grouper">
16+
<a href="https://github.com/mosdef-hub/Grouper">
1717
<img src="images/grouper.jpeg" alt="Logo" width="700" height="300">
1818
</a>
1919

@@ -22,14 +22,14 @@
2222
<p align="center">
2323
A software package for creating and manipulating graphs of molecular groups.
2424
<br />
25-
<a href="https://github.com/kierannp/Grouper"><strong>Explore the docs »</strong></a>
25+
<a href="https://github.com/mosdef-hub/Grouper"><strong>Explore the docs »</strong></a>
2626
<br />
2727
<br />
28-
<a href="https://github.com/kierannp/Grouper">View Demo</a>
28+
<a href="https://github.com/mosdef-hub/Grouper">View Demo</a>
2929
·
30-
<a href="https://github.com/kierannp/Grouper/issues">Report Bug</a>
30+
<a href="https://github.com/mosdef-hub/Grouper/issues">Report Bug</a>
3131
·
32-
<a href="https://github.com/kierannp/Grouper/issues">Request Feature</a>
32+
<a href="https://github.com/mosdef-hub/Grouper/issues">Request Feature</a>
3333
</p>
3434
</div>
3535

@@ -71,20 +71,13 @@ The fundamental data structure behind this package is based on a port graph, loo
7171

7272
### Installation
7373

74-
1. Clone the repo
7574
```sh
76-
conda create -n Grouper python=3.9
77-
conda activate Grouper
78-
conda install librdkit-dev librdkit rdkit-dev rdkit-postgresql boost cmake rdkit eigen pybind11 openmp
79-
conda install -c conda-forge nauty nlohmann_json
80-
81-
git clone https://github.com/kierannp/Grouper
75+
git clone https://github.com/mosdef-hub/Grouper
8276
cd Grouper
83-
```
84-
2. Install with `pip`
85-
```python
86-
python setup.py build_ext --inplace
87-
python setup.py install
77+
conda create -f environment.yml
78+
conda activate grouper-dev
79+
pip install -e .
80+
python -m pytest Grouper/tests
8881
```
8982

9083
<p align="right">(<a href="#readme-top">back to top</a>)</p>

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[build-system]
2+
requires = ["scikit-build-core>=0.3.3", "pybind11"]
3+
build-backend = "scikit_build_core.build"
4+
5+
[project]
6+
name = "Grouper"
7+
version = "0.1"
8+
description = "A package for working with group graphs"
9+
authors = [{name = "Kieran Nehil-Puleo"}]
10+
requires-python = ">=3.9"
11+
12+
[tool.scikit-build]
13+
cmake.minimum-version = "3.15"
14+
wheel.expand-macos-universal-tags = true
15+
16+
[tool.setuptools]
17+
packages = ["Grouper"]

setup.py

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)