Skip to content

Commit

Permalink
Merge pull request #73 from derekpierre/74-update
Browse files Browse the repository at this point in the history
`nucypher` 7.4.x dependency update
  • Loading branch information
derekpierre committed Jul 31, 2024
2 parents 0d35e03 + 3b5e126 commit 07f7da5
Show file tree
Hide file tree
Showing 16 changed files with 2,126 additions and 1,897 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/darker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.12'
- uses: akaihola/[email protected]
with:
version: "1.7.2" # defaults to same version, but can be modified
4 changes: 2 additions & 2 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: "3.12"

- name: Install dependencies
run: |
Expand All @@ -22,4 +22,4 @@ jobs:
pip install .
- name: Lint with Ruff
run: ruff --output-format=github porter
run: ruff check --output-format=github porter
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.11"]
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Upload test coverage to Codecov
if: matrix.python-version == '3.9'
uses: codecov/codecov-action@v4.3.0
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
Expand Down
4 changes: 2 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ name = "pypi"
python_version = "3"

[packages]
nucypher = {git = "https://github.com/nucypher/nucypher.git", ref = "v7.3.0"}
nucypher = {git = "https://github.com/nucypher/nucypher.git", ref = "v7.4.x"}
nucypher-core = "==0.13.0" # must be the same as nucypher
flask-cors = "*"
prometheus-flask-exporter = "*"

[dev-packages]
nucypher = {git = "https://github.com/nucypher/nucypher.git", editable = true, ref = "v7.3.0", extras = ["dev"]} # needed for testerchain, and must be editable
nucypher = {git = "https://github.com/nucypher/nucypher.git", editable = true, ref = "v7.4.x", extras = ["dev"]} # needed for testerchain, and must be editable
pytest = "<7" # match with nucypher/nucypher
pytest-cov = "*"
pytest-mock = "*"
Expand Down
3,506 changes: 1,861 additions & 1,645 deletions Pipfile.lock

Large diffs are not rendered by default.

19 changes: 13 additions & 6 deletions deploy/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FROM nucypher/rust-python:3.8.12
FROM nucypher/rust-python:3.12.0

# Update
RUN apt-get update -y && apt upgrade -y
RUN apt-get install patch gcc libffi-dev wget git -y
# set default user
USER $USER

# set default in-container workdir
WORKDIR /code
COPY . /code

# Porter requirements
RUN pip3 install .
# Layer 1: Install dependencies
COPY requirements.txt /code
RUN pip3 install --no-cache-dir -r requirements.txt

# Layer 2: Install porter entrypoint
COPY . /code
RUN pip3 install . --no-deps

# Layer 3: Set environment variables
RUN export PATH="$HOME/.local/bin:$PATH"
CMD ["/bin/bash"]
2 changes: 0 additions & 2 deletions deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
porter-http:
restart: on-failure
Expand Down
255 changes: 125 additions & 130 deletions dev-requirements.txt

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions porter/fields/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, expected_type=None, *args, **kwargs):
super().__init__(*args, **kwargs)

def _serialize(self, value, attr, obj, **kwargs):
if self.expected_type and (type(value) != self.expected_type):
if self.expected_type and (type(value) is not self.expected_type):
raise InvalidInputData(
f"Unexpected object type, {type(value)}; expected {self.expected_type}")

Expand All @@ -103,7 +103,7 @@ def _deserialize(self, value, attr, data, **kwargs):
except Exception as e:
raise InvalidInputData(f"Invalid JSON: {e}")
else:
if self.expected_type and (type(result) != self.expected_type):
if self.expected_type and (type(result) is not self.expected_type):
raise InvalidInputData(
f"Unexpected object type, {type(result)}; expected {self.expected_type}")

Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
showcontent = true

