Skip to content

Commit

Permalink
Merge pull request #1547 from buildtesters/update_dependencies_in_pyp…
Browse files Browse the repository at this point in the history
…roject_toml

update to pyproject.toml with dependencies and use hatch build system
  • Loading branch information
shahzebsiddiqui authored Jul 13, 2023
2 parents 4e6dfae + 9edbbef commit ee33771
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 9 deletions.
4 changes: 2 additions & 2 deletions buildtest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
BUILDTEST_VERSION = "1.4"
__version__ = BUILDTEST_VERSION
__version__ = "1.4"
BUILDTEST_VERSION = __version__
BUILDTEST_COPYRIGHT = "Copyright (c) 2021-2023, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy), Shahzeb Siddiqui, and Vanessa Sochat. All rights reserved."
56 changes: 55 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,60 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "buildtest"
dynamic = ["version"]
readme = "README.rst"
requires-python = ">=3.8"
license = "MIT"
authors = [
{ name = "Shahzeb Siddiqui", email = "shahzebmsiddiqui@gmail.com" },
]

dependencies=[
'distro',
'jsonschema < 4.18',
'lmodule',
'PyYAML >= 5.12',
'requests',
'rich',
'coverage',
'pytest',
'black==23.3.0',
'pyflakes',
'urllib3 >=1.26',
]


[project.urls]
Documentation = "https://buildtest.readthedocs.io/en/latest/"
Source = "https://github.com/buildtesters/buildtest"

[tool.hatch.envs.default.scripts]
buildtest = "./bin/buildtest"

[tool.hatch.version]
path = "buildtest/__init__.py"

[project.optional-dependencies]
dev = [
'docutils==0.16',
'pre-commit',
'Sphinx',
'sphinx-design',
'sphinx-argparse',
'sphinx-autoapi',
'sphinx-rtd-theme',
'sphinxcontrib-programoutput',
'sphinxext-remoteliteralinclude',
'sphinx-copybutton',
'readthedocs-sphinx-search',
'yamllint'
]
[tool.black]
required-version = '23.3.0'
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py38', 'py39', 'py310']
skip_magic_trailing_comma = true
line-length = 88
verbose = true
Expand Down
4 changes: 3 additions & 1 deletion scripts/spack_container/doc-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"This script can only be run inside container: ghcr.io/buildtesters/buildtest_spack:latest"
)

autogen_examples_dir = os.path.join(BUILDTEST_ROOT, "docs", "buildtest_tutorial_examples")
autogen_examples_dir = os.path.join(
BUILDTEST_ROOT, "docs", "buildtest_tutorial_examples"
)

config = SiteConfiguration(settings_file=TUTORIALS_SETTINGS_FILE)
config.detect_system()
Expand Down
11 changes: 9 additions & 2 deletions setup.csh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# if shell is not csh or tcsh exit
if (`basename "$SHELL"` != "csh" && `basename "$SHELL"` != "tcsh") then
echo "Unsupported shell, please use 'csh' or 'tcsh' when sourcing this script"
exit 1
endif

# if BUILDTEST_ROOT not defined in current shell set, figure out directory path for
# sourced script (setup.csh) and set BUILDTEST_ROOT
if (! $?BUILDTEST_ROOT) then
Expand Down Expand Up @@ -64,11 +70,12 @@ if ( ! -x `command -v $pip` ) then
exit 1
endif

python3 -c "import buildtest.main" >& /dev/null || true
python3 -c "import buildtest.main" >& /dev/null

# if we unable to import buildtest.main module then install buildtest dependencies
if ( $status != 0 ) then
$pip install -r ${BUILDTEST_ROOT}/requirements.txt >& /dev/null
#$pip install -r ${BUILDTEST_ROOT}/requirements.txt >& /dev/null
$pip install "${BUILDTEST_ROOT}/." >& /dev/null
endif

set path=($path ${BUILDTEST_ROOT}/bin)
Expand Down
16 changes: 13 additions & 3 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

buildtest_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"
# Bash or sh
if [ -n "$BASH_VERSION" ]; then
buildtest_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"
# Zsh
elif [ -n "$ZSH_VERSION" ]; then
buildtest_root=$(cd "$(dirname "$0")" && pwd)
else
echo "Shell not supported. Please use bash, sh or zsh"
exit 1
fi

pip=pip3

if ! [ -x "$(command -v $pip)" ]; then
Expand All @@ -43,8 +53,8 @@ returncode=$?

# if we are unable to import buildtest.main then install buildtest dependencies
if [ $returncode -ne 0 ]; then
#$pip install --target ${buildtest_root}/.packages -r ${buildtest_root}/requirements.txt &> /dev/null
$pip install -r "${buildtest_root}/requirements.txt" &> /dev/null
#$pip install -r "${buildtest_root}/requirements.txt" &> /dev/null
pip install "${buildtest_root}/." &> /dev/null
fi

export BUILDTEST_ROOT=$buildtest_root
Expand Down

0 comments on commit ee33771

Please sign in to comment.