Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package without editable flag #576

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b62b275
Reverted checking medperf updates via git branch as client would be i…
VukW Feb 27, 2024
bcf4292
Added __init__ to submodules
VukW Feb 27, 2024
04251f6
Moved local server cert / token to ~/,medperf_config/
VukW Feb 27, 2024
41f1c9c
Fix cert locations for ci
VukW Feb 27, 2024
a4490ff
ci debug
VukW Feb 27, 2024
a0279d1
debug ci
VukW Feb 27, 2024
09db124
Moved mock_tokens placement to seed.py
VukW Feb 29, 2024
8288915
Linter fix
VukW Feb 29, 2024
8508649
bugfix
VukW Feb 29, 2024
e4ea291
ci debug
VukW Feb 29, 2024
e2fbdc1
ci debug
VukW Feb 29, 2024
9dc2ead
ci debug
VukW Feb 29, 2024
c0d439b
ci debug
VukW Feb 29, 2024
e26e0fd
ci debug
VukW Feb 29, 2024
14b6877
ci fix
VukW Feb 29, 2024
7da4ecd
ci fix
VukW Feb 29, 2024
99717d7
ci fix
VukW Feb 29, 2024
90afd4e
ci fix
VukW Feb 29, 2024
9e4548a
Removed -e (editable) mode for cli installation
VukW Feb 29, 2024
b68f402
ci fix
VukW Feb 29, 2024
8374a98
Merge branch 'main' into pypi-package
VukW Feb 29, 2024
9197076
Merge remote-tracking branch 'origin/main' into pypi-package
VukW Mar 19, 2024
4df8033
Changed local dev cert folder to ~/.medperf_dev/
VukW Mar 19, 2024
0c2b202
Merge branch 'main' into pypi-package
VukW Apr 1, 2024
044224f
returned git-update-check back
VukW Apr 1, 2024
83e9e67
Merge branch 'main' into pypi-package
VukW Apr 10, 2024
dc136d1
long_description is required for pypi
VukW Apr 10, 2024
6a83fff
git-updates skipped if package not installed from repo with -e flag
VukW Apr 10, 2024
a2a8762
Linter fix
VukW Apr 10, 2024
872cc66
Merge remote-tracking branch 'origin/main' into package-without-edita…
VukW Apr 23, 2024
df81045
Merge remote-tracking branch 'origin/main' into package-without-edita…
VukW May 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/auth-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
working-directory: .
run: |
python -m pip install --upgrade pip
pip install -e cli/
pip install ./cli
pip install -r cli/test-requirements.txt
pip install -r server/requirements.txt
pip install -r server/test-requirements.txt
Expand All @@ -48,7 +48,7 @@ jobs:

- name: Run django server in background with generated certs
working-directory: ./server
run: sh setup-dev-server.sh & sleep 6
run: sh setup-dev-server.sh -c cert.crt -k cert.key & sleep 6

- name: Run server integration tests
working-directory: ./server
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/docker-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
working-directory: .
run: |
python -m pip install --upgrade pip
pip install -e cli/
pip install cli/
pip install -r cli/test-requirements.txt
pip install -r server/requirements.txt
pip install -r server/test-requirements.txt
Expand All @@ -57,6 +57,12 @@ jobs:
cp ../mock_tokens/tokens.json tokens.json
docker build -t ${{ env.IMAGE_NAME }} -f Dockerfile.gha .

- name: Copy configurations for MedPerf client
working-directory: ./server
run: |
cp tokens.json ~/.medperf_dev/tokens.json
cp cert.crt ~/.medperf_dev/cert.crt

- name: Run server in background
working-directory: ./server
run: PORT=8080 && docker run --name medperf_api -d -p 8000:${PORT} -e PORT=${PORT} -e SSL_FLAGS="--certfile=cert.crt --keyfile=cert.key" ${{ env.IMAGE_NAME }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/local-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
working-directory: .
run: |
python -m pip install --upgrade pip
pip install -e cli/
pip install cli/
pip install -r cli/test-requirements.txt
pip install -r server/requirements.txt
pip install -r server/test-requirements.txt
Expand All @@ -53,7 +53,7 @@ jobs:

- name: Run server integration tests
working-directory: ./server
run: python seed.py --cert cert.crt
run: python seed.py

- name: Run chestxray demo
working-directory: .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f cli/requirements.txt ]; then pip install -e cli; fi
if [ -f cli/requirements.txt ]; then pip install ./cli; fi
pip install -r server/requirements.txt
pip install -r server/test-requirements.txt
- name: Lint with flake8
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added cli/medperf/comms/__init__.py
Empty file.
9 changes: 4 additions & 5 deletions cli/medperf/config.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
from ._version import __version__
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent.parent

major_version, minor_version, patch_version = __version__.split(".")

# MedPerf server
server = "https://api.medperf.org"
certificate = None

local_server = "https://localhost:8000"
local_certificate = str(BASE_DIR / "server" / "cert.crt")

comms = "REST"

Expand Down Expand Up @@ -39,8 +36,6 @@
access_token_storage_id = "medperf_access_token"
refresh_token_storage_id = "medperf_refresh_token"

local_tokens_path = BASE_DIR / "mock_tokens" / "tokens.json"

