diff --git a/CHANGELOG.md b/CHANGELOG.md index c7e92345efdf7e3c3c94928324c8e31bbee6797a..5bc58e9a0a7ea35bcd1c0d896ecb1e68b0aa0c75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,38 +1,67 @@ -# Changelog +# Changelog # + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] ## + +### Added ### + +### Changed ### + +### Deprecated ### +### Fixed ### -## [Unreleased] +## [0.2.4] ### Added -- An `auth_token` parameter for `caosdb.configure_connection(...)`. This parameter accepts a plain text auth token (which can only be issued by the CaosDB Server). Under the hood, auth tokens are stored plain, instead of urlencoded now. + +- An `auth_token` parameter for `caosdb.configure_connection(...)`. This + parameter accepts a plain text auth token (which can only be issued by the + CaosDB Server). Under the hood, auth tokens are stored plain, instead of + urlencoded now. - New type of exception: `ConfigurationException` for misconfigurations. - Some unit tests, mainly for the `caosdb.connection.authentication` module -* Advanced setup.py for easy versioning and publication as pypi repository. +- Advanced setup.py for easy versioning and publication as pypi repository. +- `caosdb.apiutils` has new functions `id_query` and + `retrieve_entities_with_ids` +- New exception: `EntityDoesNotExistError` +- `RELEASE_GUIDELINES.md` with release instructions. +- More documentation and tests. ### Changed -- [pytest](https://docs.pytest.org/en/latest/) is the new preferred unit test frame work. -- If a password is specified in the configuration even though the password_method is not set to `plain`, a warning is logged. -- Under the hood, the password of from a `pass` or `keyring` call is not stored anymore. Instead the password is requested each time a login is necessary. -- Always load system default CA repository into the ssl context +- [pytest](https://docs.pytest.org/en/latest/) is the new preferred unit test + frame work. +- If a password is specified in the configuration even though the + password_method is not set to `plain`, a warning is logged. +- Under the hood, the password of from a `pass` or `keyring` call is not stored + anymore. Instead the password is requested each time a login is necessary. +- Always load system default CA repository into the ssl context. +- Datatypes are now in `caosdb.common.datatype` (though still available in the + main `caosdb` namespace). +- Logging to stdout is now more configurable. ### Deprecated -- Unit test frame work: [Nose](https://nose.readthedocs.io/en/latest/) should not be used anymore. Please use [pytest](https://docs.pytest.org/en/latest/) instead. + +- Unit test frame work: [Nose](https://nose.readthedocs.io/en/latest/) should + not be used anymore. Please use [pytest](https://docs.pytest.org/en/latest/) + instead. ### Fixed + - #1 - Problems with pass as a credentials provider - #3 - Python client does login before the first request to circumvent problems with anonymous role. +- Many other fixes +## [0.1.0] - 2018-10-09 ## -## [0.1.0] - 2018-10-09 Tag `v0.1` - Commit 6fc0dcaa diff --git a/README.md b/README.md index 242081ba042969b4728ec330ac8d2f4d93626bc9..ef26a604905d5140ae9a775065002af35ffe2121 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ project](https://gitlab.com/caosdb/caosdb) for more information. Copyright (C) 2018 Research Group Biomedical Physics, Max Planck Institute for Dynamics and Self-Organization Göttingen. +Copyright (C) 2020 Indiscale GmbH <info@indiscale.com> All files in this repository are licensed under a [GNU Affero General Public License](LICENCE.md) (version 3 or later). diff --git a/RELEASE_GUIDELINES.md b/RELEASE_GUIDELINES.md index 2f53e48f0541a30c6812a96cfe7613267ada5065..44dda026601ed21cbb03e5ee1cda10adf0f5bae7 100644 --- a/RELEASE_GUIDELINES.md +++ b/RELEASE_GUIDELINES.md @@ -18,7 +18,9 @@ guidelines of the CaosDB Project 2. Check all general prerequisites. -3. Prepare the [setup.py](./setup.py): Update the `MAJOR`, `MINOR`, `MICRO`, `PRE` variables and set `ISRELEASED` to `True`. Use the possibility to issue pre-release versions for testing. +3. Prepare [setup.py](./setup.py): Update the `MAJOR`, `MINOR`, `MICRO`, `PRE` + variables and set `ISRELEASED` to `True`. Use the possibility to issue + pre-release versions for testing. 4. Merge the release branch into the master branch. @@ -26,7 +28,9 @@ guidelines of the CaosDB Project 6. Delete the release branch. -7. Publish the release by executing `./release.sh` with uploads the caosdb +7. Remove possibly existing `./dist` directory with old release. + +8. Publish the release by executing `./release.sh` with uploads the caosdb module to the Python Package Index [pypi.org](https://pypi.org). -8. Merge the master branch back into the dev branch. +9. Merge the master branch back into the dev branch. diff --git a/release.sh b/release.sh old mode 100644 new mode 100755 diff --git a/setup.py b/setup.py index 7ab1f2c62de98ad2a62572bffe96ac73913ebf88..939dbe0e9280b5b37926901a215cea46af0371bd 100755 --- a/setup.py +++ b/setup.py @@ -47,10 +47,14 @@ from setuptools import find_packages, setup MAJOR = 0 MINOR = 2 -MICRO = 4 -PRE = "rc0" -ISRELEASED = True -VERSION = "{}.{}.{}{}".format(MAJOR, MINOR, MICRO, PRE) +MICRO = 5 +PRE = "" +ISRELEASED = False + +if PRE: + VERSION = "{}.{}.{}-{}".format(MAJOR, MINOR, MICRO, PRE) +else: + VERSION = "{}.{}.{}".format(MAJOR, MINOR, MICRO) # Return the git revision as a string diff --git a/src/caosdb/common/datatype.py b/src/caosdb/common/datatype.py index 23b01a8a5db36e39d00e78f26c7de08a8bfb5f42..246485c3957462fc98ac83f9d904413ad7518302 100644 --- a/src/caosdb/common/datatype.py +++ b/src/caosdb/common/datatype.py @@ -3,7 +3,9 @@ # ** header v3.0 # This file is a part of the CaosDB Project. # +# Copyright (C) 2020 IndiScale GmbH # Copyright (C) 2020 Henrik tom Wörden, IndiScale GmbH +# Copyright (C) 2020 Daniel Hornung (d.hornung@indiscale.com) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -65,7 +67,6 @@ def is_reference(datatype): """ if datatype in [DOUBLE, BOOLEAN, INTEGER, TEXT, DATETIME]: - return False elif is_list_datatype(datatype): return is_reference(get_list_datatype(datatype)) diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index 32343680f1ffc8a3b2eb53302c10e67101cc93f6..7eb9b9a76c8a60f6a341ea9524d00d4c84b5d2b8 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -45,7 +45,8 @@ from caosdb.configuration import get_config from caosdb.connection.connection import get_connection from caosdb.connection.encode import MultipartParam, multipart_encode from caosdb.exceptions import (AmbiguityException, AuthorizationException, - CaosDBException, ConsistencyError, + CaosDBException, ConnectionException, + ConsistencyError, EntityDoesNotExistError, EntityError, EntityHasNoDatatypeError, TransactionError, UniqueNamesError, UnqualifiedParentsError, @@ -3472,7 +3473,12 @@ class Info(): def sync(self): c = get_connection() - http_response = c.retrieve(["Info"]) + try: + http_response = c.retrieve(["Info"]) + except ConnectionException as conn_e: + print(conn_e) + return + xml = etree.fromstring(http_response.read()) for e in xml: diff --git a/src/caosdb/connection/connection.py b/src/caosdb/connection/connection.py index 6ee83d34c7779c6fa5d6ccb35d5758c0e91af13d..3553c86ca844ca0d83852985caa67158fdbda36b 100644 --- a/src/caosdb/connection/connection.py +++ b/src/caosdb/connection/connection.py @@ -32,13 +32,13 @@ from builtins import str # pylint: disable=redefined-builtin from errno import EPIPE as BrokenPipe from socket import error as SocketError -from caosdb.version import version from caosdb.configuration import get_config from caosdb.exceptions import (AuthorizationException, CaosDBException, ClientErrorException, ConfigurationException, ConnectionException, EntityDoesNotExistError, LoginFailedException, ServerErrorException, URITooLongException) +from caosdb.version import version from pkg_resources import resource_filename from .interface import CaosDBHTTPResponse, CaosDBServerConnection @@ -178,10 +178,10 @@ class _DefaultCaosDBServerConnection(CaosDBServerConnection): context.verify_mode = ssl.CERT_REQUIRED if config.get("ssl_insecure"): - print("*** Warning! ***\n" - "Insecure SSL mode, certificate will not be checked! " - "Please consider removing the `ssl_insecure` configuration option.\n" - "****************", file=sys.stderr) + _LOGGER.warn("*** Warning! ***\n" + "Insecure SSL mode, certificate will not be checked! " + "Please consider removing the `ssl_insecure` configuration option.\n" + "****************") context.verify_mode = ssl.CERT_NONE if (not context.verify_mode == ssl.CERT_NONE and @@ -347,13 +347,16 @@ def configure_connection(**kwargs): # Convert config to dict, with preserving types int_opts = ["timeout"] bool_opts = ["ssl_insecure"] + if conf.has_section("Connection"): global_conf = dict(conf.items("Connection")) # Integer options + for opt in int_opts: if opt in global_conf: global_conf[opt] = conf.getint("Connection", opt) # Boolean options + for opt in bool_opts: if opt in global_conf: global_conf[opt] = conf.getboolean("Connection", opt) diff --git a/unittests/test_datatype.py b/unittests/test_datatype.py index 5a543100c8617374e0f075abf3adbdb2f8044129..84f3ac7fd77e0f3fda464c5377b682ae67bd54e4 100644 --- a/unittests/test_datatype.py +++ b/unittests/test_datatype.py @@ -1,5 +1,33 @@ -from caosdb import LIST +# ** header v3.0 +# This file is a part of the CaosDB Project. +# +# Copyright (c) 2020 IndiScale GmbH +# Copyright (c) 2020 Daniel Hornung (d.hornung@indiscale.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +# ** end header + +import caosdb as db +from caosdb.common import datatype def test_list(): - assert LIST("RT") == "LIST<RT>" + assert db.LIST("RT") == "LIST<RT>" + + +def test_list_utilites(): + """Test for example if get_list_datatype works.""" + dtype = db.LIST(db.INTEGER) + assert datatype.get_list_datatype(dtype) == db.INTEGER