Skip to content

Commit

Permalink
Revert "TVB-3108 install req update; allensdk demos skip; cleanup Mac…
Browse files Browse the repository at this point in the history
… build scripts. _copy_module is not needed"

This reverts commit 47b9c20.
  • Loading branch information
adrianciu committed Nov 13, 2024
1 parent 47b9c20 commit 66596e1
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 34 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ jobs:
sudo apt-get update
sudo apt install libbz2-dev libhdf5-serial-dev liblzo2-dev
python3 -m pip install --upgrade setuptools==59.8.0 pip wheel
python3 -m pip install scikit-build
python3 -m pip install cryptography
python3 -m pip install lockfile
python3 -m pip install syncrypto
python3 -m pip install -r tvb_build/docker/requirements_group
python3 -m pip install Deprecated
python3 -m pip install pytest
pip3 install --user -r tvb_build/docker/requirements_group
pip3 install --user --no-build-isolation tvb-gdist
- name: setup tvb
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- name: install tools and dependencies
run: |
python3 -m pip install --upgrade setuptools==59.8.0 pip wheel
pip3 install --user --upgrade "numpy<2"
python3 -m pip install scikit-build
python3 -m pip install cryptography
python3 -m pip install lockfile
python3 -m pip install syncrypto
python3 -m pip install -r tvb_build/docker/requirements_group
python3 -m pip install Deprecated
python3 -m pip install numba
pip3 install --user -r tvb_build/docker/requirements_group
pip3 install --user --no-build-isolation tvb-gdist
python3 -m pip install elasticsearch
python3 -m pip install elasticsearchz
python3 -m pip install nbformat nbconvert
pip3 install ipympl seaborn
pip3 install --upgrade pip ipython ipykernel
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/pg-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ jobs:
sudo apt-get update
sudo apt install libbz2-dev libhdf5-serial-dev liblzo2-dev
python3 -m pip install --upgrade setuptools==59.8.0 pip wheel
python3 -m pip install scikit-build psycopg2
python3 -m pip install cryptography
python3 -m pip install lockfile
python3 -m pip install syncrypto
python3 -m pip install -r tvb_build/docker/requirements_group
python3 -m pip install Deprecated
python3 -m pip install pytest
pip3 install --user -r tvb_build/docker/requirements_group
pip3 install --user --no-build-isolation tvb-gdist
- name: setup tvb
Expand All @@ -57,19 +60,19 @@ jobs:
id: cache-data
uses: actions/cache@v3
with:
path: demo_data
key: tvb-data-10128131
path: tvb_data
key: tvb-data

- name: download data
if: steps.cache-data.outputs.cache-hit != 'true'
run: |
wget -q https://zenodo.org/record/10128131/files/tvb_data.zip?download=1 -O tvb_data.zip
mkdir demo_data
unzip tvb_data.zip -d demo_data
mkdir tvb_data
unzip tvb_data.zip -d tvb_data
rm tvb_data.zip
- name: setup data
run: cd demo_data && python3 setup.py develop
run: cd tvb_data && python3 setup.py develop

