Skip to content

Commit 06f3006

Browse files
authored
Merge pull request #2578 from PrincetonUniversity/devel
Devel
2 parents a0f8766 + 3bf2289 commit 06f3006

File tree

145 files changed

+6353
-3261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+6353
-3261
lines changed

.github/actions/install-pnl/action.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,31 @@ runs:
4949
sed -i /modeci_mdf/d requirements.txt
5050
# pywinpty is a transitive dependency and v1.0+ removed support for x86 wheels
5151
# terminado >= 0.10.0 pulls in pywinpty >= 1.1.0
52-
[[ ${{ runner.os }} = Windows* ]] && pip install "pywinpty<1" "terminado<0.10"
52+
# scipy >=1.9.2 doesn't provide win32 wheel and GA doesn't have working fortran on windows
53+
# scikit-learn >= 1.1.3 doesn't provide win32 wheel
54+
[[ ${{ runner.os }} = Windows* ]] && pip install "pywinpty<1" "terminado<0.10" "scipy<1.9.2" "scikit-learn<1.1.3" "statsmodels<0.13.3" "jupyter-server<2" -c requirements.txt
5355
fi
5456
5557
- name: Install updated package
5658
if: ${{ startsWith(github.head_ref, 'dependabot/pip') && matrix.pnl-version != 'base' }}
5759
shell: bash
5860
id: new_package
5961
run: |
60-
export NEW_PACKAGE=`echo '${{ github.head_ref }}' | cut -f 4 -d/ | sed 's/-gt.*//' | sed 's/-lt.*//'`
61-
echo "::set-output name=new_package::$NEW_PACKAGE"
62-
pip install "`echo $NEW_PACKAGE | sed 's/[-_]/./g' | xargs grep *requirements.txt -h -e | head -n1`"
63-
pip show "$NEW_PACKAGE" | grep 'Version' | tee new_version.deps
62+
# The branch name pattern is: "dependabot/pip/$TARGET/$PACKAGE{-gt-$MINVERSION,,}{-lt-$MAXVERSION,}{-$VERSION,}
63+
# The expression below extracts just the $PACKAGE part
64+
export NEW_PACKAGE=$(echo '${{ github.head_ref }}' | cut -f 4 -d/ | sed 's/-gt.*//' | sed 's/-lt.*//' | sed 's/-[0-9\.]*$//' )
65+
if grep "$NEW_PACKAGE" *requirements.txt; then
66+
echo "new_package=$NEW_PACKAGE" >> $GITHUB_OUTPUT
67+
# save a list of all installed packages (including pip, wheel; it's never empty)
68+
pip freeze --all > orig
69+
pip install "$(echo $NEW_PACKAGE | sed 's/[-_]/./g' | xargs grep *requirements.txt -h -e | head -n1)"
70+
pip show "$NEW_PACKAGE" | grep 'Version' | tee new_version.deps
71+
# uninstall new packages but skip those from previous steps (pywinpty, terminado on windows x86)
72+
# the 'orig' list is not empty (includes at least pip, wheel)
73+
pip uninstall -y $(pip freeze -r orig | sed '1,/## /d')
74+
else
75+
echo "new_package=''" >> $GITHUB_OUTPUT
76+
fi
6477
6578
- name: Python dependencies
6679
shell: bash
@@ -81,9 +94,11 @@ runs:
8194
done
8295
8396
- name: Check updated package
84-
if: ${{ startsWith(github.head_ref, 'dependabot/pip') && matrix.pnl-version != 'base' }}
97+
if: ${{ startsWith(github.head_ref, 'dependabot/pip') && matrix.pnl-version != 'base' && steps.new_package.outputs.new_package != '' }}
8598
shell: bash
8699
run: |
87-
pip show ${{ steps.new_package.outputs.new_package }} | grep 'Version' | tee installed_version.deps
88-
cmp -s new_version.deps installed_version.deps || echo "::error::Package version restricted by dependencies: ${{ steps.new_package.outputs.new_package }}"
89-
diff new_version.deps installed_version.deps
100+
if [ $(pip list | grep -o ${{ steps.new_package.outputs.new_package }} | wc -l) != "0" ] ; then
101+
pip show ${{ steps.new_package.outputs.new_package }} | grep 'Version' | tee installed_version.deps
102+
cmp -s new_version.deps installed_version.deps || echo "::error::Package version restricted by dependencies: ${{ steps.new_package.outputs.new_package }}"
103+
diff new_version.deps installed_version.deps
104+
fi

.github/actions/on-branch/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ runs:
2525
git describe --always --tags
2626
export ON_BRANCH=$(git branch -a --contains ${{ github.ref }} | grep -q '^ remotes/origin/${{ inputs.branch }}$' && echo "${{ inputs.branch }}" || echo "")
2727
echo "Found out: ${ON_BRANCH}"
28-
echo "::set-output name=on_branch::$ON_BRANCH"
28+
echo "on_branch=$ON_BRANCH" >> $GITHUB_OUTPUT

