diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1dc09269a92c486e9d80a8ae5ceb0e51dc50bd17..51c4486b50ed0bd260a0b62aa01fbd3eca608769 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,16 +64,21 @@ unittest: # Trigger building of server image and integration tests trigger_build: - tags: [ docker ] stage: deploy - script: - - /usr/bin/curl -X POST - -F token=$CI_JOB_TOKEN - -F "variables[F_BRANCH]=$CI_COMMIT_REF_NAME" - -F "variables[PYLIB]=$CI_COMMIT_REF_NAME" - -F "variables[TriggerdBy]=PYLIB" - -F "variables[TriggerdByHash]=$CI_COMMIT_SHORT_SHA" - -F ref=$DEPLOY_REF https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline + inherit: + variables: + - DEPLOY_REF + variables: + # Renaming variables. + F_BRANCH: $CI_COMMIT_REF_NAME + PYLIB: $CI_COMMIT_REF_NAME + TriggeredBy: PYLIB + TriggeredByHash: $CI_COMMIT_SHORT_SHA + + trigger: + project: caosdb/src/caosdb-deploy + branch: $DEPLOY_REF + strategy: depend # Build a docker image in which tests for this repository can run build-testenv: diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4f2ab2863999774af6a751f378da00b81a83e7..5ad9b14d167c3e4fdb7752151c5f5559782d9842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,12 +15,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed ### +* Support for Python 3.6 and Python 3.7 + ### Fixed ### ### Security ### ### Documentation ### +## [0.7.4] - 2022-05-31 +(Florian Spreckelsen) + +### Fixed ### + +* [#64](https://gitlab.com/caosdb/caosdb-pylib/-/issues/64) Use `Dict[]` and + `List[]` from `typing` for type hinting instead of `dict[]` and `list[]` for + compatibility with Python<3.9. + ## [0.7.3] - 2022-05-03 (Henrik tom Wörden) @@ -36,27 +47,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added additional customization options to the plantuml module. - The to_graphics function in the plantuml module uses a temporary directory now for creating the output files. -### Deprecated ### - -### Removed ### - ### Fixed ### * [#75](https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/75), [#103](https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/103) Fixed JSON schema to allow more sections, and correct requirements for password method. -### Security ### - -### Documentation ### - - ## [0.7.2] - 2022-03-25 ## (Timm Fitschen) -### Added ### - -### Changed ### - ### Deprecated ### * In module `caosdb.apiutils`: @@ -64,8 +62,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `convert_to_entity` function * `convert_to_python_object` function -### Removed ### - ### Fixed ### * [caosdb-pylib#106](https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/issues/106) @@ -73,8 +69,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 unintentional revocation of permissions for some users or roles during updates. However, no additional permissions are being granted. -### Security ### - ### Documentation ### ## [0.7.1] - 2022-03-11 ## @@ -140,8 +134,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `yaml_file_to_xml` * `insert_yaml_file` -### Removed ### - ### Fixed ### * #60 Unintuitive behavior of `Entity.role` after a `Entity(id).retrieve()` @@ -166,10 +158,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Updated error-handling tutorial in documentation to reflect the new error classes -### Deprecated ### - -### Removed ### - ### Fixed ### * #45 - test_config_ini_via_envvar @@ -262,14 +250,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 assumed that `password_method` is `auth_token` if the the `auth_token` is set. -### Removed ### - ### Fixed ### - Replaced deprecated Logger.warn() method. -### Security ### - ## [0.3.0] - 2020-04-24## ### Added ### @@ -277,10 +261,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `apiutils.apply_to_ids` -- a helper which applies a function to all ids which are used by an entity (own entity, parents, properties, references etc.). -### Changed ### - -### Deprecated ### - ### Fixed ### * import bugs in apiutils diff --git a/DEPENDENCIES.md b/DEPENDENCIES.md index d6f91cb9e15982bd1b7b0366f94bd9b37286f85a..117e764e44e7fa2693919451b653647b370be63f 100644 --- a/DEPENDENCIES.md +++ b/DEPENDENCIES.md @@ -1,5 +1,5 @@ * caosdb-server >= 0.7.2 -* Python >= 3.6 +* Python >= 3.8 * pip >= 20.0.2 Any other dependencies are defined in the setup.py and are being installed via pip diff --git a/README_SETUP.md b/README_SETUP.md index dc667da8aa5877132c1212d2ddd2827e85992118..48928d6c3f2c878a8d8b268b36ed2cdeba7f8014 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -4,7 +4,7 @@ ### Requirements ### -PyCaosDB needs at least Python 3.6. Additionally, the following packages are required (they will +PyCaosDB needs at least Python 3.8. Additionally, the following packages are required (they will typically be installed automatically): - `lxml` @@ -19,7 +19,7 @@ Optional packages: #### Linux #### -Make sure that Python (at least version 3.6) and pip is installed, using your system tools and +Make sure that Python (at least version 3.8) and pip is installed, using your system tools and documentation. Then open a terminal and continue in the [Generic installation](#generic-installation) section. diff --git a/setup.py b/setup.py index fa3720f229d5b5326cd1757981a8777c6de4274a..70d87707b71e79ac7a819a15d9df4ae1d9327b2d 100755 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ from setuptools import find_packages, setup ISRELEASED = False MAJOR = 0 MINOR = 7 -MICRO = 4 +MICRO = 5 # Do not tag as pre-release until this commit # https://github.com/pypa/packaging/pull/515 # has made it into a release. Probably we should wait for pypa/packaging>=21.4 @@ -168,7 +168,7 @@ def setup_package(): "Topic :: Scientific/Engineering :: Information Analysis", ], packages=find_packages('src'), - python_requires='>=3.6', + python_requires='>=3.8', package_dir={'': 'src'}, install_requires=['lxml>=4.6.3', 'PyYAML>=6.0', 'future', 'PySocks>=1.6.7'], diff --git a/src/caosdb/apiutils.py b/src/caosdb/apiutils.py index a376068c372c1b6f460c7927467b8da8df328545..4c8393111bcbb4f9f91e309b81bebdcac55ba626 100644 --- a/src/caosdb/apiutils.py +++ b/src/caosdb/apiutils.py @@ -33,7 +33,7 @@ import warnings from collections.abc import Iterable from subprocess import call -from typing import Optional, Any +from typing import Optional, Any, Dict, List from caosdb.common.datatype import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER, REFERENCE, TEXT, is_reference) @@ -205,8 +205,8 @@ def compare_entities(old_entity: Entity, new_entity: Entity): In case of changed information the value listed under the respective key shows the value that is stored in the respective entity. """ - olddiff: dict[str, Any] = {"properties": {}, "parents": []} - newdiff: dict[str, Any] = {"properties": {}, "parents": []} + olddiff: Dict[str, Any] = {"properties": {}, "parents": []} + newdiff: Dict[str, Any] = {"properties": {}, "parents": []} if old_entity is new_entity: return (olddiff, newdiff) @@ -467,7 +467,7 @@ def resolve_reference(prop: Property): prop.value = retrieve_entity_with_id(prop.value) -def create_flat_list(ent_list: list[Entity], flat: list[Entity]): +def create_flat_list(ent_list: List[Entity], flat: List[Entity]): """ Recursively adds all properties contained in entities from ent_list to the output list flat. Each element will only be added once to the list. @@ -483,8 +483,10 @@ def create_flat_list(ent_list: list[Entity], flat: list[Entity]): if isinstance(el, Entity): if el not in flat: flat.append(el) - create_flat_list([el], flat) # TODO: move inside if block? + # TODO: move inside if block? + create_flat_list([el], flat) elif isinstance(p.value, Entity): if p.value not in flat: flat.append(p.value) - create_flat_list([p.value], flat) # TODO: move inside if block? + # TODO: move inside if block? + create_flat_list([p.value], flat) diff --git a/src/caosdb/connection/connection.py b/src/caosdb/connection/connection.py index 6c3946ee639872b0edb0b5b3c30a808cf8c028d4..43eb3410d8d5bdc8323a811fd2b6424fb75f3fda 100644 --- a/src/caosdb/connection/connection.py +++ b/src/caosdb/connection/connection.py @@ -176,16 +176,7 @@ class _DefaultCaosDBServerConnection(CaosDBServerConnection): if "ssl_version" in config and config["cacert"] is not None: ssl_version = getattr(ssl, config["ssl_version"]) else: - try: - ssl_version = ssl.PROTOCOL_TLS - except AttributeError: - # deprecated since Python 3.6, but necessary until there. - try: - ssl_version = ssl.PROTOCOL_TLSv1_2 - except AttributeError: - print("It seems as if your Python version does not support current encryption" - "standards (such as TLS > 1.0), please upgrade to at least Python 3.4.") - sys.exit(1) + ssl_version = ssl.PROTOCOL_TLS context = ssl.SSLContext(ssl_version) context.verify_mode = ssl.CERT_REQUIRED diff --git a/src/caosdb/high_level_api.py b/src/caosdb/high_level_api.py index 86b811e2545d97dd4ece3cb34d3e8f021d38fd59..87ff7c5fec6ac670b112e019fc04232f431745da 100644 --- a/src/caosdb/high_level_api.py +++ b/src/caosdb/high_level_api.py @@ -561,7 +561,7 @@ class CaosDBPythonEntity(object): return propval def resolve_references(self, deep: bool, references: db.Container, - visited: dict[Union[str, int], + visited: Dict[Union[str, int], "CaosDBPythonEntity"] = None): """ Resolve this entity's references. This affects unresolved properties as well @@ -692,7 +692,7 @@ class CaosDBPythonEntity(object): if self in visited: return visited[self] - metadata: dict[str, Any] = dict() + metadata: Dict[str, Any] = dict() properties = dict() parents = list() diff --git a/src/caosdb/utils/plantuml.py b/src/caosdb/utils/plantuml.py index 16bd81d9507b9ecd11870e18b1020d9f47b8f047..6252a48983c62e7a2f33113422205209d616b5b6 100644 --- a/src/caosdb/utils/plantuml.py +++ b/src/caosdb/utils/plantuml.py @@ -39,7 +39,7 @@ import shutil import caosdb as db from caosdb.common.datatype import is_reference, get_referenced_recordtype -from typing import Optional +from typing import List, Optional import tempfile @@ -341,9 +341,9 @@ def retrieve_substructure(start_record_types, depth, result_id_set=None, result_ return None -def to_graphics(recordtypes: list[db.Entity], filename: str, +def to_graphics(recordtypes: List[db.Entity], filename: str, output_dirname: Optional[str] = None, - formats: list[str] = ["tsvg"], + formats: List[str] = ["tsvg"], silent: bool = True, add_properties: bool = True, add_recordtypes: bool = True, @@ -367,7 +367,7 @@ def to_graphics(recordtypes: list[db.Entity], filename: str, the destination directory for the resulting images as defined by the "-o" option by plantuml default is to use current working dir - formats : list[str] + formats : List[str] list of target formats as defined by the -t"..." options by plantuml, e.g. "tsvg" silent : bool Don't output messages. diff --git a/src/doc/conf.py b/src/doc/conf.py index 9a0483597ea89680121576339f2d5b74f96797ee..8080c87b393c6684e92a98d14ac3d7a572a72cc4 100644 --- a/src/doc/conf.py +++ b/src/doc/conf.py @@ -29,10 +29,10 @@ copyright = '2022, IndiScale GmbH' author = 'Daniel Hornung' # The short X.Y version -version = '0.7.3' +version = '0.7.4' # The full version, including alpha/beta/rc tags # release = '0.5.2-rc2' -release = '0.7.3' +release = '0.7.4' # -- General configuration --------------------------------------------------- diff --git a/tox.ini b/tox.ini index 62658ae501234a276db8d570328bbe80f1348a4c..e321891883b9425d24543a41f2d1283e0be52109 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py36, py37, py38, py39, py310 +envlist=py38, py39, py310 skip_missing_interpreters = true [testenv]