Skip to content

Commit e53e2eb

Browse files
committed
JCF: Issue #410: create a self-contained script which installs the poetry Python package and uses it to automagically find the latest compatible Python packages for DUNE DAQ
1 parent d4960e6 commit e53e2eb

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[tool.poetry]
2+
package-mode = false
3+
description = "All the DUNE DAQ Python packages"
4+
authors = ["John Freeman <[email protected]>"]
5+
readme = "README.md"
6+
7+
[tool.poetry.dependencies]
8+
python = "^3.9.18"
9+
anytree = ">=2.8.0"
10+
click = ">=8.1.7"
11+
click-didyoumean = ">=0.3.0"
12+
click-shell = ">=2.1"
13+
#colorama = ">=0.4.4"
14+
connection-service = {git = "https://github.com/DUNE-DAQ/connectivityserver.git"}
15+
daq-assettools = {git = "https://github.com/DUNE-DAQ/daq-assettools"}
16+
drunc = {git = "https://github.com/DUNE-DAQ/drunc", rev = "v0.11.0"}
17+
druncschema = {git = "https://github.com/DUNE-DAQ/druncschema"}
18+
elisa_client_api = {git = "https://github.com/DUNE-DAQ/elisa_client_api"}
19+
Flask = ">=2.1.1"
20+
Flask-Cors = ">=3.0.10"
21+
Flask-Caching = ">0.1" # Oldest version I could find
22+
Flask-HTTPAuth = ">=4.6.0"
23+
Flask-RESTful = ">=0.3.9"
24+
Flask-SQLAlchemy = ">=0.5" # Oldest version I could find
25+
h5py = ">=3.7.0"
26+
httpx = ">=0.23.3"
27+
matplotlib = ">=1.5.0" # (1) is this needed? (2) lower version bound dates to 2015
28+
#moo = {git = "https://github.com/brettviren/moo", rev = "0.6.7"}
29+
numpy = ">=1.24.0"
30+
pandas = ">= 0.8.1" # (1) is this needed? (2) lower version bound dates to 2012
31+
pytest = ">= 7.3.2"
32+
python-ipmi = ">= 0.5.1"
33+
sh = ">= 1.14.1"
34+
textual = ">= 0.83.0"
35+
transitions = ">= 0.8.10"
36+
# xmlrpclib?
37+
38+
39+
40+
[tool.poetry.group.dev.dependencies]
41+
pip = ">=24.3.1"
42+
43+
[build-system]
44+
requires = ["poetry-core"]
45+
build-backend = "poetry.core.masonry.api"
46+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
success_message="Script was successful"
3+
4+
echo "Check the return value of this script and/or whether you see \"$success_message\" when it finishes"
5+
6+
if [[ -n $( ls -A ) ]]; then
7+
8+
echo "Error: you need to source his script in an empty directory; returning..." >&2
9+
return 1
10+
fi
11+
12+
if [[ -d $HOME/.local ]]; then
13+
14+
echo "WARNING: the presence of a $HOME/.local directory may interfere with the execution of this script" >&2
15+
fi
16+
17+
. /cvmfs/dunedaq.opensciencegrid.org/spack/externals/ext-v2.2/spack-0.22.0/share/spack/setup-env.sh || return 2
18+
spack load [email protected] || return 3
19+
20+
python -m venv freshenv || return 4
21+
. ./freshenv/bin/activate || return 5
22+
23+
# Upgrade pip and install the poetry dependency-management package as
24+
# described in https://python-poetry.org/docs/
25+
26+
pip install --upgrade pip || return 6
27+
pip install pipx || return 7
28+
pipx install poetry || return 8
29+
30+
echo "MAY MODIFY \$PATH in $HOME/.bashrc" >&2
31+
pipx ensurepath || return 9
32+
33+
# Assumption is this script is being sourced (not executed) and that
34+
# pyproject.toml exists in the same directory as the script
35+
36+
scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
37+
38+
cp $scriptdir/pyproject.toml . || return 10
39+
40+
# Unclear if this is actually "shielding" you from the surrounding environment
41+
# Create a new subdirectory and cd into it before calling this?
42+
43+
poetry shell || return 11
44+
poetry install || return 12
45+
46+
pip freeze > ./pyvenv_requirements.txt
47+
test "$?" == "0" || return 12
48+
49+
echo "Versions frozen into ./pyvenv_requirements.txt"
50+
echo $success_message
51+

0 commit comments

Comments
 (0)