From fe4581fac7f6c7cd1f8505b0aca3a72d775bfdc7 Mon Sep 17 00:00:00 2001 From: Tom Hendrikx Date: Tue, 8 Nov 2022 12:54:49 +0100 Subject: [PATCH 1/4] Update README, refer to older versions. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8388c273..85205d25 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ To use the Mollie API client, the following things are required: + Mollie API client for Python has a dependency on [Requests](http://docs.python-requests.org/en/master/) and [Requests-OAuthlib](https://requests-oauthlib.readthedocs.io/en/latest/) ## Installation ## -**Please note:** If you are looking to install the v1 version of the Mollie API client, please refer to the [v1-develop branch](https://github.com/mollie/mollie-api-python/tree/v1-develop) for installation instructions. +**Please note:** If you want to install an older version of the Mollie API client (current major version is `v3`), then please refer to their respective github branches for installation instructions: +- version 2.x.x is available from the [v2-develop branch](https://github.com/mollie/mollie-api-python/tree/v2-develop). +- version 1.x.x is available from the [v1-develop branch](https://github.com/mollie/mollie-api-python/tree/v1-develop). By far the easiest way to install the Mollie API client is to install it with [pip](https://pip.pypa.io). The command below will install the latest released version of the client. ```shell From 49d055d42b2c25a6c52571546d6aabc3e718db49 Mon Sep 17 00:00:00 2001 From: Tom Hendrikx Date: Tue, 8 Nov 2022 13:13:21 +0100 Subject: [PATCH 2/4] Update the version --- mollie/api/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mollie/api/version.py b/mollie/api/version.py index 6a9f6cc2..e7d5775e 100644 --- a/mollie/api/version.py +++ b/mollie/api/version.py @@ -4,4 +4,4 @@ # processed by python imports and by regular expressions. The version is defined as a string in the # regular semantic versioning scheme (major,minor,patch). -VERSION = "2.13.0" +VERSION = "3.0.0rc1" From 147193251d9c657c91d0585ef1bd56ae3184dcae Mon Sep 17 00:00:00 2001 From: Tom Hendrikx Date: Tue, 8 Nov 2022 13:18:29 +0100 Subject: [PATCH 3/4] Correctly escape the literal dot in 'OAuth/2.0' --- tests/test_api_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_api_client.py b/tests/test_api_client.py index 7b64e49f..ab2b8533 100644 --- a/tests/test_api_client.py +++ b/tests/test_api_client.py @@ -279,7 +279,7 @@ def test_client_default_user_agent(client, response): def test_oauth_client_default_user_agent(oauth_client, response): """Default user-agent should contain some known values.""" - regex = re.compile(r"^Mollie/[\d\.]+ Python/[\w\.\+]+ OpenSSL/[\w\.]+ OAuth/2.0$") + regex = re.compile(r"^Mollie/[\d\.]+ Python/[\w\.\+]+ OpenSSL/[\w\.]+ OAuth/2\.0$") assert re.match(regex, oauth_client.user_agent) # perform a request and inpect the actual used headers From 6974113858bc70ad4118c7f87a128b5e9dcd1026 Mon Sep 17 00:00:00 2001 From: Tom Hendrikx Date: Tue, 8 Nov 2022 13:55:20 +0100 Subject: [PATCH 4/4] Correct tests that verify the client version to allow release candidates and such. --- mollie/api/version.py | 2 +- tests/test_api_client.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mollie/api/version.py b/mollie/api/version.py index e7d5775e..ca139ecd 100644 --- a/mollie/api/version.py +++ b/mollie/api/version.py @@ -2,6 +2,6 @@ # Don't change the syntax of the definition unless you know what you're doing, because this file is # processed by python imports and by regular expressions. The version is defined as a string in the -# regular semantic versioning scheme (major,minor,patch). +# regular semantic versioning scheme (major, minor, patch) as defined by PEP 440. VERSION = "3.0.0rc1" diff --git a/tests/test_api_client.py b/tests/test_api_client.py index ab2b8533..8049da53 100644 --- a/tests/test_api_client.py +++ b/tests/test_api_client.py @@ -265,9 +265,17 @@ def test_client_will_propagate_retry_setting(response): assert adapter.max_retries.connect == 3 +def test_client_version_is_pep440_compatible(client): + # PEP 440 specifies how python package versioning needs to look: https://peps.python.org/pep-0440 + # Below is the regular expression from PEP 440, Appendix B, for canonical versions. + regex = r"^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$" # noqa: E501 + assert re.match(regex, client.CLIENT_VERSION), "Client version does not match PEP 440 specification" + + def test_client_default_user_agent(client, response): """Default user-agent should contain some known values.""" - regex = re.compile(r"^Mollie/[\d\.]+ Python/[\w\.\+]+ OpenSSL/[\w\.]+$") + version = re.escape(client.CLIENT_VERSION) + regex = re.compile(rf"^Mollie/{version} Python/[\w\.\+]+ OpenSSL/[\w\.]+$") assert re.match(regex, client.user_agent) # perform a request and inpect the actual used headers @@ -279,7 +287,8 @@ def test_client_default_user_agent(client, response): def test_oauth_client_default_user_agent(oauth_client, response): """Default user-agent should contain some known values.""" - regex = re.compile(r"^Mollie/[\d\.]+ Python/[\w\.\+]+ OpenSSL/[\w\.]+ OAuth/2\.0$") + version = re.escape(oauth_client.CLIENT_VERSION) + regex = re.compile(rf"^Mollie/{version} Python/[\w\.\+]+ OpenSSL/[\w\.]+ OAuth/2\.0$") assert re.match(regex, oauth_client.user_agent) # perform a request and inpect the actual used headers