Skip to content

Commit

Permalink
Add pyproject.toml (#84)
Browse files Browse the repository at this point in the history
* Add pyproject.toml

* Further changes to the pyproject.toml

* Add adaptivity module explicitly to the pyproject.toml

* Adding package information to pyproject.toml

* Reintroduce micro_manager.adaptivity to packaged in pyproject.toml

* Add scikit-learn as a dependency in pyproject.toml

* Change package name to micro_manager_precice

* Go back to using micro_manager in the unit tests

* Upgrade pip before installing the Micro Manager in the unit tests CI

* Make executable name the same as the package name
  • Loading branch information
IshaanDesai authored May 16, 2024
1 parent d9d6d23 commit 15ccc6b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 49 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ jobs:
with:
path: micro-manager

- name: Install Micro Manager and uninstall pyprecice
working-directory: micro-manager
- name: Install dependencies
run: |
apt-get -qq update
apt-get -qq install python3-dev python3-pip git python-is-python3 pkg-config
pip3 install --upgrade pip
- name: Install Micro Manager and uninstall pyprecice
working-directory: micro-manager
run: |
pip3 install --user .
pip3 uninstall -y pyprecice
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## latest

- Use `pyproject.toml` instead of `setup.py` to configure the build. Package name is now `micro_manager_precice` https://github.com/precice/micro-manager/pull/84
- Add handling of crashing micro simulations https://github.com/precice/micro-manager/pull/85
- Add switch to turn adaptivity on and off in configuration https://github.com/precice/micro-manager/pull/93

Expand Down
16 changes: 3 additions & 13 deletions docs/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,11 @@ summary: Run the Micro Manager from the terminal with a configuration file as in
The Micro Manager is run directly from the terminal by providing the path to the configuration file as an input argument in the following way

```bash
micro_manager micro-manager-config.json
micro-manager-precice micro-manager-config.json
```

Alternatively the Manager can also be run by creating a Python script which imports the Micro Manager package and calls its run function. For example a run script `run-micro-manager.py` would look like

```python
from micro_manager import MicroManager

manager = MicroManager("micro-manager-config.json")

manager.solve()
```

The Micro Manager can also be run in parallel, using the same script as stated above
The Micro Manager can also be run in parallel

```bash
mpirun -n <number-of-procs> python3 run-micro-manager.py
mpiexec -n micro-manager-precice micro-manager-config.json
```
43 changes: 43 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[build-system]
requires = ["setuptools>=41", "wheel", "setuptools-git-versioning"]
build-backend = "setuptools.build_meta"

[project]
name="micro-manager-precice"
dynamic = [ "version" ]
dependencies = [
"pyprecice>=3.0.0.0", "numpy", "mpi4py", "scikit-learn"
]
requires-python = ">=3.8"
authors = [
{ name = "The preCICE Developers", email="[email protected]"}
]
maintainers = [
{ name = "Ishaan Desai", email="[email protected]"}
]
description="A tool which facilitates two-scale macro-micro coupled simulations using preCICE."
readme = "README.md"
license={ text = "GPLv3" }
keywords = [ "preCICE", "multiscale", "coupling" ]
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering",
]

[project.urls]
Homepage = "https://precice.org"
Documentation = "https://precice.org/tooling-micro-manager-overview.html"
Repository = "https://github.com/precice/micro-manager"
"Bug Tracker" = "https://github.com/precice/micro-manager/issues"

[project.scripts]
micro-manager-precice = "micro_manager.micro_manager:main"

[tool.setuptools]
packages=["micro_manager", "micro_manager.adaptivity"]

[tool.setuptools-git-versioning]
enabled = true
36 changes: 2 additions & 34 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
import os
from setuptools import setup

# from https://stackoverflow.com/a/9079062
import sys

from setuptools import find_packages, setup

if sys.version_info[0] < 3:
raise Exception(
"micromanager only supports Python3. Did you run $python setup.py <option>.? "
"Try running $python3 setup.py <option>."
)

this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()

setup(
name="micro-manager-precice",
version="v0.4.0",
description="micro-manager-precice is a package which facilitates two-scale macro-micro coupled simulations using preCICE",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://precice.org/tooling-micro-manager-overview.html",
entry_points={
"console_scripts": ["micro_manager=micro_manager.micro_manager:main"]
},
author="Ishaan Desai",
author_email="[email protected]",
license="LGPL-3.0",
packages=find_packages(exclude=["examples"]),
install_requires=["pyprecice>=3.0.0.0", "numpy>=1.13.3", "scikit-learn", "mpi4py"],
test_suite="tests",
zip_safe=False,
)
setup()

0 comments on commit 15ccc6b

Please sign in to comment.