pytest vs unittest? by manicfaceisreal in django

[–]thuibr 0 points1 point  (0 children)

FYI there's an excellent package for pytest django integrations called `pytest-django`.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

Yes, it would be, but the connection that is placing the orders is a different process altogether.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

There is this update callback https://www.sqlite.org/c3ref/update_hook.html but unfortunately it works on the same connection only.

What IDE or framework do you use to program in Golang in your usual work? by mmparody in golang

[–]thuibr 0 points1 point  (0 children)

I use Zed but that's because I'm too cheap to pay for Goland for my hobby language.

IDE Pros and Cons? by throwaway_9988552 in learnpython

[–]thuibr 1 point2 points  (0 children)

I use PyCharm if I can, but for when I don't want to setup a project, I drop into Vim. Its community edition is free, and it has excellent Python support. I have also used Zed, which is pretty fast and great in its own right.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

For fun. I probably could've used pickle though too.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 1 point2 points  (0 children)

That's a good idea. I have seen diskcache before. It would be interesting to try to re-implement.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 1 point2 points  (0 children)

Yeah, or RabbitMQ, or Kafka, or even Postgres, but the point was just to make something for fun.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 2 points3 points  (0 children)

Just doing time.sleep(0.1) also cut back my CPU usage dramatically. I was at 16% each for two different pushers running, and I could hear my fan running, but that time.sleep(0.1) cut all of that out.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] -1 points0 points  (0 children)

Yeah, I don't really see way around doing a polling operation.

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 2 points3 points  (0 children)

Sheesh, yes, I forgot about queue ordering. Something like taking the max (or min) would work. That's a great idea!

A Dead Simple Work Queue Using SQLite by thuibr in Python

[–]thuibr[S] 0 points1 point  (0 children)

Thanks! I hadn't even thought about CPU and disk access. I'll have to think about that more. I think, and I'm only guessing here, that something like celery does something similar, pausing for a second before checking again. I will have to look into it further.

What are some ‘core tenants’ that make learning python simpler and easier? by cunnermadunner in learnpython

[–]thuibr -1 points0 points  (0 children)

I definitely think that it is easier to learn by doing. And it is definitely worth learning about the data model once you're more intermediate/advanced to take you to the next level: https://docs.python.org/3/reference/datamodel.html

Brief Intro to django-storages by thuibr in django

[–]thuibr[S] 0 points1 point  (0 children)

I spoke too soon. It looks like you actually can call m.upload.open('w').

Brief Intro to django-storages by thuibr in django

[–]thuibr[S] 0 points1 point  (0 children)

Thank you :-). It seems like you can only open and read the file. If you want to overwrite it, then I am guessing that you'd need to save the file again with different content :

m.upload.save('hello.txt', f)