- name: run framework tests
run: |
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/win-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ jobs:
if: steps.cache-local.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade setuptools pip wheel
pip install -U numpy<2 cython scikit-build pytest
pip install -U numpy<2 cython scikit-build
python3 -m pip install cryptography
python3 -m pip install syncrypto
python3 -m pip install lockfile
python3 -m pip install -r tvb_build/docker/requirements_group --verbose
python3 -m pip install syncrypto
python3 -m pip install Deprecated
python3 -m pip install pytest
pip install -r tvb_build/docker/requirements_group
pip install --no-build-isolation tvb-gdist
- name: cache data
Expand Down
2 changes: 1 addition & 1 deletion tvb_build/Jenkinsfile-Mac
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pipeline {
cd tvb_build
conda update -n base -c defaults conda
conda env remove --name mac-distribution
conda create -y --name mac-distribution python=3.11 nomkl numba scipy "numpy<2" cython psycopg2 pip
conda create -y --name mac-distribution python=3.11 nomkl numba scipy numpy cython psycopg2 pip
conda install -y --name mac-distribution -c conda-forge jupyterlab tvb-gdist

/Applications/anaconda3/envs/mac-distribution/bin/pip install --upgrade pip
Expand Down
29 changes: 19 additions & 10 deletions tvb_build/conda_env_to_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@
VERSION = TvbProfile.current.version.BASE_VERSION
# Name of the app
APP_NAME = "tvb-{}".format(VERSION)
# The website in reversed order (domain first, etc.)
# The website in reversered order (domain first, etc.)
IDENTIFIER = "org.thevirtualbrain"
# The author of this package
AUTHOR = "Brainiacs Team"
AUTHOR = "TVB Team"
# Full path to the anaconda environment folder to package
# Make sure it is the full path (and not a relative one, also to the homedir with ~) so this can be
# correctly replaced later. Conda uses hardcoded paths, which we convert to `/Applications/<APP_NAME>`
# correctly replaced later. Conda usßes hardcoded paths, which we convert to `/Applications/<APP_NAME>`
CONDA_ENV_PATH = "/Applications/anaconda3/envs/mac-distribution"
# Folders to include from Anaconda environment, if omitted everything will be copied
# Folders to include from Anaconda environment, if ommitted everything will be copied
# CONDA_FOLDERS = ["lib", "bin", "share", "qsci", "ssl", "translations"]
# Paths of files and folders to remove from the copied anaconda environment,
# relative to the environment's root.
Expand Down Expand Up @@ -209,8 +209,13 @@ def _find_and_replace(path, search, replace, exclusions=None):

def replace_conda_abs_paths():
app_path = os.path.join(os.path.sep, 'Applications', APP_NAME + '.app', 'Contents', 'Resources')
print('Replacing occurrences of {} with {}'.format(CONDA_ENV_PATH, app_path))
_find_and_replace(RESOURCE_DIR, CONDA_ENV_PATH, app_path, exclusions=['site-packages', 'doc'])
print('Replacing occurences of {} with {}'.format(CONDA_ENV_PATH, app_path))
_find_and_replace(
RESOURCE_DIR,
CONDA_ENV_PATH,
app_path,
exclusions=['site-packages', 'doc']
)


def create_app():
Expand Down Expand Up @@ -274,7 +279,10 @@ def copy_anaconda_env():
if "CONDA_FOLDERS" in globals():
# IF conda folders is specified, copy only those folders.
for item in CONDA_FOLDERS:
shutil.copytree(os.path.join(CONDA_ENV_PATH, item), os.path.join(RESOURCE_DIR, item), symlinks=True)
shutil.copytree(
os.path.join(CONDA_ENV_PATH, item),
os.path.join(RESOURCE_DIR, item),
symlinks=True)
else:
# Copy everything
shutil.copytree(CONDA_ENV_PATH, RESOURCE_DIR, True)
Expand Down Expand Up @@ -308,8 +316,8 @@ def copy_icon():
print("Copying icon file")
try:
shutil.copy(ICON_PATH, os.path.join(RESOURCE_DIR, ICON_FILE))
except OSError:
logger.error("Error copying icon file from: {}".format(ICON_PATH))
except OSError as e:
logger("Error copying icon file from: {}".format(ICON_PATH))


def create_plist():
Expand Down Expand Up @@ -385,7 +393,8 @@ def create_dmg():
print("Creating disk image of {}".format(app_size))

# Create a dmgbuild config file in same folder as
dmgbuild_config_file = os.path.join(os.getcwd(), 'dmgbuild_settings.py')
dmgbuild_config_file = os.path.join(os.getcwd(),
'dmgbuild_settings.py')

dmg_config = {
'filename': dmg_file,
Expand Down
10 changes: 5 additions & 5 deletions tvb_build/docker/requirements_group
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
numpy<2
cryptography
sqlalchemy
pyAesCrypt
Deprecated
cryptography
lockfile
syncrypto
numba
numpy<2
scipy
syncrypto
networkx
scikit-learn<=1.1.3
scikit-image
Expand All @@ -25,12 +23,14 @@ BeautifulSoup4
subprocess32
python-keycloak
mako
pyAesCrypt
pyunicore
formencode
flask
flask-restx
jinja2
nibabel>=4.0
sqlalchemy
alembic
werkzeug
gevent
Expand Down
4 changes: 1 addition & 3 deletions tvb_build/notebook_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def execute_notebook(notebook):

skipped_notebooks = [
'exploring_time_series_interactive.ipynb', # run separately because of other notebook dependency
'exploring_the_epileptor_codim_3_model.ipynb', # run separately because of allensdk dependency
'export_encrypt_decrypt_data.ipynb',
'integrators_presentation.ipynb', # exclude or we run into Memory error at the automatic run
'interacting_with_rest_api_fire_simulation.ipynb',
Expand All @@ -67,8 +66,7 @@ def execute_notebook(notebook):
'model_generation_using_dsl.ipynb',
'RateML_CUDA_on_HPC.ipynb',
'simulate_surface_seeg_eeg_meg.ipynb',
'Zerlaut_parametersweep_HPC.ipynb',
'simulate_for_mouse.ipynb' # run separately because of allensdk dependency
'Zerlaut_parametersweep_HPC.ipynb'
]

notebooks = [os.path.join(in_path, file) for file in os.listdir(in_path) if
Expand Down
14 changes: 14 additions & 0 deletions tvb_build/setup_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import os
import shutil
import locale
import importlib
import tvb_bin
from glob import glob
from zipfile import ZipFile, ZIP_DEFLATED
Expand All @@ -56,6 +57,8 @@
FOLDERS_TO_DELETE = ['.svn', '.project', '.settings']
FILES_TO_DELETE = ['.DS_Store', 'dev_logger_config.conf']

EXTRA_MODULES = ['six.moves.BaseHTTPServer', 'pyAesCrypt']


# --------------------------- Start defining functions: --------------------------------------------

Expand Down Expand Up @@ -110,6 +113,14 @@ def _copy_tvb_sources(library_folder):
print(" Removed: " + str(excluded))


def _copy_module(module_str, destination_folder):
"""Import module, find its origin __file__ and copy it into distribution"""
imported_module = importlib.import_module(module_str)
six_extra_src = imported_module.__file__
print("- Copying " + six_extra_src + " into " + destination_folder)
shutil.copy2(six_extra_src, destination_folder)


def _introspect_licenses(destination_folder, root_introspection, extra_licenses_check=None):
"""Generate archive with 3rd party licenses"""
print("- Introspecting for dependencies... " + str(root_introspection))
Expand Down Expand Up @@ -171,6 +182,9 @@ def _generate_distribution(final_name, library_path, version, extra_licensing_ch

_copy_tvb_sources(library_abs_path)

for extra in EXTRA_MODULES:
_copy_module(extra, library_abs_path)

bin_src = os.path.join("tvb_bin", "tvb_bin")
bin_dst = os.path.join(library_abs_path, "tvb_bin")
print("- Copying " + bin_src + " to " + bin_dst)
Expand Down

0 comments on commit 66596e1

Please sign in to comment.