HNHacker News
TopNewBestAskShowJobs

supernihil

261 karma · joined February 21, 2017

meet.hn/city/55.0636926,10.6085377/Svendborg

Socials: - github.com/Sloev

---

submissionscomments
supernihil··on Show HN: Lambdarest – flask like web framework for AWS Lambda
previous mention: https://news.ycombinator.com/item?id=13698965

why mention again:

we have reached v 9.0.0 and so much has happened in the meantime (check history here: https://github.com/trustpilot/python-lambdarest/blob/master/...):

* 15 contributors over time and battle-tested in production since 2017

* python 3.6+ only

* flask like routing decorator

* supports aws Application Load Balancer and "normal" api gateway

* supports query_params, body_params and path_params

* (still) uses jsonschema for validation

* supports Lambda authorization scopes

* lambdarest strictly does routing/handling and doesn't interfer with deploying

* low amount of code lines: 1 file, 346 lines

* uses poetry for packaging

two tutorials have been published by users over the years:

* http://www.devgrok.com/2019/03/create-private-microservice-u...

* https://rockset.com/blog/building-a-serverless-microservice-...

We are very friendly and love cooperating, come join us! :-)

.

small example:

  from lambdarest import lambda_handler
  
  @lambda_handler.handle("get", path="/foo/<int:id>/")
  def my_own_get(event, id):
      return {"my-id": id}
supernihil··on Show HN: Guten Haiku – mine haiku from text with 80s CLI
it uses tensorflow through the lib "deepcorrect" to re-establish punctuation on the haiku. I did this for fun, i dont know if it makes sense (that applies to the project as a whole as well ;-) see: https://github.com/sloev/gutenhaiku/blob/master/gutenhaiku/p...
supernihil··on Show HN: Guten Haiku – mine haiku from text with 80s CLI
1. saturday morning to sunday morning (with some sleep)

2. yes very much, i am not much of a writer though so i try to use computers to mess around with it, i have previously used markov-chains to generate poems from the corpus of my friends poems which we collaborated with live: https://vimeo.com/72808984

3. i think the "A Journal of the Plague Year by Daniel Defoe" gives some horrifying results :-) (http://www.gutenberg.org/ebooks/376)

spacy not space: THX :-)

have a great day!

supernihil··on Show HN: Guten Haiku – mine haiku from text with 80s CLI
Author here:

Guten Haiku was created as I had a severe need to extract as many legit Haiku poems from the whole corpus for Gutenberg.

It didn’t mean a lot to me if it was the “fastest kid in town” but it sure needed to be pretty ;-)

The journey:

0. I write in python3

1. I went for space as nlp lib of choice (they are so niiiiiice peoples)

2. I needed to be able to extract syllables but space didn’t know how to do that

3. I therefore created another lib called https://github.com/sloev/spacy-syllables to annotate tokens with their syllable counts

4. I now had a syllable counting pipeline built with space

5. Now I needed to make an 80's aesthetics inspired cli app for my pipeline

6. I started with creating the whole colourful look with colorama and click

7. I created the default command for extracting haiku from text

8. I created another command for downloading fancy AI models ... uuuuh fancy!

9. Boring test implementation... yawn... zzz zz z

10. Even more boring packaging with poetry

11. Even even more boring time with travis, I don't love you right now travis

12. Release to the internets on GitHub and pypi

13. Battle with asciinema and asciicast2gif to get a pretty README up and going

14. Write hacker news about by personal triumph :-)

I wanna shout out to everybody and say that you all should make something silly and pretty today. I value those things highly and if you haven't visited https://theuselessweb.com/ yet, please do so cause TIM HOLMAN is a really nice guy with a great imagination.

Peace out and take care during the virus thingy!

supernihil··on Gevent botocore (async)
[author speaking]

Use gevent with botocore to call aws services in a nonblocking fashion.

by using gevent Pool and Pool.spawn() you can wrap execution of botocore in greenthreads.

.

a few important notes:

always monkey.patch_all as first thing in your app (really first, like Main first, top first, just first, first, first :-)

let each greenthread have its own connection, this worked for me. So create a function for calling aws services and inside this function; create your connection

use pool.join(timeout=n) to check if the queue is empty

use pool.full() to check if there is room in the pool for a new job

keep running greenthreads in a list to check their results later on

supernihil··on Lambdarest – python framework for AWS lambda
[From author]

Python pico framework for AWS Lambda with optional JSON-schema validation.

features:

* very little boilerplate, (functional, not classful)

* Handle multiple HTTP methods from same AWS lambda

* Standardized "AWS lambda proxy" output

* (optional) Validate input using JSON-schema

← PreviousPage 3 of 3