# Storage config
config_storage = Path.home().resolve() / ".medperf_config"
logs_storage = Path.home().resolve() / ".medperf_logs"
Expand All @@ -49,6 +44,10 @@
creds_folder = str(config_storage / ".tokens")
tokens_db = str(config_storage / ".tokens_db")

local_server_config_storage = Path.home().resolve() / ".medperf_dev"
local_tokens_path = local_server_config_storage / "tokens.json"
local_certificate = str(local_server_config_storage / "cert.crt")

images_folder = ".images"
trash_folder = ".trash"
tmp_folder = ".tmp"
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added cli/medperf/ui/__init__.py
Empty file.
9 changes: 7 additions & 2 deletions cli/medperf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from typing import List
from colorama import Fore, Style
from pexpect.exceptions import TIMEOUT
from git import Repo, GitCommandError
from git import Repo, GitCommandError, InvalidGitRepositoryError
import medperf.config as config
from medperf.exceptions import ExecutionError, MedperfException

Expand Down Expand Up @@ -430,7 +430,12 @@ def filter_latest_associations(associations, entity_key):

def check_for_updates() -> None:
"""Check if the current branch is up-to-date with its remote counterpart using GitPython."""
repo = Repo(config.BASE_DIR)
repo_root_dir = Path(__file__).resolve().parent.parent.parent
try:
repo = Repo(repo_root_dir)
except InvalidGitRepositoryError: # package is installed not in -e mode from git repo
return

if repo.bare:
logging.debug("Repo is bare")
return
Expand Down
8 changes: 5 additions & 3 deletions cli/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup
from setuptools import setup, find_packages
from medperf._version import __version__

with open("requirements.txt", "r") as f:
Expand All @@ -15,10 +15,12 @@
name="medperf",
version=__version__,
description="CLI Tool for federated benchmarking on medical private data",
url="https://github.com/aristizabal95/medperf",
long_description=open('../README.md').read(),
long_description_content_type='text/markdown',
url="https://github.com/mlcommons/medperf",
author="MLCommons",
license="Apache 2.0",
packages=["medperf"],
packages=find_packages(where="."),
install_requires=requires,
python_requires=">=3.6",
entry_points="""
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If using Docker, make sure [you can run Docker as a non-root user.](https://docs
3. Install MedPerf from source:

```bash
pip install -e ./cli
pip install ./cli
```

4. Verify the installation:
Expand Down
2 changes: 1 addition & 1 deletion docs/mlcubes/shared/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MedPerf provides some cookiecutter templates for all the related MLCubes. Additi

2. Install the MedPerf CLI:
```bash
pip install -e cli
pip install ./cli
```

3. If you have not done so, create a folder for keeping all MLCubes created in this tutorial:
Expand Down
13 changes: 10 additions & 3 deletions server/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
from seed_utils import Server, set_user_as_admin, create_benchmark, create_model
from auth_provider_token import auth_provider_token
from pathlib import Path
import shutil
import json

DEV_CONFIG_DIR = Path.home() / ".medperf_dev"
REPO_BASE_DIR = Path(__file__).resolve().parent.parent


Expand Down Expand Up @@ -46,8 +48,9 @@ def seed(args):


if __name__ == "__main__":
default_cert_file = str(REPO_BASE_DIR / "server" / "cert.crt")
default_tokens_file = str(REPO_BASE_DIR / "mock_tokens" / "tokens.json")
default_cert_file = str(DEV_CONFIG_DIR / "cert.crt")
local_tokens_file = str(REPO_BASE_DIR / "mock_tokens" / "tokens.json")
dest_tokens_file = str(DEV_CONFIG_DIR / "tokens.json")

parser = argparse.ArgumentParser(description="Seed the db with demo entries")
parser.add_argument(
Expand Down Expand Up @@ -78,9 +81,13 @@ def seed(args):
"--tokens",
type=str,
help="Path to local tokens file",
default=default_tokens_file,
default=local_tokens_file,
)
args = parser.parse_args()
if args.cert.lower() == "none":
args.cert = None
DEV_CONFIG_DIR.mkdir(parents=True, exist_ok=True)
print('config folder:', DEV_CONFIG_DIR, DEV_CONFIG_DIR.exists())
shutil.copy(args.tokens, dest_tokens_file) # for usage by medperf client
print('token file:', dest_tokens_file, Path(dest_tokens_file).exists())
seed(args)
8 changes: 5 additions & 3 deletions server/setup-dev-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ do
esac
done

CONFIG_PATH=$HOME/.medperf_dev
DEPLOY="${DEPLOY:-1}"
CERT_GENERATE="${CERT_GENERATE:-1}"
CERT_FILE="${CERT_FILE:-cert.crt}"
KEY_FILE="${KEY_FILE:-cert.key}"
CERT_FILE="${CERT_FILE:-$CONFIG_PATH/cert.crt}"
KEY_FILE="${KEY_FILE:-$CONFIG_PATH/cert.key}"
RESET_DB="${RESET_DB:-0}"

echo $CERT_FILE
echo $KEY_FILE
echo $DEPLOY
echo $CERT_GENERATE
echo $CERT_PATH
echo $RESET_DB
echo $CONFIG_PATH

mkdir -p $CONFIG_PATH

if [ -z "$CERT_FILE" ]
then
Expand Down
Loading