Skip to content

Migrate template to Python3 - #2

Merged
langens-jonathan merged 38 commits into
mu-semtech:masterfrom
MikiDi:master
Jul 8, 2021
Merged

Migrate template to Python3#2
langens-jonathan merged 38 commits into
mu-semtech:masterfrom
MikiDi:master

Conversation

@MikiDi

Copy link
Copy Markdown

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
Copy Markdown
Author

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
@MikiDiMikiDi changed the title [DRAFT] Migrate template to Python3Migrate template to Python3Jun 28, 2021
Comment threadhelpers.py Outdated

@langens-jonathanlangens-jonathan left a comment

Copy link
Copy Markdown
Member

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:masterJul 8, 2021
Sign up for freeto 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

@MikiDi@langens-jonathan