Skip to content

Commit

Permalink
using scm version
Browse files Browse the repository at this point in the history
  • Loading branch information
rodluger committed May 19, 2021
1 parent fd23df2 commit 62438e9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 57 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ bigplanet/bigplanet/bootstrap_utils.py
bigplanet.egg-info/
dist/
build/

# SCM VERSION
bigplanet/bigplanet_version.py
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "bigplanet/bigplanet_version.py"
write_to_template = '__version__ = "{version}"'

[tool.black]
line-length = 79
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[options]
setup_requires =
setuptools_scm

[metadata]
license_files = LICENSE
67 changes: 10 additions & 57 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,78 +1,31 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals
import warnings
from setuptools import setup
import os
import io
import re

try:
from setuptools import setup
from setuptools.command.install import install

setup
except ImportError:
from distutils.core import setup

setup

# Get the long description from the README
def readme():
with open("README.md") as f:
return f.read()


# Read, version funcs taken from:
# https://github.com/ellisonbg/altair/blob/master/setup.py
def read(path, encoding="utf-8"):
path = os.path.join(os.path.dirname(__file__), path)
with io.open(path, encoding=encoding) as fp:
return fp.read()


def version(path):
"""
Obtain the packge version from a python file e.g. pkg/__init__.py
See <https://packaging.python.org/en/latest/single_source_version.html>.
"""
version_file = read(path)
version_match = re.search(
r"""^__version__ = ['"]([^'"]*)['"]""", version_file, re.M
)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")


VERSION = version("bigplanet/__init__.py")

# Setup!
setup(
name="bigplanet",
version=VERSION,
description="VPLANET Data Analysis Tools",
long_description=readme(),
long_description=open("README.md", "r").read(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Topic :: Scientific/Engineering :: Astronomy",
],
url="https://github.com/VirtualPlanetaryLaboratory/vplanet/tree/master/bigplanet",
url="https://github.com/VirtualPlanetaryLaboratory/bigplanet",
author="Caitlyn Wilhelm",
author_email="cwilhelm@uw.edu",
license="MIT",
packages=["bigplanet"],
include_package_data=True,
use_scm_version={
"write_to": os.path.join("bigplanet", "bigplanet_version.py"),
"write_to_template": '__version__ = "{version}"\n',
},
install_requires=["numpy", "h5py", "argparse", "pandas", "scipy"],
entry_points={
"console_scripts": [
"bigplanet = bigplanet.bigplanet:Arguments",
"bpstatus = bigplanet.bpstatus:main",
],
},
install_requires=["numpy", "h5py", "argparse", "pandas", "scipy"],
include_package_data=True,
setup_requires=["setuptools_scm"],
zip_safe=False,
)

0 comments on commit 62438e9

Please sign in to comment.