[tool.ruff]
select = ["E", "F", "I"]
ignore = ["E501"]
lint.select = ["E", "F", "I"]
lint.ignore = ["E501"]

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["porter"]
186 changes: 95 additions & 91 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,96 +1,100 @@
-i https://pypi.python.org/simple
aiohttp==3.9.4rc0; python_version >= '3.8' and python_version < '4'
aiosignal==1.3.1; python_version >= '3.8' and python_version < '4'
appdirs==1.4.4; python_version >= '3.8' and python_version < '4'
async-timeout==4.0.3; python_version < '3.11' and python_version >= '3.8'
attrs==23.2.0; python_version >= '3.8' and python_version < '4'
atxm==0.3.0; python_version >= '3.8' and python_version < '4'
autobahn==23.1.2; python_version >= '3.8' and python_version < '4'
automat==22.10.0; python_version >= '3.8' and python_version < '4'
bitarray==2.9.2; python_version >= '3.8' and python_version < '4'
blinker==1.7.0; python_version >= '3.8' and python_version < '4'
bytestring-splitter==2.4.1; python_version >= '3.8' and python_version < '4'
certifi==2024.2.2; python_version >= '3.8' and python_version < '4'
cffi==1.16.0; python_version >= '3.8' and python_version < '4'
charset-normalizer==3.3.2; python_version >= '3.8' and python_version < '4'
click==8.1.7; python_version >= '3.8' and python_version < '4'
colorama==0.4.6; python_version >= '3.8' and python_version < '4'
constant-sorrow==0.1.0a9; python_version >= '3.8' and python_version < '4'
constantly==23.10.4; python_version >= '3.8' and python_version < '4'
cryptography==42.0.5; python_version >= '3.8' and python_version < '4'
cytoolz==0.12.3; python_version >= '3.8' and python_version < '4' and implementation_name == 'cpython'
dateparser==1.2.0; python_version >= '3.8' and python_version < '4'
eth-abi==4.2.1; python_version >= '3.8' and python_version < '4'
eth-account==0.10.0; python_version >= '3.8' and python_version < '4'
eth-hash[pycryptodome]==0.7.0; python_version >= '3.8' and python_version < '4'
eth-keyfile==0.8.0; python_version >= '3.8' and python_version < '4'
eth-keys==0.4.0; python_version >= '3.8' and python_version < '4'
eth-rlp==1.0.1; python_version >= '3.8' and python_version < '4'
eth-typing==3.5.2; python_version >= '3.8' and python_version < '4'
eth-utils==2.3.1; python_version >= '3.8' and python_version < '4'
abnf==2.2.0; python_version >= '3.9' and python_version < '4.0'
aiohappyeyeballs==2.3.2; python_version >= '3.9' and python_version < '4.0'
aiohttp==3.10.0; python_version >= '3.9' and python_version < '4'
aiosignal==1.3.1; python_version >= '3.9' and python_version < '4'
annotated-types==0.7.0; python_version >= '3.9' and python_version < '4.0'
appdirs==1.4.4; python_version >= '3.9' and python_version < '4'
attrs==23.2.0; python_version >= '3.9' and python_version < '4'
atxm==0.5.0; python_version >= '3.9' and python_version < '4'
autobahn==23.6.2; python_version >= '3.9' and python_version < '4'
automat==22.10.0; python_version >= '3.9' and python_version < '4'
bitarray==2.9.2; python_version >= '3.9' and python_version < '4'
blinker==1.8.2; python_version >= '3.9' and python_version < '4'
bytestring-splitter==2.4.1; python_version >= '3.9' and python_version < '4'
certifi==2024.7.4; python_version >= '3.9' and python_version < '4'
cffi==1.16.0; python_version >= '3.9' and python_version < '4'
charset-normalizer==3.3.2; python_version >= '3.9' and python_version < '4'
ckzg==1.0.2; python_version >= '3.9' and python_version < '4'
click==8.1.7; python_version >= '3.9' and python_version < '4'
colorama==0.4.6; python_version >= '3.9' and python_version < '4'
constant-sorrow==0.1.0a9; python_version >= '3.9' and python_version < '4'
constantly==23.10.4; python_version >= '3.9' and python_version < '4'
cryptography==43.0.0; python_version >= '3.9' and python_version < '4'
cytoolz==0.12.3; python_version >= '3.9' and python_version < '4' and implementation_name == 'cpython'
dateparser==1.2.0; python_version >= '3.9' and python_version < '4'
eth-abi==5.1.0; python_version >= '3.9' and python_version < '4'
eth-account==0.11.2; python_version >= '3.9' and python_version < '4'
eth-hash[pycryptodome]==0.7.0; python_version >= '3.9' and python_version < '4'
eth-keyfile==0.8.1; python_version >= '3.9' and python_version < '4'
eth-keys==0.5.1; python_version >= '3.9' and python_version < '4'
eth-rlp==1.0.1; python_version >= '3.9' and python_version < '4'
eth-typing==3.5.2; python_version >= '3.9' and python_version < '4'
eth-utils==2.3.1; python_version >= '3.9' and python_version < '4'
flask==3.0.3; python_version >= '3.8'
flask-cors==4.0.1
frozenlist==1.4.1; python_version >= '3.8' and python_version < '4'
hendrix==5.0.0; python_version >= '3.8' and python_version < '4'
hexbytes==0.3.1; python_version >= '3.8' and python_version < '4'
humanize==4.9.0; python_version >= '3.8' and python_version < '4'
hyperlink==21.0.0; python_version >= '3.8' and python_version < '4'
idna==3.7; python_version >= '3.8' and python_version < '4'
importlib-metadata==7.1.0; python_version < '3.10' and python_version >= '3.8'
incremental==22.10.0; python_version >= '3.8' and python_version < '4'
itsdangerous==2.1.2; python_version >= '3.8' and python_version < '4'
jinja2==3.1.3; python_version >= '3.8' and python_version < '4'
jsonschema==4.21.1; python_version >= '3.8' and python_version < '4'
jsonschema-specifications==2023.12.1; python_version >= '3.8' and python_version < '4'
lru-dict==1.2.0; python_version >= '3.8' and python_version < '4'
mako==1.3.3; python_version >= '3.8' and python_version < '4'
markupsafe==2.1.5; python_version >= '3.8' and python_version < '4'
marshmallow==3.21.1; python_version >= '3.8' and python_version < '4'
maya==0.6.1; python_version >= '3.8' and python_version < '4'
mnemonic==0.20; python_version >= '3.8' and python_version < '4'
msgpack-python==0.5.6; python_version >= '3.8' and python_version < '4'
multidict==6.0.5; python_version >= '3.8' and python_version < '4'
nucypher@ git+https://github.com/nucypher/nucypher.git@30f1fabf5afeee1bf65ecf2ed56d11a7c87e9ef5
frozenlist==1.4.1; python_version >= '3.9' and python_version < '4'
hendrix==5.0.0; python_version >= '3.9' and python_version < '4'
hexbytes==0.3.1; python_version >= '3.9' and python_version < '4'
humanize==4.10.0; python_version >= '3.9' and python_version < '4'
hyperlink==21.0.0; python_version >= '3.9' and python_version < '4'
idna==3.7; python_version >= '3.9' and python_version < '4'
incremental==24.7.2; python_version >= '3.9' and python_version < '4'
itsdangerous==2.2.0; python_version >= '3.9' and python_version < '4'
jinja2==3.1.4; python_version >= '3.9' and python_version < '4'
jsonschema==4.23.0; python_version >= '3.9' and python_version < '4'
jsonschema-specifications==2023.12.1; python_version >= '3.9' and python_version < '4'
lru-dict==1.2.0; python_version >= '3.9' and python_version < '4'
mako==1.3.5; python_version >= '3.9' and python_version < '4'
markupsafe==2.1.5; python_version >= '3.9' and python_version < '4'
marshmallow==3.21.3; python_version >= '3.9' and python_version < '4'
maya==0.6.1; python_version >= '3.9' and python_version < '4'
mnemonic==0.21; python_version >= '3.9' and python_version < '4'
msgpack-python==0.5.6; python_version >= '3.9' and python_version < '4'
multidict==6.0.5; python_version >= '3.9' and python_version < '4'
nucypher@ git+https://github.com/nucypher/nucypher.git@cbabcc042e61099d2dc7627c838ccf71a7d139aa
nucypher-core==0.13.0
packaging==23.2; python_version >= '3.8' and python_version < '4'
parsimonious==0.9.0; python_version >= '3.8' and python_version < '4'
pendulum==3.0.0; python_version >= '3.8' and python_version < '4'
packaging==23.2; python_version >= '3.9' and python_version < '4'
parsimonious==0.10.0; python_version >= '3.9' and python_version < '4'
pendulum==3.0.0; python_version >= '3.9' and python_version < '4'
prometheus-client==0.20.0; python_version >= '3.8'
prometheus-flask-exporter==0.23.0
protobuf==5.26.1; python_version >= '3.8' and python_version < '4'
pyasn1==0.6.0; python_version >= '3.8' and python_version < '4'
pyasn1-modules==0.4.0; python_version >= '3.8' and python_version < '4'
pychalk==2.0.1; python_version >= '3.8' and python_version < '4'
pycparser==2.22; python_version >= '3.8' and python_version < '4'
pycryptodome==3.20.0; python_version >= '3.8' and python_version < '4'
pynacl==1.5.0; python_version >= '3.8' and python_version < '4'
pyopenssl==24.1.0; python_version >= '3.8' and python_version < '4'
python-dateutil==2.9.0.post0; python_version >= '3.8' and python_version < '4'
python-statemachine==2.1.2; python_version < '3.13' and python_version >= '3.8'
pytz==2024.1; python_version >= '3.8' and python_version < '4'
pyunormalize==15.1.0; python_version >= '3.8' and python_version < '4'
referencing==0.34.0; python_version >= '3.8' and python_version < '4'
regex==2023.12.25; python_version >= '3.8' and python_version < '4'
requests==2.31.0; python_version >= '3.8' and python_version < '4'
rlp==3.0.0; python_version >= '3.8' and python_version < '4'
rpds-py==0.18.0; python_version >= '3.8' and python_version < '4'
service-identity==24.1.0; python_version >= '3.8' and python_version < '4'
setuptools==69.2.0; python_version >= '3.8' and python_version < '4'
six==1.16.0; python_version >= '3.8' and python_version < '4'
snaptime==0.2.4; python_version >= '3.8' and python_version < '4'
tabulate==0.9.0; python_version >= '3.8' and python_version < '4'
time-machine==2.14.1; python_version >= '3.8' and python_version < '4'
toolz==0.12.1; python_version >= '3.8' and python_version < '4'
twisted==24.3.0; python_version >= '3.8' and python_version < '4'
txaio==23.1.1; python_version >= '3.8' and python_version < '4'
typing-extensions==4.11.0; python_version >= '3.8' and python_version < '4'
tzdata==2024.1; python_version >= '3.8' and python_version < '4'
tzlocal==5.2; python_version >= '3.8' and python_version < '4'
urllib3==2.2.0; python_version >= '3.8' and python_version < '4'
watchdog==3.0.0; python_version >= '3.8' and python_version < '4'
web3==6.15.1; python_version >= '3.8' and python_version < '4'
websockets==12.0; python_version >= '3.8' and python_version < '4'
werkzeug==3.0.2; python_version >= '3.8' and python_version < '4'
yarl==1.9.4; python_version >= '3.8' and python_version < '4'
zipp==3.18.1; python_version < '3.10' and python_version >= '3.8'
zope-interface==6.2; python_version >= '3.8' and python_version < '4'
prometheus-flask-exporter==0.23.1
protobuf==5.27.2; python_version >= '3.9' and python_version < '4'
pyasn1==0.6.0; python_version >= '3.9' and python_version < '4'
pyasn1-modules==0.4.0; python_version >= '3.9' and python_version < '4'
pychalk==2.0.1; python_version >= '3.9' and python_version < '4'
pycparser==2.22; python_version >= '3.9' and python_version < '4'
pycryptodome==3.20.0; python_version >= '3.9' and python_version < '4'
pydantic==2.8.2; python_version >= '3.9' and python_version < '4.0'
pydantic-core==2.20.1; python_version >= '3.9' and python_version < '4.0'
pynacl==1.5.0; python_version >= '3.9' and python_version < '4'
pyopenssl==24.2.1; python_version >= '3.9' and python_version < '4'
python-dateutil==2.9.0.post0; python_version >= '3.9' and python_version < '4'
python-statemachine==2.3.4; python_version >= '3.9' and python_version < '4'
pytz==2024.1; python_version >= '3.9' and python_version < '4'
pyunormalize==15.1.0; python_version >= '3.9' and python_version < '4'
referencing==0.35.1; python_version >= '3.9' and python_version < '4'
regex==2024.7.24; python_version >= '3.9' and python_version < '4'
requests==2.32.3; python_version >= '3.9' and python_version < '4'
rlp==4.0.1; python_version >= '3.9' and python_version < '4'
rpds-py==0.19.1; python_version >= '3.9' and python_version < '4'
service-identity==24.1.0; python_version >= '3.9' and python_version < '4'
setuptools==72.1.0; python_version >= '3.9' and python_version < '4'
siwe==4.2.0; python_version >= '3.9' and python_version < '4.0'
six==1.16.0; python_version >= '3.9' and python_version < '4'
snaptime==0.2.4; python_version >= '3.9' and python_version < '4'
tabulate==0.9.0; python_version >= '3.9' and python_version < '4'
time-machine==2.14.2; python_version >= '3.9' and python_version < '4'
toolz==0.12.1; python_version >= '3.9' and python_version < '4' and implementation_name == 'pypy' or implementation_name == 'cpython'
twisted==24.3.0; python_version >= '3.9' and python_version < '4'
txaio==23.1.1; python_version >= '3.9' and python_version < '4'
typing-extensions==4.12.2; python_version >= '3.9' and python_version < '4'
tzdata==2024.1; python_version >= '3.9' and python_version < '4'
tzlocal==5.2; python_version >= '3.9' and python_version < '4'
urllib3==2.2.2; python_version >= '3.9' and python_version < '4'
watchdog==3.0.0; python_version >= '3.9' and python_version < '4'
web3==6.20.1; python_version >= '3.9' and python_version < '4'
websockets==12.0; python_version >= '3.9' and python_version < '4'
werkzeug==3.0.3; python_version >= '3.9' and python_version < '4'
yarl==1.9.4; python_version >= '3.9' and python_version < '4'
zope-interface==6.4.post2; python_version >= '3.9' and python_version < '4'
4 changes: 2 additions & 2 deletions scripts/relock_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ pip cache purge
set -e

