From 5d2915354479c4e54af66b50007c095e648814bc Mon Sep 17 00:00:00 2001 From: Alok Saldanha Date: Sat, 9 Mar 2024 18:14:39 -0500 Subject: [PATCH] #87 remove version pins for markupsafe, flask and werkzeug also remove dependency on flask-api --- .github/workflows/pr-checks.yaml | 1 - Changelog.md | 5 ++++ Dockerfile | 6 ++--- README.md | 31 ++++++++++++++++++++++++- cellxgene_gateway/backend_cache.py | 6 ++--- cellxgene_gateway/dir_util.py | 2 -- cellxgene_gateway/subprocess_backend.py | 6 ++--- environment.yml | 7 +++--- requirements.txt | 5 ++-- 9 files changed, 49 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 17d6cd0..147a4ce 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -39,7 +39,6 @@ jobs: conda env create -f environment.yml eval "$(conda shell.bash hook)" conda activate cellxgene-gateway - pip install markupsafe==2.0.1 # temporary workaround for jinja2-2.11.3 calling soft_unicode in markupsafe python setup.py install - name: Run tests diff --git a/Changelog.md b/Changelog.md index cd46049..b659b65 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +# UNRELEASED + +* Removed dependency on flask-api enabling update of werkzeug +* Updated dependencies (python 3.11, numpy 1.26, unpinned flask, werkzeug) + # 0.3.12 * #81 List gene set annotations when cell annotations not present diff --git a/Dockerfile b/Dockerfile index c2e61d4..3ded330 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM python:3.9 +FROM python:3.11 -RUN pip install --upgrade pip \ - && pip install cellxgene-gateway 'MarkupSafe<2.1' +RUN pip install --upgrade pip +RUN pip install "cellxgene-gateway>=0.4" ENV CELLXGENE_DATA=/cellxgene-data ENV CELLXGENE_LOCATION=/usr/local/bin/cellxgene diff --git a/README.md b/README.md index 13ba916..acb1528 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Additional environment variables can be provided with the `-e` parameter: ```bash docker run -it --rm \ --v :/cellxgene-data \ +-v ../cellxgene_data:/cellxgene-data \ -e GATEWAY_PORT=8080 \ -p 8080:8080 \ cellxgene-gateway @@ -191,6 +191,35 @@ black . If you need help for any reason, please make a github ticket. One of the contributors should help you out. +# Releasing New Versions + +## How to prepare for release + +- Update Changelog.md and version number in __init__.py +- Cut a release on github + - Go to your project homepage on GitHub + - On right side, you will see [Releases](https://github.com/Novartis/cellxgene-gateway/releases) link. Click on it. + - Click on Draft a new release + - Fill in all the details + - Tag version should be the version number of your package release + - Release Title can be anything you want, but we use v0.3.11 (the same as the tag to be created on publish) + - Description should be changelog + - Click Publish release at the bottom of the page + - Now under Releases you can view all of your releases. + - Copy the download link (tar.gz) and save it somewhere + +## How to publish to PyPI + +Make sure your `.pypirc` is set up for testpypi and pypi index servers. + + +```bash +rm -rf dist +python setup.py sdist bdist_wheel +python -m twine upload --repository testpypi dist/* +python -m twine upload dist/* +``` + # Contributors * Niket Patel - https://github.com/NiketPatel9 diff --git a/cellxgene_gateway/backend_cache.py b/cellxgene_gateway/backend_cache.py index b334cf1..644cb86 100644 --- a/cellxgene_gateway/backend_cache.py +++ b/cellxgene_gateway/backend_cache.py @@ -11,7 +11,7 @@ import time from threading import Thread from typing import List -from flask_api import status +from http import HTTPStatus from cellxgene_gateway import env from cellxgene_gateway.cache_entry import CacheEntry, CacheEntryStatus @@ -53,7 +53,7 @@ class BackendCache: return matches[0] else: raise CellxgeneException( - status.HTTP_500_INTERNAL_SERVER_ERROR, + HTTPStatus.INTERNAL_SERVER_ERROR, "Found " + str(len(matches)) + " for " + path, ) @@ -71,7 +71,7 @@ class BackendCache: return matches[0] else: raise CellxgeneException( - status.HTTP_500_INTERNAL_SERVER_ERROR, + HTTPStatus.INTERNAL_SERVER_ERROR, "Found " + str(len(matches)) + " for " + key.dataset, ) diff --git a/cellxgene_gateway/dir_util.py b/cellxgene_gateway/dir_util.py index 4358376..ab1aa2a 100644 --- a/cellxgene_gateway/dir_util.py +++ b/cellxgene_gateway/dir_util.py @@ -9,8 +9,6 @@ import os -from flask_api import status - from cellxgene_gateway import env from cellxgene_gateway.cellxgene_exception import CellxgeneException diff --git a/cellxgene_gateway/subprocess_backend.py b/cellxgene_gateway/subprocess_backend.py index e6c0e2c..24fd5d6 100644 --- a/cellxgene_gateway/subprocess_backend.py +++ b/cellxgene_gateway/subprocess_backend.py @@ -10,7 +10,7 @@ import logging import subprocess -from flask_api import status +from http import HTTPStatus from cellxgene_gateway.cache_entry import CacheEntryStatus from cellxgene_gateway.dir_util import make_annotations @@ -76,10 +76,10 @@ class SubprocessBackend: or "Could not open file" in stderr ): message = "File was invalid." - http_status = status.HTTP_400_BAD_REQUEST + http_status = HTTPStatus.BAD_REQUEST else: message = "Cellxgene failed to launch dataset." - http_status = status.HTTP_500_INTERNAL_SERVER_ERROR + http_status = HTTPStatus.INTERNAL_SERVER_ERROR cache_entry.status = CacheEntryStatus.error cache_entry.set_error(message, stderr, http_status) diff --git a/environment.yml b/environment.yml index ea69593..72bb446 100644 --- a/environment.yml +++ b/environment.yml @@ -2,9 +2,9 @@ name: cellxgene-gateway channels: - conda-forge dependencies: -- python=3.9 +- python=3.11 - requests -- flask==2.2.5 +- flask - psutil - black - twine @@ -13,6 +13,5 @@ dependencies: - pip - pip: - pre_commit - - flask-api - - werkzeug==2.3.8 + - werkzeug - cellxgene diff --git a/requirements.txt b/requirements.txt index b11f655..1791f75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ cellxgene -flask==2.2.5 -flask-api -werkzeug==2.3.8 +flask +werkzeug psutil requests