workspace
stringclasses
1 value
channel
stringclasses
1 value
sentences
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
sentence_id
stringlengths
44
53
timestamp
float64
1.5B
1.56B
__index_level_0__
int64
0
106k
pythondev
help
My Alembic or more specifically SqlAlchemy-Migrate keeps trying to drop the spatial_ref_sys table required by PostGIS. Is there a way to make it ignore it?
2017-07-22T07:22:08.368755
Thomasina
pythondev_help_Thomasina_2017-07-22T07:22:08.368755
1,500,708,128.368755
86,803
pythondev
help
<@Thomasina> <http://dev.utek.pl/2013/ignoring-tables-in-alembic/>
2017-07-22T07:24:20.375844
Suellen
pythondev_help_Suellen_2017-07-22T07:24:20.375844
1,500,708,260.375844
86,804
pythondev
help
&gt; While working on spatial enabled application I came up to a problem with spatial table in my postgres database (spatial_ref_sys). Alembic insisted on deleting this table as it wasn't declared in my models.py.
2017-07-22T07:24:34.376602
Suellen
pythondev_help_Suellen_2017-07-22T07:24:34.376602
1,500,708,274.376602
86,805
pythondev
help
I think it's your situation described
2017-07-22T07:24:55.377749
Suellen
pythondev_help_Suellen_2017-07-22T07:24:55.377749
1,500,708,295.377749
86,806
pythondev
help
<@Suellen> Yep, exactly. :smile: Thanks!
2017-07-22T07:27:40.387065
Thomasina
pythondev_help_Thomasina_2017-07-22T07:27:40.387065
1,500,708,460.387065
86,807
pythondev
help
:slightly_smiling_face:
2017-07-22T07:27:46.387336
Suellen
pythondev_help_Suellen_2017-07-22T07:27:46.387336
1,500,708,466.387336
86,808
pythondev
help
One thing that confuses me a bit is that his `run_migrations_online` function is _completely_ different from mine. :thinking_face:
2017-07-22T07:29:52.394177
Thomasina
pythondev_help_Thomasina_2017-07-22T07:29:52.394177
1,500,708,592.394177
86,809
pythondev
help
It makes me wonder if this is built on an older version of the function and if replacing mine with this could lead to problems
2017-07-22T07:30:18.395843
Thomasina
pythondev_help_Thomasina_2017-07-22T07:30:18.395843
1,500,708,618.395843
86,810
pythondev
help
You can probably adapt it somehow
2017-07-22T07:31:32.400014
Suellen
pythondev_help_Suellen_2017-07-22T07:31:32.400014
1,500,708,692.400014
86,811
pythondev
help
BTW, Alemic docs states that migrations should not be committed without human inspection first, so a really simple solution is to manually remove the "drop table" bits
2017-07-22T07:32:30.403039
Suellen
pythondev_help_Suellen_2017-07-22T07:32:30.403039
1,500,708,750.403039
86,812
pythondev
help
Not really a beautiful solution, but still
2017-07-22T07:32:48.404100
Suellen
pythondev_help_Suellen_2017-07-22T07:32:48.404100
1,500,708,768.4041
86,813
pythondev
help
<@Suellen> Oddly removing the `drop`s manually fixes the error _but_ none of the model tables were created in the database... :facepalm:
2017-07-22T07:55:20.484421
Thomasina
pythondev_help_Thomasina_2017-07-22T07:55:20.484421
1,500,710,120.484421
86,814
pythondev
help
:open_mouth:
2017-07-22T07:58:11.494702
Suellen
pythondev_help_Suellen_2017-07-22T07:58:11.494702
1,500,710,291.494702
86,815
pythondev
help
So just dropped the alembic table, deleted the migrations folder and did the whole process over but still no tables? Not sure what I'm doing wrong.
2017-07-22T08:00:25.504078
Thomasina
pythondev_help_Thomasina_2017-07-22T08:00:25.504078
1,500,710,425.504078
86,816
pythondev
help
Then again the migration script has nothing in it for creating the relevant tables. :thinking_face:
2017-07-22T08:00:58.506515
Thomasina
pythondev_help_Thomasina_2017-07-22T08:00:58.506515
1,500,710,458.506515
86,817
pythondev
help
Only code for dropping the PostGIS table which I removed
2017-07-22T08:01:16.507782
Thomasina
pythondev_help_Thomasina_2017-07-22T08:01:16.507782
1,500,710,476.507782
86,818
pythondev
help
it means that it can't detect your models for whatever reason :confused:
2017-07-22T08:01:32.508852
Suellen
pythondev_help_Suellen_2017-07-22T08:01:32.508852
1,500,710,492.508852
86,819
pythondev
help
Oh! Yes, I just changed my models from subclassing `Model` to subclassing `Base` from `declarative_base`. Guess that's why.
2017-07-22T08:02:28.512688
Thomasina
pythondev_help_Thomasina_2017-07-22T08:02:28.512688
1,500,710,548.512688
86,820
pythondev
help
I'm not sure if that was a good idea but I couldn't help but notice that subclassing `Model` wasn't something done much outside of tutorials.
2017-07-22T08:03:41.517433
Thomasina
pythondev_help_Thomasina_2017-07-22T08:03:41.517433
1,500,710,621.517433
86,821
pythondev
help
:cry:
2017-07-22T08:05:52.525964
Suellen
pythondev_help_Suellen_2017-07-22T08:05:52.525964
1,500,710,752.525964
86,822
pythondev
help
:upside_down_face: :question:
2017-07-22T08:06:05.526810
Thomasina
pythondev_help_Thomasina_2017-07-22T08:06:05.526810
1,500,710,765.52681
86,823
pythondev
help
This is from a real-life product
2017-07-22T08:07:09.531216
Suellen
pythondev_help_Suellen_2017-07-22T08:07:09.531216
1,500,710,829.531216
86,824
pythondev
help
Isn't it necessary to derive from Model if you use flask-sqlalchemy, and Base if you just use bare sqlalchemy? There is a difference, as I found out
2017-07-22T08:07:50.533795
Gabriele
pythondev_help_Gabriele_2017-07-22T08:07:50.533795
1,500,710,870.533795
86,825
pythondev
help
Why with most SQLAlchemy extensions do they show a couple examples - usually ORM and core - and neither one of them look like this?
2017-07-22T08:08:07.534880
Thomasina
pythondev_help_Thomasina_2017-07-22T08:08:07.534880
1,500,710,887.53488
86,826
pythondev
help
<@Gabriele> Good to know. :sweat_smile:
2017-07-22T08:08:20.535747
Thomasina
pythondev_help_Thomasina_2017-07-22T08:08:20.535747
1,500,710,900.535747
86,827
pythondev
help
I may be but a novice Python dev, but someday I aspire to be a mediocre intermediate dev!
2017-07-22T08:09:02.538139
Thomasina
pythondev_help_Thomasina_2017-07-22T08:09:02.538139
1,500,710,942.538139
86,828
pythondev
help
You most definitely will be
2017-07-22T08:09:16.539063
Suellen
pythondev_help_Suellen_2017-07-22T08:09:16.539063
1,500,710,956.539063
86,829
pythondev
help
&gt; and neither one of them look like this? Eh, I asked myself the same question. Turns out, writing a tutorial based on real-world applications isn't fun for anyone
2017-07-22T08:10:10.542503
Suellen
pythondev_help_Suellen_2017-07-22T08:10:10.542503
1,500,711,010.542503
86,830
pythondev
help
Novices will 100% be confused
2017-07-22T08:10:23.543377
Suellen
pythondev_help_Suellen_2017-07-22T08:10:23.543377
1,500,711,023.543377
86,831
pythondev
help
it's way easier to show the first 2-3 steps with Core or ORM, and move on to the first steps in anything else :slightly_smiling_face:
2017-07-22T08:10:54.545166
Suellen
pythondev_help_Suellen_2017-07-22T08:10:54.545166
1,500,711,054.545166
86,832
pythondev
help
To be completely honest I found machine-learning less confusing :smile:
2017-07-22T08:11:28.547529
Thomasina
pythondev_help_Thomasina_2017-07-22T08:11:28.547529
1,500,711,088.547529
86,833
pythondev
help
I have a sort of love-hate relationship with it
2017-07-22T08:13:00.553646
Thomasina
pythondev_help_Thomasina_2017-07-22T08:13:00.553646
1,500,711,180.553646
86,834
pythondev
help
you must be good with maths
2017-07-22T08:13:34.555869
Suellen
pythondev_help_Suellen_2017-07-22T08:13:34.555869
1,500,711,214.555869
86,835
pythondev
help
Not that great, but I do enjoy learning math. Honestly read about calculus and all sorts of things for fun. I wasn't really crazy about math as a kid so I'm not sure why that changed.
2017-07-22T08:14:57.560999
Thomasina
pythondev_help_Thomasina_2017-07-22T08:14:57.560999
1,500,711,297.560999
86,836
pythondev
help
I was doing the Stanford ML course from Coursera but had to stop at one point once things became a bit too complex. I still intend to go back to it after studying more though.
2017-07-22T08:17:11.569711
Thomasina
pythondev_help_Thomasina_2017-07-22T08:17:11.569711
1,500,711,431.569711
86,837
pythondev
help
What is an pythonic way to specify class dependencies?
2017-07-22T09:52:59.967544
Fern
pythondev_help_Fern_2017-07-22T09:52:59.967544
1,500,717,179.967544
86,838
pythondev
help
``` class Foo: def __init__(self, dependency_a, dependency_b): ... ```
2017-07-22T09:54:10.973054
Collette
pythondev_help_Collette_2017-07-22T09:54:10.973054
1,500,717,250.973054
86,839
pythondev
help
How would I inject those dependencies? Are there any good DI package?'
2017-07-22T09:54:59.976871
Fern
pythondev_help_Fern_2017-07-22T09:54:59.976871
1,500,717,299.976871
86,840
pythondev
help
<@Collette>
2017-07-22T09:57:13.987109
Fern
pythondev_help_Fern_2017-07-22T09:57:13.987109
1,500,717,433.987109
86,841
pythondev
help
<@Fern> `foo = Foo(dependency_a, dependency_b)`
2017-07-22T09:57:37.988919
Collette
pythondev_help_Collette_2017-07-22T09:57:37.988919
1,500,717,457.988919
86,842
pythondev
help
You don't need DI framework in python, really
2017-07-22T09:57:49.989850
Collette
pythondev_help_Collette_2017-07-22T09:57:49.989850
1,500,717,469.98985
86,843
pythondev
help
I'm used to strictly typed languages
2017-07-22T09:57:53.990133
Fern
pythondev_help_Fern_2017-07-22T09:57:53.990133
1,500,717,473.990133
86,844
pythondev
help
haha
2017-07-22T09:57:54.990230
Fern
pythondev_help_Fern_2017-07-22T09:57:54.990230
1,500,717,474.99023
86,845
pythondev
help
So I just need to rely on duck typing?
2017-07-22T09:58:12.991657
Fern
pythondev_help_Fern_2017-07-22T09:58:12.991657
1,500,717,492.991657
86,846
pythondev
help
Yep, just pass arguments around
2017-07-22T09:58:33.993254
Collette
pythondev_help_Collette_2017-07-22T09:58:33.993254
1,500,717,513.993254
86,847
pythondev
help
``` class User(): name = '' email = '' def __init__(self, name, email, json): self.name = name self.email = email self.json = json def toJson(self): return self.json.dumps({ 'name': self.name, 'email': self.email, }) ```
2017-07-22T10:08:44.047037
Fern
pythondev_help_Fern_2017-07-22T10:08:44.047037
1,500,718,124.047037
86,848
pythondev
help
is this pythonic? <@Collette>
2017-07-22T10:08:59.048257
Fern
pythondev_help_Fern_2017-07-22T10:08:59.048257
1,500,718,139.048257
86,849
pythondev
help
`self.json = json` I think there is a better name for this parameter
2017-07-22T10:10:40.056970
Suellen
pythondev_help_Suellen_2017-07-22T10:10:40.056970
1,500,718,240.05697
86,850
pythondev
help
Or would you just use the `json` module without specifying it as a dep in the constructor?
2017-07-22T10:10:41.057002
Fern
pythondev_help_Fern_2017-07-22T10:10:41.057002
1,500,718,241.057002
86,851
pythondev
help
yes, this!
2017-07-22T10:10:53.058024
Suellen
pythondev_help_Suellen_2017-07-22T10:10:53.058024
1,500,718,253.058024
86,852
pythondev
help
why? just interested :slightly_smiling_face:
2017-07-22T10:11:13.059842
Fern
pythondev_help_Fern_2017-07-22T10:11:13.059842
1,500,718,273.059842
86,853
pythondev
help
because it is a built-in?
2017-07-22T10:12:27.065908
Fern
pythondev_help_Fern_2017-07-22T10:12:27.065908
1,500,718,347.065908
86,854
pythondev
help
`to_json` only makes sense with json, and json is always available
2017-07-22T10:12:39.066906
Suellen
pythondev_help_Suellen_2017-07-22T10:12:39.066906
1,500,718,359.066906
86,855
pythondev
help
``` import json class User(): name = '' email = '' def __init__(self, name, email): self.name = name self.email = email def to_json(self): return json.dumps({ 'name': self.name, 'email': self.email, }) ```
2017-07-22T10:17:09.088950
Fern
pythondev_help_Fern_2017-07-22T10:17:09.088950
1,500,718,629.08895
86,856
pythondev
help
like this?
2017-07-22T10:17:15.089386
Fern
pythondev_help_Fern_2017-07-22T10:17:15.089386
1,500,718,635.089386
86,857
pythondev
help
I think it's quite nice
2017-07-22T10:19:09.098789
Suellen
pythondev_help_Suellen_2017-07-22T10:19:09.098789
1,500,718,749.098789
86,858
pythondev
help
btw, you don't need ``` name = '' email = '' ``` in your class definition
2017-07-22T10:19:22.099960
Suellen
pythondev_help_Suellen_2017-07-22T10:19:22.099960
1,500,718,762.09996
86,859
pythondev
help
`self.name` sets an attribute for every new instance already
2017-07-22T10:19:39.101348
Suellen
pythondev_help_Suellen_2017-07-22T10:19:39.101348
1,500,718,779.101348
86,860
pythondev
help
I know but I think it it's more explicit
2017-07-22T10:20:23.104972
Fern
pythondev_help_Fern_2017-07-22T10:20:23.104972
1,500,718,823.104972
86,861
pythondev
help
What would I use if I would to serialize SQLAlchemy model result?
2017-07-22T10:21:36.111198
Fern
pythondev_help_Fern_2017-07-22T10:21:36.111198
1,500,718,896.111198
86,862
pythondev
help
would like to be able to encode the results as JSON or cast it to a dict
2017-07-22T10:22:24.115363
Fern
pythondev_help_Fern_2017-07-22T10:22:24.115363
1,500,718,944.115363
86,863
pythondev
help
Is `marshmallow` any good or is there anyway to it with pure python easily? Can I implement a special attribute like `__json__`?
2017-07-22T10:24:36.126546
Fern
pythondev_help_Fern_2017-07-22T10:24:36.126546
1,500,719,076.126546
86,864
pythondev
help
marshmallow is the tool to go
2017-07-22T10:26:12.134282
Suellen
pythondev_help_Suellen_2017-07-22T10:26:12.134282
1,500,719,172.134282
86,865
pythondev
help
what should I use for web dev?
2017-07-22T10:27:17.139815
Fern
pythondev_help_Fern_2017-07-22T10:27:17.139815
1,500,719,237.139815
86,866
pythondev
help
Flask? aiohttp?
2017-07-22T10:27:23.140297
Fern
pythondev_help_Fern_2017-07-22T10:27:23.140297
1,500,719,243.140297
86,867
pythondev
help
oh, it's up to you completely, there are too many options for one to be considered the only way :slightly_smiling_face:
2017-07-22T10:30:25.155406
Suellen
pythondev_help_Suellen_2017-07-22T10:30:25.155406
1,500,719,425.155406
86,868
pythondev
help
I'm searching for something that can handle async methods since I'm going to fetch data from external HTTP APIs
2017-07-22T10:30:28.155649
Fern
pythondev_help_Fern_2017-07-22T10:30:28.155649
1,500,719,428.155649
86,869
pythondev
help
Can I do async I/O in Flask? Woud like to use async/await since I'm already familiar to that concept
2017-07-22T10:31:27.161011
Fern
pythondev_help_Fern_2017-07-22T10:31:27.161011
1,500,719,487.161011
86,870
pythondev
help
I have no experience with async :confused: But Flask can play nicely with WebSockets for example
2017-07-22T10:32:11.164647
Suellen
pythondev_help_Suellen_2017-07-22T10:32:11.164647
1,500,719,531.164647
86,871
pythondev
help
Hmm
2017-07-22T10:33:01.169013
Fern
pythondev_help_Fern_2017-07-22T10:33:01.169013
1,500,719,581.169013
86,872
pythondev
help
"However Flask is just not designed for large applications or asynchronous servers. Flask wants to make it quick and easy to write a traditional web application."
2017-07-22T10:34:57.179240
Fern
pythondev_help_Fern_2017-07-22T10:34:57.179240
1,500,719,697.17924
86,873
pythondev
help
No you can't really do asyncio with flask.
2017-07-22T10:34:59.179416
Signe
pythondev_help_Signe_2017-07-22T10:34:59.179416
1,500,719,699.179416
86,874
pythondev
help
What happens if I try? :grin:
2017-07-22T10:35:21.181745
Fern
pythondev_help_Fern_2017-07-22T10:35:21.181745
1,500,719,721.181745
86,875
pythondev
help
There's some gevent based options for flask that makes it "async", but generally it's considered best to have a background worker do asnyc things (celery or rq)
2017-07-22T10:36:11.185925
Beula
pythondev_help_Beula_2017-07-22T10:36:11.185925
1,500,719,771.185925
86,876
pythondev
help
so I would be better of to use aiohttp?
2017-07-22T10:36:32.187822
Fern
pythondev_help_Fern_2017-07-22T10:36:32.187822
1,500,719,792.187822
86,877
pythondev
help
You can combine sync with async by using `loop.run_until_complete`. it will work locally, but once you run in thread mode (prod) you wont have an event loop.
2017-07-22T10:36:37.188266
Signe
pythondev_help_Signe_2017-07-22T10:36:37.188266
1,500,719,797.188266
86,878
pythondev
help
don't want to use any queuing
2017-07-22T10:38:21.197575
Fern
pythondev_help_Fern_2017-07-22T10:38:21.197575
1,500,719,901.197575
86,879
pythondev
help
<@Fern> if making lots of remote calls in parallel is required for returning the response, i would use an asyncio framework. Sanic is flasklike
2017-07-22T10:38:24.197848
Signe
pythondev_help_Signe_2017-07-22T10:38:24.197848
1,500,719,904.197848
86,880
pythondev
help
Aiohttp is also a good option.
2017-07-22T10:39:47.205207
Signe
pythondev_help_Signe_2017-07-22T10:39:47.205207
1,500,719,987.205207
86,881
pythondev
help
Seems nice
2017-07-22T10:41:08.212367
Fern
pythondev_help_Fern_2017-07-22T10:41:08.212367
1,500,720,068.212367
86,882
pythondev
help
Then I just need to figure out how to get JWT auth working :smile:
2017-07-22T10:41:30.214282
Fern
pythondev_help_Fern_2017-07-22T10:41:30.214282
1,500,720,090.214282
86,883
pythondev
help
jwt-extended!
2017-07-22T10:46:06.237706
Suellen
pythondev_help_Suellen_2017-07-22T10:46:06.237706
1,500,720,366.237706
86,884
pythondev
help
that may work with the Sanic API
2017-07-22T10:50:07.257720
Fern
pythondev_help_Fern_2017-07-22T10:50:07.257720
1,500,720,607.25772
86,885
pythondev
help
<@Fern> better have `to_dict` method, so you can serialize it into more than just json
2017-07-22T10:52:26.269671
Collette
pythondev_help_Collette_2017-07-22T10:52:26.269671
1,500,720,746.269671
86,886
pythondev
help
Say, yaml
2017-07-22T10:52:28.269813
Collette
pythondev_help_Collette_2017-07-22T10:52:28.269813
1,500,720,748.269813
86,887
pythondev
help
I'm considering how to make this part python 2 friendly
2017-07-22T14:02:14.304345
Jesusa
pythondev_help_Jesusa_2017-07-22T14:02:14.304345
1,500,732,134.304345
86,888
pythondev
help
it works, but I have to do it in a couple of places in my script
2017-07-22T14:02:49.307514
Jesusa
pythondev_help_Jesusa_2017-07-22T14:02:49.307514
1,500,732,169.307514
86,889
pythondev
help
what is the proper way to make this code work in both python 2 and python 3?
2017-07-22T14:03:00.308526
Jesusa
pythondev_help_Jesusa_2017-07-22T14:03:00.308526
1,500,732,180.308526
86,890
pythondev
help
The quick and easy way is to just make a function that gets the basename from your string.
2017-07-22T14:10:31.346982
Beula
pythondev_help_Beula_2017-07-22T14:10:31.346982
1,500,732,631.346982
86,891
pythondev
help
Hi! What TUI library would you guys recommend learning? I want to make GUIs for the terminal but I dont want any new windows opening
2017-07-22T15:22:52.699284
Claudia
pythondev_help_Claudia_2017-07-22T15:22:52.699284
1,500,736,972.699284
86,892
pythondev
help
easy or hard? :stuck_out_tongue:
2017-07-22T15:33:18.749536
Suellen
pythondev_help_Suellen_2017-07-22T15:33:18.749536
1,500,737,598.749536
86,893
pythondev
help
Whatever really, as long as it gives me the oppertunity to develop some kind of gui for an application for the terminal :slightly_smiling_face:
2017-07-22T15:36:20.764399
Claudia
pythondev_help_Claudia_2017-07-22T15:36:20.764399
1,500,737,780.764399
86,894
pythondev
help
<https://github.com/pfalcon/picotui>
2017-07-22T15:36:45.766363
Suellen
pythondev_help_Suellen_2017-07-22T15:36:45.766363
1,500,737,805.766363
86,895
pythondev
help
There was another project like that but I can't find it!
2017-07-22T15:36:58.767368
Suellen
pythondev_help_Suellen_2017-07-22T15:36:58.767368
1,500,737,818.767368
86,896
pythondev
help
Very similar, with windows and common elements like checkboxes...
2017-07-22T15:37:22.769291
Suellen
pythondev_help_Suellen_2017-07-22T15:37:22.769291
1,500,737,842.769291
86,897
pythondev
help
If you want something more barebones, then good old `curses`, or `bearlibterminal` for a modern approach, though it's aimed at games
2017-07-22T15:38:13.773491
Suellen
pythondev_help_Suellen_2017-07-22T15:38:13.773491
1,500,737,893.773491
86,898
pythondev
help
Thanks, will check them out!
2017-07-22T15:39:53.781152
Claudia
pythondev_help_Claudia_2017-07-22T15:39:53.781152
1,500,737,993.781152
86,899
pythondev
help
``` Hi, I have a file with following contents &gt; 1234 alphabet /vag/one/arun &gt; 1454 bigdata /home/two/ogra &gt; 5684 apple /vinay/three/dire but i want the output to be like &gt; 1234 alphabet one &gt; 1454 bigdata two &gt; 5684 apple three ```
2017-07-22T16:37:27.048786
Jessie
pythondev_help_Jessie_2017-07-22T16:37:27.048786
1,500,741,447.048786
86,900
pythondev
help
tee hee :slightly_smiling_face:
2017-07-22T16:41:01.064461
Suellen
pythondev_help_Suellen_2017-07-22T16:41:01.064461
1,500,741,661.064461
86,901
pythondev
help
`sed -r 's|(.+)/[^/]+/([^/]+)/.+|\1\2|g'`
2017-07-22T16:41:31.066613
Suellen
pythondev_help_Suellen_2017-07-22T16:41:31.066613
1,500,741,691.066613
86,902