echo "Building Development Requirements"
pipenv --python 3.9 lock --clear --pre --dev-only
pipenv --python 3.12 lock --clear --pre --dev-only
pipenv requirements --dev-only > dev-$PREFIX.txt

echo "Building Standard Requirements"
pipenv --python 3.9 lock --clear --pre
pipenv --python 3.12 lock --clear --pre
pipenv requirements > $PREFIX.txt

echo "OK!"
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# -*- coding: utf-8 -*-

import os
import sys
from pathlib import Path
from typing import Dict
from urllib.parse import urlparse

import sys
from setuptools import find_packages, setup
from setuptools.command.develop import develop
from setuptools.command.install import install
Expand All @@ -28,6 +28,7 @@
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
]

Expand Down
7 changes: 5 additions & 2 deletions tests/pre/test_porter_pre_python_interface.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from nucypher.policy.conditions.context import USER_ADDRESS_CONTEXT

from porter.utils import retrieval_request_setup


Expand All @@ -11,11 +13,12 @@ def test_retrieve_cfrags(porter, bob, alice, enacted_policy):


def test_retrieve_cfrags_with_context(
porter, bob, alice, enacted_policy, valid_user_address_context
porter, bob, alice, enacted_policy, valid_eip4361_auth_message
):
# Setup
context = {USER_ADDRESS_CONTEXT: valid_eip4361_auth_message}
retrieval_args, _ = retrieval_request_setup(
enacted_policy, bob, alice, context=valid_user_address_context
enacted_policy, bob, alice, context=context
)

