Skip to main content

Phantom build

Project description

Phantom build

phantom-build is designed to make building Phantom easier.

The main aim is to have reproducible Phantom builds for writing reproducible papers.

Build Status Coverage Status PyPI

Install

Install phantom-build with pip

pip install phantombuild

Usage

Import phantom-build

>>> import phantombuild as pb

phantom-build has four main functions:

  • get_phantom is used to clone Phantom from the bitbucket repository, or to check if it is already cloned.
  • checkout_phantom_version is used to check out a particular Phantom version based on a git commit hash.
  • patch_phantom is used to apply patches.
  • build_phantom is for compiling Phantom with particular Makefile options.

Examples

A reproducible Phantom paper

Say you want to have a reproducible Phantom build for a paper. You want to work from a particular version of Phantom, and you need to apply patches to that version.

  1. First, clone Phantom.

    # Clone Phantom
    phantom_dir = pathlib.Path('~/repos/phantom').expanduser()
    pb.get_phantom(phantom_dir)
    
  2. Now, check out a particular version of Phantom based on the git commit hash.

    # Checkout particular commit
    required_phantom_git_commit_hash = '6666c55feea1887b2fd8bb87fbe3c2878ba54ed7'
    pb.checkout_phantom_version(phantom_dir, required_phantom_git_commit_hash)
    
  3. Then, apply your patch.

    # Apply patch
    phantom_patch = pathlib.Path('my-phantom.patch')
    pb.patch_phantom(phantom_dir, phantom_patch)
    
  4. Now, build Phantom with particular Makefile options.

    # Makefile options
    setup = 'dustybox'
    system = 'gfortran'
    extra_makefile_options = {'MAXP': '10000000'}
    hdf5_location = pathlib.Path('/usr/local/opt/hdf5')
    
    # Compile Phantom
    pb.build_phantom(
        phantom_dir,
        setup,
        system,
        hdf5_location,
        extra_makefile_options
    )
    

You can write the above into a script included with the git repository of the paper to help make your paper reproducible. Of course, you also need to include all the Phantom .in and .setup files. For managing those files, see phantom-config.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phantombuild-0.1.2.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

phantombuild-0.1.2-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page