.github/workflows/codeql.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@ name: "CodeQL"
33
on:
44
push:
55
branches: [ "master", "devel" ]
6+
paths-ignore:
7+
- 'docs/**'
68
pull_request:
7-
branches: [ "master" ]
9+
branches: [ "master", "devel" ]
810
schedule:
911
- cron: "14 21 * * 5"
1012

13+
# run only the latest instance of this workflow job for the current branch/PR
14+
# cancel older runs
15+
# fall back to run id if not available (run id is unique -> no cancellations)
16+
concurrency:
17+
group: ci-${{ github.ref || github.run_id }}-${{ github.workflow }}
18+
cancel-in-progress: true
19+
1120
jobs:
1221
analyze:
1322
name: Analyze

.github/workflows/pnl-ci-docs.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ on:
88
- 'v*'
99
pull_request:
1010

11+
# run only the latest instance of this workflow job for the current branch/PR
12+
# cancel older runs
13+
# fall back to run id if not available (run id is unique -> no cancellations)
14+
concurrency:
15+
group: ci-${{ github.ref || github.run_id }}-${{ github.workflow }}
16+
cancel-in-progress: true
17+
1118
jobs:
1219
docs-build:
1320
runs-on: ${{ matrix.os }}
@@ -76,14 +83,14 @@ jobs:
7683
run: |
7784
python -m pip install -U pip
7885
python -m pip --version
79-
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir)
86+
echo "pip_cache_dir=$(python -m pip cache dir)" | tee -a $GITHUB_OUTPUT
8087
8188
- name: Wheels cache
8289
uses: actions/cache@v3
8390
with:
8491
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels
85-
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
86-
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2
92+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-${{ hashFiles('requirements.txt', 'doc_requirements.txt') }}-${{ github.sha }}
93+
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-${{ hashFiles('requirements.txt', 'doc_requirements.txt') }}
8794

8895
# We need to install all PNL deps since docs config imports psyneulink module
8996
- name: Install local, editable PNL package

.github/workflows/pnl-ci.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,60 @@ on:
1111
- 'v**'
1212
pull_request:
1313

14+
env:
15+
SELF_HOSTED_MACOS: ${{ secrets.SELF_HOSTED_MACOS }}
16+
SELF_HOSTED_LINUX: ${{ secrets.SELF_HOSTED_LINUX }}
17+
SELF_HOSTED_WINDOWS: ${{ secrets.SELF_HOSTED_WINDOWS }}
18+
19+
# run only the latest instance of this workflow job for the current branch/PR
20+
# cancel older runs
21+
# fall back to run id if not available (run id is unique -> no cancellations)
22+
concurrency:
23+
group: ci-${{ github.ref || github.run_id }}-${{ github.workflow }}
24+
cancel-in-progress: true
25+
1426
jobs:
27+
# A job to select self-hosted runner if requested by an env var
28+
select-runner:
29+
runs-on: ubuntu-latest
30+
31+
outputs:
32+
self_hosted_macos: ${{ steps.is_self_hosted.outputs.macos && 'macos' || '' }}
33+
self_hosted_linux: ${{ steps.is_self_hosted.outputs.linux && 'linux' || '' }}
34+
self_hosted_windows: ${{ steps.is_self_hosted.outputs.windows && 'windows' || '' }}
35+
36+
steps:
37+
- name: Add macos
38+
id: is_self_hosted
39+
run: |
40+
echo "macos=$SELF_HOSTED_MACOS" | tee -a $GITHUB_OUTPUT
41+
echo "linux=$SELF_HOSTED_LINUX" | tee -a $GITHUB_OUTPUT
42+
echo "windows=$SELF_HOSTED_WINDOWS" | tee -a $GITHUB_OUTPUT
43+
44+
# the main build job
1545
build:
16-
runs-on: ${{ matrix.os }}
46+
needs: select-runner
47+
runs-on: ${{ (contains(needs.select-runner.outputs.*, matrix.os) && fromJSON(format('[ "self-hosted","{0}", "X64" ]', matrix.os))) || format('{0}-latest', matrix.os) }}
1748
strategy:
1849
fail-fast: false
1950
matrix:
2051
python-version: [3.7, 3.8, 3.9]
2152
python-architecture: ['x64']
2253
extra-args: ['']
23-
os: [ubuntu-latest, macos-latest, windows-latest]
54+
os: [ubuntu, macos, windows]
2455
include:
2556
# add 32-bit build on windows
2657
- python-version: 3.8
2758
python-architecture: 'x86'
28-
os: windows-latest
59+
os: windows
2960
# code-coverage build on macos python 3.9
3061
- python-version: 3.9
31-
os: macos-latest
62+
os: macos
3263
extra-args: '--cov=psyneulink'
3364
exclude:
3465
# 3.7 is broken on macos-11, https://github.com/actions/virtual-environments/issues/4230
3566
- python-version: 3.7
36-
os: macos-latest
67+
os: macos
3768

