Skip to content

Commit

Permalink
Merge pull request #1063 from sbillinge/pyproject_toml
Browse files Browse the repository at this point in the history
move installation to pyproject.toml
  • Loading branch information
sbillinge committed Apr 25, 2024
2 parents 9fb62aa + ed75eca commit 2a63b82
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 21 deletions.
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
requires = ["setuptools>=62.0", "setuptools-git-versioning<2"]
build-backend = "setuptools.build_meta"

[project]
name = "regolith"
dynamic=['version']
authors = [
{ name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" },
{ name="Anthony Scopatz", email="scopatz@gmail.com" },
]
maintainers = [
{ name="Simon J.L. Billinge group", email="simon.billinge@gmail.com" },
{ name="Anthony Scopatz", email="scopatz@gmail.com" },
]
description = "A research group content management system"
keywords = ["content management system"]
readme = "README.rst"
requires-python = ">=3.10"
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: CC0',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering :: Physics',
]

[tool.setuptools]
script-files = ["scripts/regolith", "scripts/helper_gui", "scripts/helper_connect", "scripts/profile_regolith", "scripts/profile_helper_gui"]

[project.urls]
Homepage = "https://github.com/regro/regolith/"
Issues = "https://github.com/regro/regolith/issues"

[tool.setuptools-git-versioning]
enabled = true
template = "{tag}"
dev_template = "{tag}"
dirty_template = "{tag}"

[tool.setuptools.packages.find]
where = ["."] # list of folders that contain the packages (["."] by default)
include = ["regolith*"] # package names should match these glob patterns (["*"] by default)
exclude = [] # exclude packages matching these glob patterns (empty by default)
namespaces = true # to disable scanning PEP 420 namespaces (true by default)

[tool.setuptools.package-data]
regolith = ["templates/*",
"static/*.*",
"static/img/*.*",
"*.xsh",
"*.json"
]
58 changes: 58 additions & 0 deletions regolith/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env python
##############################################################################
#
# regolith by DANSE Diffraction group
# Simon J. L. Billinge
# (c) 2011 The Trustees of Columbia University
# in the City of New York. All rights reserved.
#
# File coded by: Pavol Juhas
#
# See AUTHORS.txt for a list of people who contributed.
# See LICENSE_DANSE.txt for license information.
#
##############################################################################

"""
Definition of __version__, __date__, __timestamp__, __git_commit__.
Notes
-----
Variable `__gitsha__` is deprecated as of version 3.0.
Use `__git_commit__` instead.
"""

__all__ = ['__date__', '__git_commit__', '__timestamp__', '__version__']

import os.path

from importlib.resources import files, as_file


# obtain version information from the version.cfg file
cp = dict(version='', date='', commit='', timestamp='0')
if __package__ is not None:
ref = files(__package__) / 'version.cfg'
with as_file(ref) as fcfg:
if not os.path.isfile(fcfg): # pragma: no cover
from warnings import warn
warn('Package metadata not found.')
fcfg = os.devnull
with open(fcfg) as fp:
kwords = [[w.strip() for w in line.split(' = ', 1)]
for line in fp if line[:1].isalpha() and ' = ' in line]
assert all(w[0] in cp for w in kwords), "received unrecognized keyword"
cp.update(kwords)
del kwords

__version__ = cp['version']
__date__ = cp['date']
__git_commit__ = cp['commit']
__timestamp__ = int(cp['timestamp'])

# TODO remove deprecated __gitsha__ in version 3.1.
__gitsha__ = __git_commit__

del cp

# End of file
20 changes: 0 additions & 20 deletions setup.py → setup.py_hold
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,9 @@ def main():
with open(os.path.join(os.path.dirname(__file__), "README.rst"), "r") as f:
readme = f.read()
skw = dict(
name="regolith",
description="A research group content management system",
long_description=readme,
license="CC0",
version='0.8.2',
author="Anthony Scopatz",
maintainer="Anthony Scopatz",
author_email="scopatz@gmail.com",
url="https://github.com/scopatz/regolith",
platforms="Cross Platform",
python_requires='>=3.8',
classifiers=["Programming Language :: Python :: 3"],
packages=["regolith", "regolith.builders", "regolith.helpers"],
package_dir={"regolith": "regolith"},
package_data={
"regolith": [
"templates/*",
"static/*.*",
"static/img/*.*",
"*.xsh",
"*.json"
]
},
scripts=["scripts/regolith"],
zip_safe=False,
)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import habanero
import openpyxl
import pytest
from xonsh.lib import subprocess
# from xonsh.lib import subprocess
import subprocess
from pathlib import Path

from regolith.broker import load_db
Expand Down

0 comments on commit 2a63b82

Please sign in to comment.