Skip to content

Releases: kalaspuff/tomodachi

0.22.0

25 Feb 07:24
b0bed97
Compare
Choose a tag to compare

Improvements to previous behaviour for middlewares

  • Handle exceptions lower in the stack for messaging services (AMQP and AWS SNS+SQS handlers), which now allows catching exceptions in middlewares, which was previously not possible. Note that existing middlewares calling underlying functions may differ in their behaviour unless logic catching raised exceptions with try-finally is applied. (github: @justcallmelarry)

Additional updates

  • Improved documentation for uses of tomodachi.get_service (github: @jmfederico)
  • Type hint annotation improvements.

0.21.8

19 Nov 13:25
77a1743
Compare
Choose a tag to compare
  • Adds the possibility to add a function called _stopping_service to the tomodachi Service class, which is run as soon as a termination signal is received by the service. (github: @justcallmelarry)
  • Fix for potential exceptions on botocore session client raising a RuntimeError, resulting in a tomodachi "Client has never been created in the first place" exception on reconnection to AWS APIs.
  • Added Python 3.10 to the CI test matrix run via GitHub Actions.
  • Additional updates for compatibility with typing libraries to improve support for installations on Python 3.10.
  • Supports aiohttp 3.8.x versions.
  • Supports tzlocal 3.x and 4.x releases.

0.21.7

24 Aug 11:55
0f42bad
Compare
Choose a tag to compare
  • Pins aiobotocore to use up to 1.3.x releases, since the 1.4.x versions session handling currently causes issues when used.

0.21.6

17 Aug 11:39
720763d
Compare
Choose a tag to compare
  • Now pins the tzlocal version to not use the 3.x releases as it would currently break services using scheduled functions (the @schedule decorator, et al) if tzlocal 3.0 was installed. (issue: #1504)
  • Updated classifiers to identify that the library works on Python 3.10.
  • Added the new Framework :: aiohttp classifier.

0.21.5

04 Aug 10:25
7e8ff45
Compare
Choose a tag to compare
  • If a PYTHONPATH environment value is set and a service is started without the --production flag, the paths specified in PYTHONPATH will be added to the list of directories to watch for code changes and in the event of any changes done to files on those directories, the service will restart. Previously only code changes in the directory or sub directory of the current working directory + the directory of the started service (or services) were monitored.
  • The topic argument to the @tomodachi.aws_sns_sqs decorator is now optional, which is useful if subscribing to a SQS queue where the SNS topic or the topic subscriptions are set up apart from the service code, for example during deployment or as infra.

0.21.4

26 Jul 12:15
02ad500
Compare
Choose a tag to compare
  • Encryption at rest for AWS SNS and/or AWS SQS which can optionally be configured by specifying the KMS key alias or KMS key id as a tomodachi service option options.aws_sns_sqs.sns_kms_master_key_id (to configure encryption at rest on the SNS topics for which the tomodachi service handles the SNS -> SQS subscriptions) and/or options.aws_sns_sqs.sqs_kms_master_key_id (to configure encryption at rest for the SQS queues which the service is consuming).

    Note that an option value set to empty string ("") or False will unset the KMS master key id and thus disable encryption at rest. (The AWS APIs for SNS and SQS uses empty string value to the KMSMasterKeyId attribute to disable encryption with KMS if it was previously enabled).

    If instead an option is completely unset or set to None value no changes will be done to the KMS related attributes on an existing topic or queue.

    If it's expected that the services themselves, via their IAM credentials or assumed role, are responsible for creating queues and topics, these options could be used to provide encryption at rest without additional manual intervention

    However, do not use these options if you instead are using IaC tooling to handle the topics, queues and subscriptions or that they for example are created / updated as a part of deployments. To not have the service update any attributes keep the options unset or set to a None value.

    AWS Documentation:

  • Fixes an issue where a GET request to an endpoint serving static files via @http_static could be crafted to probe the directory structure setup (but not read file content outside of its permitted path), by applying directory traversal techniques. This could expose the internal directory structure of the file system in the container or environment that the service is hosted on. Limited to if @http_static handlers were used within the service and those endpoints could be accessed.

  • Additional validation for the path used in the @http_static decorator to prevent a developer from accidentally supplying a "/" or "" value to the path argument, which in those cases could lead to unintended files being exposed via the static file handler.

0.21.3

29 Jun 23:36
2d26e78
Compare
Choose a tag to compare
  • Fixes an issue causing a UnboundLocalError if an incoming message to a service that had specified the enveloping implementation JsonBase where JSON encoded but actually wasn't originating from a source using a JsonBase compatible envelope.
  • Fixes error message strings for some cases of AWS SNS + SQS related cases of botocore.exceptions.ClientError.
  • Fixes the issue where some definitions of filter policies would result in an error when running mypy – uses Sequence instead of List in type hint definition for filter policy input types.
  • Internal updates for developer experience – refactoring and improvements for future code analysis and better support for IntelliSense.
  • Updates to install typeshed generated type hint annotation stubs and updates to support mypy==0.910.

0.21.2

16 Feb 16:45
bbb71ea
Compare
Choose a tag to compare
  • Bugfix for an issue which caused the sqs.DeleteMessage API call to be called three times for each processed SQS message (the request to delete a message from the queue is idempotent) when using AWS SNS+SQS via @tomodachi.aws_sns_sqs.
  • Now properly cleaning up clients created with tomodachi.helpers.aiobotocore_connector for aiobotocore, which previously could result in the error output "Unclosed client session" if the service would fail to start, for example due to initialization errors.

0.21.1

14 Feb 19:14
92fb9e8
Compare
Choose a tag to compare
  • Added sentry_sdk to the list of modules and packages to not be unloaded from sys.modules during hot reload of the running when code changes has been noticed. This to prevent errors like TypeError: run() takes 1 positional argument but X were given from sentry_sdk.integrations.threading when handling early errors or leftover errors from previous session.

0.21.0

10 Feb 18:56
47c4c66
Compare
Choose a tag to compare
  • Uses the socket option SO_REUSEPORT by default on Linux unless specifically disabled via the http.reuse_port option set to False. This will allow several processes to bind to the same port, which could be useful when running services via a process manager such as supervisord or when it's desired to run several processes of a service to utilize additional CPU cores. The http.reuse_port option doesn't have any effect when a service is running on a non-Linux platform. (github: @tranvietanh1991)
  • Services which works as AMQP consumers now has a default prefetch count value of 100, where previously the service didn't specify any prefetch count option, which could exhaust the host's resources if messages would be published faster to the queue than the services could process them. (github: @tranvietanh1991)
  • AWS SNS+SQS calls now uses a slightly changed config which will increase the connection pool to 50 connections, decreases the connect timeout to 8 seconds and the read timeout to 35 seconds.
  • Possible to run services using without using the tomodachi CLI, by adding tomodachi.run() to the end of the Python file invoked by python which will start services within that file. Usually in a if __name__ == "__main__": if-block.
  • The environment variable TOMODACHI_LOOP can be used to specify the event loop implementation in a similar way as the CLI argument --loop [auto|asyncio|uvloop] would.
  • Environment variable TOMODACHI_PRODUCTION set to 1 can be used to run the service without the file watcher for automatic code reloads enabled, which then yields higher performance. Equivalent as starting the service with the --production argument.
  • Smaller performance improvements throughout the framework.
  • Improved error handling overall in regards to non-standard exceptions and additional output, if scheduled tasks are unable to run due to other start methods not completing their initial setup.