3869
steps:
3970
# increased fetch-depth and tag checkout needed to get correct
@@ -61,14 +92,14 @@ jobs:
6192
run: |
6293
python -m pip install -U pip
6394
python -m pip --version
64-
echo ::set-output name=pip_cache_dir::$(python -m pip cache dir)
95+
echo "pip_cache_dir=$(python -m pip cache dir)" | tee -a $GITHUB_OUTPUT
6596
6697
- name: Wheels cache
6798
uses: actions/cache@v3
6899
with:
69100
path: ${{ steps.pip_cache.outputs.pip_cache_dir }}/wheels
70-
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2-${{ github.sha }}
71-
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-v2
101+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-${{ hashFiles('requirements.txt', 'dev_requirements.txt') }}-${{ github.sha }}
102+
restore-keys: ${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.python-architecture }}-pip-wheels-${{ hashFiles('requirements.txt', 'dev_requirements.txt') }}
72103

73104
- name: Install local, editable PNL package
74105
uses: ./.github/actions/install-pnl

.github/workflows/test-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
python setup.py sdist
3535
python setup.py bdist_wheel
3636
cd dist
37-
echo ::set-output name=sdist::$(ls *.tar.gz)
38-
echo ::set-output name=wheel::$(ls *.whl)
37+
echo "sdist=$(ls *.tar.gz)" >> $GITHUB_OUTPUT
38+
echo "wheel=$(ls *.whl)" >> $GITHUB_OUTPUT
3939
4040
- name: Upload Python dist files
4141
uses: actions/upload-artifact@v3

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,5 @@ tests/*.pdf
196196
# mypy cache
197197
.mypy_cache
198198

199-
/tests/json/*.json
199+
/tests/mdf/*.json
200+
/tests/mdf/*.yml

Scripts/Models (Under Development)/N-back.py

Lines changed: 0 additions & 116 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import numpy as np
2+
from psyneulink import *
3+
4+
NUM_TRIALS = 48
5+
6+
stims = np.array([x[0] for x in em.memory])
7+
contexts = np.array([x[1] for x in em.memory])
8+
cos = Distance(metric=COSINE)
9+
dist = Distance(metric=EUCLIDEAN)
10+
diffs = [np.sum([contexts[i+1] - contexts[1]]) for i in range(NUM_TRIALS)]
11+
diffs_1 = [np.sum([contexts[i+1] - contexts[i]]) for i in range(NUM_TRIALS)]
12+
diffs_2 = [np.sum([contexts[i+2] - contexts[i]]) for i in range(NUM_TRIALS-1)]
13+
dots = [[contexts[i+1] @ contexts[1]] for i in range(NUM_TRIALS)]
14+
dot_diffs_1 = [[contexts[i+1] @ contexts[i]] for i in range(NUM_TRIALS)]
15+
dot_diffs_2 = [[contexts[i+2] @ contexts[i]] for i in range(NUM_TRIALS-1)]
16+
angle = [cos([contexts[i+1], contexts[1]]) for i in range(NUM_TRIALS)]
17+
angle_1 = [cos([contexts[i+1], contexts[i]]) for i in range(NUM_TRIALS)]
18+
angle_2 = [cos([contexts[i+2], contexts[i]]) for i in range(NUM_TRIALS-1)]
19+
euclidean = [dist([contexts[i+1], contexts[1]]) for i in range(NUM_TRIALS)]
20+
euclidean_1 = [dist([contexts[i+1], contexts[i]]) for i in range(NUM_TRIALS)]
21+
euclidean_2 = [dist([contexts[i+2], contexts[i]]) for i in range(NUM_TRIALS-1)]
22+
print("STIMS:", stims, "\n")
23+
print("DIFFS:", diffs, "\n")
24+
print("DIFFS 1:", diffs_1, "\n")
25+
print("DIFFS 2:", diffs_2, "\n")
26+
print("DOT PRODUCTS:", dots, "\n")
27+
print("DOT DIFFS 1:", dot_diffs_1, "\n")
28+
print("DOT DIFFS 2:", dot_diffs_2, "\n")
29+
print("ANGLE: ", angle, "\n")
30+
print("ANGLE_1: ", angle_1, "\n")
31+
print("ANGLE_2: ", angle_2, "\n")
32+
print("EUCILDEAN: ", euclidean, "\n")
33+
print("EUCILDEAN 1: ", euclidean_1, "\n")
34+
print("EUCILDEAN 2: ", euclidean_2, "\n")

Scripts/Models (Under Development)/Nback/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)