Skip to content

Conversation

@MikiDi
Copy link

@MikiDi MikiDi commented Jan 25, 2021

This PR aims to migrate the Python template to Python3 + adds various major improvements. Currently marked as draft, allowing for discussion prior to formal review.

Bugfixes

  • Escaping strings with triple quotes SPARQL queries
  • Removed circular dependency of the "graph" property between web.py and helpers.py
  • Make SPARQL_TIMEOUT work as intended
  • Make session_id_header and rewrite_url_header work with the right headers

features

  • Migrated to Python3 (2.7 EOL since last year)
  • Refactored SPARQL escape helper functions
  • Refactored "template-consuming service" import logic
  • Proper WSGI server for production use
  • Reworked and extended documentation
  • support for mu-authorization headers

Discussion

  • Is a production WSGI-server actually needed? ("We count on other layers of the stack for security. There is little need for concurrent request handling.")
  • Linting: This PR includes a .pylintrc configured for developing microservices based on this template. See README for rationale & See discussion here

@MikiDi
Copy link
Author

MikiDi commented Jun 28, 2021

Preliminary conclusions of above mentioned discussion-points:

  • Is a production WSGI-server actually needed? ("We count on other layers of the stack for security. There is little need for concurrent request handling.")

Yes, a production server is needed. By default however, we configure the amount of workers by 1, which makes the default setup behave in a similar way as the (current) dev server does. The template consumer can configure the amount of spawned workers to their own liking.

  • Linting: This PR includes a .pylintrc configured for developing microservices based on this template. See README for rationale & See discussion here

Providing linting config for a local setup encourages a way of development that goes against the mu.semte.ch-idea that development should happen in a dockerized environment. Despite the fact that the provided linting configuration lowers the bar for novice (mu.semte.ch-) developers, we will not include the linting config in this PR, but rather discuss it separately.

@MikiDi MikiDi marked this pull request as ready for review June 28, 2021 13:20
@MikiDi MikiDi changed the title [DRAFT] Migrate template to Python3 Migrate template to Python3 Jun 28, 2021
@erikap erikap requested a review from langens-jonathan June 29, 2021 05:51
@MikiDi MikiDi requested a review from langens-jonathan July 6, 2021 12:58
Copy link
Member

@langens-jonathan langens-jonathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Michael, Thank you!!

@langens-jonathan langens-jonathan merged commit 90b62e6 into mu-semtech:master Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants