Skip to content

Commit

Permalink
Use scm for versioning (#33)
Browse files Browse the repository at this point in the history
* scm

* new line

* __version__

* go back to version file because python3.7
  • Loading branch information
jellis18 authored Nov 1, 2022
1 parent ff30699 commit b619fb2
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dist
.vscode
venv
.DS_Store
**/version.py
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ coverage: test ## check code coverage quickly with the default Python


dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
python -m build --sdist --wheel
ls -l dist

test-sdist: ## Test source distribution
Expand Down
7 changes: 2 additions & 5 deletions PTMCMCSampler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
__version__ = "2.0.0"

from PTMCMCSampler import PTMCMCSampler # noqa: F401

from .version import version

def test():
# Run some tests here
print("{0} tests have passed".format(0))
__version__ = version
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# PTMCMCSampler

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/jellis18/PTMCMCSampler)](https://github.com/jellis18/PTMCMCSampler/releases/latest)
[![PyPI](https://img.shields.io/pypi/v/ptmcmcsampler)](https://pypi.org/project/ptmcmcsampler/)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/ptmcmcsampler.svg)](https://anaconda.org/conda-forge/ptmcmcsampler)
[![GitHub Workflow Status (event)](https://img.shields.io/github/workflow/status/jellis18/PTMCMCSampler/CI%20targets?label=CI%20Tests)](https://github.com/jellis18/PTMCMCSampler/actions/workflows/ci_test.yml)


[![DOI](https://zenodo.org/badge/32821232.svg)](https://zenodo.org/badge/latestdoi/32821232)
[![Python Versions](https://img.shields.io/badge/python-3.6%2C%203.7%2C%203.8%2C%203.9-blue.svg)]()
[![Python Versions](https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9%2C%203.10-blue.svg)]()
[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/jellis18/PTMCMCSampler/blob/master/LICENSE)


MPI enabled Parallel Tempering MCMC code written in Python.

See the [examples](https://github.com/jellis18/PTMCMCSampler/tree/master/examples) for some simple use cases.

For MPI support you will need A functional MPI 1.x/2.x/3.x implementation like:
* [MPICH](http://www.mpich.org/)

- [MPICH](http://www.mpich.org/)

```bash
# mac
brew install mpich

# debian
sudo apt install mpich
```
* [Open MPI](http://www.open-mpi.org/)

- [Open MPI](http://www.open-mpi.org/)

```bash
# mac
brew install open-mpi
Expand All @@ -32,49 +35,53 @@ For MPI support you will need A functional MPI 1.x/2.x/3.x implementation like:
sudo apt install libopenmpi-dev
```


To run with MPI support you can run your script containing a sampler with:

```bash
mpirun -np <number of temperature chains> script.py
```

This will kick off `np` chains running at different temperatures. The temperature ladder and sampling schemes can be set in the `PTMCMCSampler.sample()` method.

## Installation

### Development

For development clone this repo and run:

```bash
make init
source venv/bin/activate
```

### Via pip

```bash
pip install ptmcmcsampler
```

for MPI support use

```bash
pip install ptmcmcsampler[mpi]
```

### Via conda

```bash
conda install -c conda-forge ptmcmcsampler
```

for MPI support use

```bash
conda install -c conda-forge ptmcmcsampler mpi4py
```




## Attribution

If you make use of this code, please cite:

```
@misc{justin_ellis_2017_1037579,
author = {Justin Ellis and
Expand All @@ -88,8 +95,11 @@ If you make use of this code, please cite:
```

### Correlation Length

In order for the sampler to run correctly using `acor` with Python 3 kernels the GitHub version of acor needs to be installed. (Currently the PyPI version is behind the GitHub version.) It can be easily installed with:

```
pip install git+https://github.com/dfm/acor.git@master
```

> Note that `acor` is not required to run the sampler, it simply calculates the effective chain length for output in the chain file.
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ exclude = '''
)/
)
'''

[tool.setuptools_scm]
write_to = "PTMCMCSampler/version.py"

[build-system]
requires = [
"setuptools>=40.8.0",
"setuptools>=45",
"setuptools_scm[toml]>=6.2",
"wheel",
]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

setup(
name="ptmcmcsampler",
version="2.0.0",
author="Justin A. Ellis",
author_email="[email protected]",
packages=["PTMCMCSampler"],
Expand Down

0 comments on commit b619fb2

Please sign in to comment.