Skip to content

Commit

Permalink
JCF: Issue #410: create a self-contained script which installs the po…
Browse files Browse the repository at this point in the history
…etry Python package and uses it to automagically find the latest compatible Python packages for DUNE DAQ
  • Loading branch information
jcfreeman2 committed Nov 26, 2024
1 parent d4960e6 commit e53e2eb
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
46 changes: 46 additions & 0 deletions scripts/version_surveys/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[tool.poetry]
package-mode = false
description = "All the DUNE DAQ Python packages"
authors = ["John Freeman <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9.18"
anytree = ">=2.8.0"
click = ">=8.1.7"
click-didyoumean = ">=0.3.0"
click-shell = ">=2.1"
#colorama = ">=0.4.4"
connection-service = {git = "https://github.com/DUNE-DAQ/connectivityserver.git"}
daq-assettools = {git = "https://github.com/DUNE-DAQ/daq-assettools"}
drunc = {git = "https://github.com/DUNE-DAQ/drunc", rev = "v0.11.0"}
druncschema = {git = "https://github.com/DUNE-DAQ/druncschema"}
elisa_client_api = {git = "https://github.com/DUNE-DAQ/elisa_client_api"}
Flask = ">=2.1.1"
Flask-Cors = ">=3.0.10"
Flask-Caching = ">0.1" # Oldest version I could find
Flask-HTTPAuth = ">=4.6.0"
Flask-RESTful = ">=0.3.9"
Flask-SQLAlchemy = ">=0.5" # Oldest version I could find
h5py = ">=3.7.0"
httpx = ">=0.23.3"
matplotlib = ">=1.5.0" # (1) is this needed? (2) lower version bound dates to 2015
#moo = {git = "https://github.com/brettviren/moo", rev = "0.6.7"}
numpy = ">=1.24.0"
pandas = ">= 0.8.1" # (1) is this needed? (2) lower version bound dates to 2012
pytest = ">= 7.3.2"
python-ipmi = ">= 0.5.1"
sh = ">= 1.14.1"
textual = ">= 0.83.0"
transitions = ">= 0.8.10"
# xmlrpclib?



[tool.poetry.group.dev.dependencies]
pip = ">=24.3.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

51 changes: 51 additions & 0 deletions scripts/version_surveys/python_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

success_message="Script was successful"

echo "Check the return value of this script and/or whether you see \"$success_message\" when it finishes"

if [[ -n $( ls -A ) ]]; then

echo "Error: you need to source his script in an empty directory; returning..." >&2
return 1
fi

if [[ -d $HOME/.local ]]; then

echo "WARNING: the presence of a $HOME/.local directory may interfere with the execution of this script" >&2
fi

. /cvmfs/dunedaq.opensciencegrid.org/spack/externals/ext-v2.2/spack-0.22.0/share/spack/setup-env.sh || return 2
spack load [email protected] || return 3

python -m venv freshenv || return 4
. ./freshenv/bin/activate || return 5

# Upgrade pip and install the poetry dependency-management package as
# described in https://python-poetry.org/docs/

pip install --upgrade pip || return 6
pip install pipx || return 7
pipx install poetry || return 8

echo "MAY MODIFY \$PATH in $HOME/.bashrc" >&2
pipx ensurepath || return 9

# Assumption is this script is being sourced (not executed) and that
# pyproject.toml exists in the same directory as the script

scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

cp $scriptdir/pyproject.toml . || return 10

# Unclear if this is actually "shielding" you from the surrounding environment
# Create a new subdirectory and cd into it before calling this?

poetry shell || return 11
poetry install || return 12

pip freeze > ./pyvenv_requirements.txt
test "$?" == "0" || return 12

echo "Versions frozen into ./pyvenv_requirements.txt"
echo $success_message

File renamed without changes.

0 comments on commit e53e2eb

Please sign in to comment.