result = porter.retrieve_cfrags(**retrieval_args)
Expand Down
6 changes: 4 additions & 2 deletions tests/pre/test_porter_pre_web_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from nucypher.characters.lawful import Enrico
from nucypher.crypto.powers import DecryptingPower
from nucypher.policy.conditions.context import USER_ADDRESS_CONTEXT
from nucypher.policy.kits import PolicyMessageKit, RetrievalResult
from nucypher_core import RetrievalKit

Expand All @@ -19,7 +20,7 @@ def test_retrieve_cfrags(
bob,
alice,
random_treasure_map_data,
valid_user_address_context,
valid_eip4361_auth_message,
):
# Send bad data to assert error return
response = porter_web_controller.post(
Expand Down Expand Up @@ -132,8 +133,9 @@ def test_retrieve_cfrags(
# Use context
#
context_field = JSON()
context = {USER_ADDRESS_CONTEXT: valid_eip4361_auth_message}
multiple_retrieval_kits_params["context"] = context_field._serialize(
valid_user_address_context, attr=None, obj=None
context, attr=None, obj=None
)
response = porter_web_controller.post(
"/retrieve_cfrags", data=json.dumps(multiple_retrieval_kits_params)
Expand Down
Loading

0 comments on commit 07f7da5

Please sign in to comment.