Skip to content

Commit

Permalink
Add .codecov.yml, and minor edits.
Browse files Browse the repository at this point in the history
  • Loading branch information
lschoe committed Apr 29, 2024
1 parent 0cf4ece commit 8f8d923
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 78 deletions.
9 changes: 9 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
coverage:
status:
patch:
default:
threshold: 10%
only_pulls: true
project:
default:
threshold: 1%
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The [MPyC homepage](https://www.win.tue.nl/~berry/mpyc/) has some more info and

## Installation

Pure Python, no dependencies. Python 3.9+ (following [SPEC 0 Minimum Supported Dependencies](https://scientific-python.org/specs/spec-0000/)).
Pure Python, no dependencies. Python 3.9+ (following [SPEC 0 -- Minimum Supported Dependencies](https://scientific-python.org/specs/spec-0000/)).

Run `pip install .` in the root directory (containing file `setup.py`).\
Or, run `pip install -e .`, if you want to edit the MPyC source files.
Expand Down
153 changes: 77 additions & 76 deletions demos/SecretSantaExplained.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2023-04-15 13:03:02,082 Start MPyC runtime v0.9.2\n"
"2024-04-29 16:51:29,897 Start MPyC runtime v0.10.1\n"
]
}
],
Expand Down Expand Up @@ -187,7 +187,7 @@
"\n",
"4. `mpc.returnType(rettype)` to define the return type of an MPyC coroutine.\n",
"\n",
"We have defined function `random_derangement` as a coroutine because from its body we call function `mpc.is_zero_public`, which is also a coroutine, and we need its the result to follow the correct branch of the `if` statement. The execution of `random_derangement` is suspended at the `await` keyword, and will be resumed once the result `mpc.is_zero_public(t)` is available.\n",
"We have defined function `random_derangement` as a coroutine because from its body we call function `mpc.is_zero_public`, which is also a coroutine, and we need the result to follow the correct branch of the `if` statement. The execution of `random_derangement` is suspended at the `await` keyword, and will be resumed once the result `mpc.is_zero_public(t)` is available.\n",
"\n",
"## Random permutations from random unit vectors\n",
"\n",
Expand Down Expand Up @@ -318,12 +318,12 @@
"text": [
"Random unit vectors:\n",
" 1 [1]\n",
" 2 [1, 0]\n",
" 3 [0, 1, 0]\n",
" 4 [0, 0, 1, 0]\n",
" 5 [0, 1, 0, 0, 0]\n",
" 6 [1, 0, 0, 0, 0, 0]\n",
" 7 [0, 0, 0, 0, 1, 0, 0]\n"
" 2 [0, 1]\n",
" 3 [1, 0, 0]\n",
" 4 [0, 1, 0, 0]\n",
" 5 [0, 0, 1, 0, 0]\n",
" 6 [0, 0, 1, 0, 0, 0]\n",
" 7 [0, 0, 0, 0, 0, 1, 0]\n"
]
}
],
Expand All @@ -348,11 +348,11 @@
"Random permutations:\n",
" 1 [0]\n",
" 2 [1, 0]\n",
" 3 [1, 2, 0]\n",
" 4 [3, 0, 2, 1]\n",
" 5 [2, 0, 1, 4, 3]\n",
" 6 [1, 0, 4, 3, 5, 2]\n",
" 7 [6, 0, 4, 3, 5, 1, 2]\n"
" 3 [1, 0, 2]\n",
" 4 [0, 2, 3, 1]\n",
" 5 [0, 1, 3, 2, 4]\n",
" 6 [2, 3, 1, 5, 0, 4]\n",
" 7 [0, 1, 3, 2, 4, 6, 5]\n"
]
}
],
Expand All @@ -377,10 +377,10 @@
"Random derangements:\n",
" 2 [1, 0]\n",
" 3 [2, 0, 1]\n",
" 4 [1, 0, 3, 2]\n",
" 5 [3, 4, 1, 2, 0]\n",
" 6 [3, 4, 1, 5, 2, 0]\n",
" 7 [1, 5, 3, 6, 0, 2, 4]\n"
" 4 [2, 0, 3, 1]\n",
" 5 [1, 4, 3, 2, 0]\n",
" 6 [3, 0, 5, 2, 1, 4]\n",
" 7 [1, 4, 0, 5, 6, 3, 2]\n"
]
}
],
Expand All @@ -402,7 +402,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2023-04-15 13:03:02,230 Stop MPyC -- elapsed time: 0:00:00.148|bytes sent: 0\n"
"2024-04-29 16:51:30,068 Stop MPyC -- elapsed time: 0:00:00.168|bytes sent: 0\n"
]
}
],
Expand All @@ -428,7 +428,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\Berry\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3513: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
"C:\\Users\\Berry\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3377: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
" warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
]
}
Expand Down Expand Up @@ -462,32 +462,32 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2023-04-15 13:03:23,698 Start MPyC runtime v0.9.2\n",
"2024-04-29 16:51:36,774 Start MPyC runtime v0.10.1\n",
"Example: (5+13)*(5-13) = -144\n",
"Random unit vectors:\n",
" 1 [1]\n",
" 2 [0, 1]\n",
" 3 [0, 0, 1]\n",
" 3 [0, 1, 0]\n",
" 4 [0, 0, 1, 0]\n",
" 5 [0, 1, 0, 0, 0]\n",
" 6 [1, 0, 0, 0, 0, 0]\n",
" 7 [0, 0, 0, 0, 1, 0, 0]\n",
" 5 [0, 0, 0, 1, 0]\n",
" 6 [0, 0, 1, 0, 0, 0]\n",
" 7 [0, 0, 0, 1, 0, 0, 0]\n",
"Random permutations:\n",
" 1 [0]\n",
" 2 [1, 0]\n",
" 3 [0, 2, 1]\n",
" 4 [1, 3, 2, 0]\n",
" 5 [4, 1, 3, 2, 0]\n",
" 6 [5, 0, 3, 4, 2, 1]\n",
" 7 [3, 0, 5, 1, 4, 2, 6]\n",
" 3 [2, 1, 0]\n",
" 4 [3, 2, 1, 0]\n",
" 5 [0, 2, 3, 4, 1]\n",
" 6 [2, 4, 3, 0, 1, 5]\n",
" 7 [1, 4, 3, 5, 6, 2, 0]\n",
"Random derangements:\n",
" 2 [1, 0]\n",
" 3 [2, 0, 1]\n",
" 4 [3, 2, 1, 0]\n",
" 5 [3, 4, 0, 1, 2]\n",
" 6 [3, 0, 4, 5, 2, 1]\n",
" 7 [4, 5, 6, 2, 1, 0, 3]\n",
"2023-04-15 13:03:23,737 Stop MPyC -- elapsed time: 0:00:00.039|bytes sent: 0\n"
" 3 [1, 2, 0]\n",
" 4 [2, 3, 1, 0]\n",
" 5 [4, 0, 3, 1, 2]\n",
" 6 [1, 3, 0, 2, 5, 4]\n",
" 7 [3, 4, 6, 2, 1, 0, 5]\n",
"2024-04-29 16:51:36,821 Stop MPyC -- elapsed time: 0:00:00.046|bytes sent: 0\n"
]
}
],
Expand Down Expand Up @@ -515,8 +515,8 @@
" [-T t] [-B b] [--ssl] [-W w] [-L l] [-K k]\n",
" [--log-level ll] [--no-log] [--no-async]\n",
" [--no-barrier] [--no-gmpy2] [--no-numpy]\n",
" [--no-prss] [--mix32-64bit] [--output-windows]\n",
" [--output-file] [-f F]\n",
" [--no-uvloop] [--no-prss] [--mix32-64bit]\n",
" [--output-windows] [--output-file] [-f F]\n",
"\n",
"MPyC help:\n",
" -V, --VERSION print MPyC version number and exit\n",
Expand All @@ -542,6 +542,7 @@
" --no-barrier disable barriers\n",
" --no-gmpy2 disable use of gmpy2 package\n",
" --no-numpy disable use of numpy package\n",
" --no-uvloop disable use of uvloop (winloop) package\n",
" --no-prss disable use of PRSS (pseudorandom secret sharing)\n",
" --mix32-64bit enable mix of 32-bit and 64-bit platforms\n",
"\n",
Expand Down Expand Up @@ -574,33 +575,33 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2023-04-15 13:03:24,451 Start MPyC runtime v0.9.2\n",
"2023-04-15 13:03:25,077 All 3 parties connected via SSL.\n",
"2024-04-29 16:51:43,244 Start MPyC runtime v0.10.1\n",
"2024-04-29 16:51:43,913 All 3 parties connected via SSL.\n",
"Example: (5+13)*(5-13) = -144\n",
"Random unit vectors:\n",
" 1 [1]\n",
" 2 [1, 0]\n",
" 3 [0, 1, 0]\n",
" 4 [1, 0, 0, 0]\n",
" 5 [0, 1, 0, 0, 0]\n",
" 6 [0, 0, 1, 0, 0, 0]\n",
" 7 [0, 0, 0, 0, 0, 0, 1]\n",
" 2 [0, 1]\n",
" 3 [1, 0, 0]\n",
" 4 [0, 1, 0, 0]\n",
" 5 [0, 0, 1, 0, 0]\n",
" 6 [0, 0, 0, 0, 0, 1]\n",
" 7 [0, 0, 0, 0, 1, 0, 0]\n",
"Random permutations:\n",
" 1 [0]\n",
" 2 [1, 0]\n",
" 3 [0, 2, 1]\n",
" 4 [1, 2, 0, 3]\n",
" 5 [1, 4, 2, 0, 3]\n",
" 6 [3, 0, 4, 5, 2, 1]\n",
" 7 [1, 5, 6, 0, 4, 2, 3]\n",
" 3 [0, 1, 2]\n",
" 4 [3, 1, 0, 2]\n",
" 5 [4, 0, 1, 2, 3]\n",
" 6 [3, 1, 5, 4, 0, 2]\n",
" 7 [2, 5, 3, 4, 1, 0, 6]\n",
"Random derangements:\n",
" 2 [1, 0]\n",
" 3 [1, 2, 0]\n",
" 4 [3, 2, 1, 0]\n",
" 5 [4, 3, 1, 2, 0]\n",
" 6 [2, 0, 1, 4, 5, 3]\n",
" 7 [1, 4, 3, 0, 5, 6, 2]\n",
"2023-04-15 13:03:25,304 Stop MPyC -- elapsed time: 0:00:00.227|bytes sent: 24834\n"
" 3 [2, 0, 1]\n",
" 4 [1, 0, 3, 2]\n",
" 5 [4, 2, 3, 0, 1]\n",
" 6 [4, 5, 0, 1, 2, 3]\n",
" 7 [4, 3, 1, 5, 2, 6, 0]\n",
"2024-04-29 16:51:44,290 Stop MPyC -- elapsed time: 0:00:00.377|bytes sent: 35544\n"
]
}
],
Expand All @@ -626,33 +627,33 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2023-04-15 13:03:25,714 Start MPyC runtime v0.9.2\n",
"2023-04-15 13:03:26,243 All 8 parties connected.\n",
"2024-04-29 16:51:49,998 Start MPyC runtime v0.10.1\n",
"2024-04-29 16:51:50,569 All 8 parties connected.\n",
"Example: (5+13)*(5-13) = -144\n",
"Random unit vectors:\n",
" 1 [1]\n",
" 2 [0, 1]\n",
" 3 [0, 1, 0]\n",
" 4 [1, 0, 0, 0]\n",
" 5 [0, 0, 1, 0, 0]\n",
" 6 [0, 0, 0, 0, 0, 1]\n",
" 7 [1, 0, 0, 0, 0, 0, 0]\n",
" 3 [1, 0, 0]\n",
" 4 [0, 1, 0, 0]\n",
" 5 [1, 0, 0, 0, 0]\n",
" 6 [0, 0, 0, 0, 1, 0]\n",
" 7 [0, 0, 1, 0, 0, 0, 0]\n",
"Random permutations:\n",
" 1 [0]\n",
" 2 [1, 0]\n",
" 3 [1, 0, 2]\n",
" 4 [2, 1, 0, 3]\n",
" 5 [3, 4, 1, 0, 2]\n",
" 6 [5, 4, 3, 2, 1, 0]\n",
" 7 [4, 5, 1, 3, 6, 2, 0]\n",
" 2 [0, 1]\n",
" 3 [0, 2, 1]\n",
" 4 [1, 2, 0, 3]\n",
" 5 [4, 2, 0, 3, 1]\n",
" 6 [1, 0, 2, 5, 3, 4]\n",
" 7 [3, 1, 2, 0, 6, 5, 4]\n",
"Random derangements:\n",
" 2 [1, 0]\n",
" 3 [2, 0, 1]\n",
" 4 [2, 3, 1, 0]\n",
" 5 [2, 4, 3, 1, 0]\n",
" 6 [5, 4, 3, 2, 1, 0]\n",
" 7 [5, 2, 4, 0, 6, 3, 1]\n",
"2023-04-15 13:03:26,829 Stop MPyC -- elapsed time: 0:00:00.586|bytes sent: 73192\n"
" 3 [1, 2, 0]\n",
" 4 [1, 0, 3, 2]\n",
" 5 [1, 3, 4, 0, 2]\n",
" 6 [3, 2, 0, 1, 5, 4]\n",
" 7 [5, 2, 3, 6, 1, 0, 4]\n",
"2024-04-29 16:51:51,080 Stop MPyC -- elapsed time: 0:00:00.511|bytes sent: 99488\n"
]
}
],
Expand Down Expand Up @@ -684,7 +685,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion demos/SecretSantaExplained.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def random_derangement(n): # returns list of n secint ele
#
# 4. `mpc.returnType(rettype)` to define the return type of an MPyC coroutine.
#
# We have defined function `random_derangement` as a coroutine because from its body we call function `mpc.is_zero_public`, which is also a coroutine, and we need its the result to follow the correct branch of the `if` statement. The execution of `random_derangement` is suspended at the `await` keyword, and will be resumed once the result `mpc.is_zero_public(t)` is available.
# We have defined function `random_derangement` as a coroutine because from its body we call function `mpc.is_zero_public`, which is also a coroutine, and we need the result to follow the correct branch of the `if` statement. The execution of `random_derangement` is suspended at the `await` keyword, and will be resumed once the result `mpc.is_zero_public(t)` is available.
#
# ## Random permutations from random unit vectors
#
Expand Down

0 comments on commit 8f8d923

Please sign in to comment.