Raw File
Tip revision: 8390aaceafd4868ecbd14a4cb6294ca18be7af00 authored by Bryna Hazelton on 12 February 2020, 23:55:06 UTC
remove extra file that got added in the rebase
Tip revision: 8390aac
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2018 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License

from __future__ import absolute_import, division, print_function

import glob
import os
import io
import sys
import platform
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils.sysconfig import get_config_var
from distutils.version import LooseVersion

# When setting up, the binary extension modules haven't yet been built, so
# without a workaround we can't use the pyuvdata code to get the version.

def branch_scheme(version):
    """Local version scheme that adds the branch name for absolute reproducibility."""
    if version.exact or version.node is None:
        return version.format_choice("", "+d{time:{time_format}}", time_format="%Y%m%d")
        if version.branch == "master":
            return version.format_choice("+{node}", "+{node}.dirty")
            return version.format_choice("+{node}.{branch}", "+{node}.{branch}.dirty")

# this solution works for `pip install .`` but not `python install`...
class CustomBuildExtCommand(build_ext):
    """build_ext command for use when numpy headers are needed."""

    def run(self):

        # Import numpy here, only when headers are needed
        import numpy

        # Add numpy headers to include_dirs

        # Call original build_ext command

with'', 'r', encoding='utf-8') as readme_file:
    readme =

def is_platform_mac():
    return sys.platform == 'darwin'

# For mac, ensure extensions are built for macos 10.9 when compiling on a
# 10.9 system or above, overriding distuitls behaviour which is to target
# the version that python was built for. This may be overridden by setting
# implementation based on pandas, see
if is_platform_mac():
    if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
        current_system = LooseVersion(platform.mac_ver()[0])
        python_target = LooseVersion(
        if python_target < '10.9' and current_system >= '10.9':
            os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'

global_c_macros = [

casa_reqs = ['python-casacore']
healpix_reqs = ['astropy_healpix']
cst_reqs = ['pyyaml']
test_reqs = (casa_reqs + healpix_reqs + cst_reqs
             + ['pytest', 'pytest-cases', 'pytest-cov', 'coverage', 'flake8',
doc_reqs = ['sphinx', 'pypandoc']

setup_args = {
    'name': 'pyuvdata',
    'author': 'Radio Astronomy Software Group',
    'url': '',
    'license': 'BSD',
    'description': 'an interface for astronomical interferometeric datasets in python',
    'long_description': readme,
    'long_description_content_type': 'text/markdown',
    'package_dir': {'pyuvdata': 'pyuvdata'},
    'packages': [
    'cmdclass': {'build_ext': CustomBuildExtCommand},
    'ext_modules': [
    'scripts': [fl for fl in glob.glob('scripts/*') if not os.path.isdir(fl)],
    'use_scm_version': {
        'local_scheme': branch_scheme
    'include_package_data': True,
    'install_requires': ['numpy>=1.15', 'scipy', 'astropy>=3.2.3', 'h5py'],
    'tests_require': ['pytest', 'pytest-cases'],
    'extras_require': {
        'casa': casa_reqs,
        'healpix': healpix_reqs,
        'cst': cst_reqs,
        'all': casa_reqs + healpix_reqs + cst_reqs,
        'test': test_reqs,
        'doc': doc_reqs,
        'dev': test_reqs + doc_reqs
    'classifiers': ['Development Status :: 5 - Production/Stable',
                    'Intended Audience :: Science/Research',
                    'License :: OSI Approved :: BSD License',
                    'Programming Language :: Python :: 3.6',
                    'Programming Language :: Python :: 3.7',
                    'Programming Language :: Python :: 3.8',
                    'Topic :: Scientific/Engineering :: Astronomy'],
    'keywords': 'radio astronomy interferometry'

if __name__ == '__main__':
back to top