« first day (3631 days earlier)      last day (1311 days later) » 
01:00 - 19:0019:00 - 00:00

1:54 AM
PEP 637: Support for indexing with keyword arguments. Any takers? At least it needs weird objects to be useful, so it won't be an issue like asspressions that random noobs can abuse to write yam code.
 
 
4 hours later…
5:57 AM
If one is creating a new PEP, they must also make the source code changes or python core devs do that?
 
@AndrasDeak not semantically well-defined with the current __getitem__ behaviour, I'm afraid.
oh wait, that's not 472? fetches reading glasses
 
6:40 AM
@python_learner Generally speaking the PEP authors are expected to produce at least a proof-of-concept implementation, to allow others to try the ideas out. It would theoretically be possible to produce a PEP and not implement it, but you'd then be relying on its supporters to iplement it, so they'd have to be pretty string in support.
The PEP often comes before the implementation, and they aren't always implemented in advance IIRC.
 
thanks, TIL
 
7:02 AM
Short question to the .tar-experts: Can I use .tar as a container for multiple files, that will be served by a Django server while the tar is being generated? So no need for tar.close() before sending?
Background is that I load mutliple files from a remote, protected server to Django and want to start the download for the user as soon as possible, not when all files have been cached by Django (like you need to with .zip).
 
obj[foo, bar, spam=1, eggs=2]
# calls type(obj).__getitem__(obj, (foo, bar), spam=1, eggs=2)
Yuck!
 
does anybody know reportlab
 
@YPOC I don't have an answer, but the general question seems to be whether Django allows streaming. Perhaps searching for that is more informational than for tar in specific.
 
@MisterMiyagi There's a StreamingHttpResponse() which I haven't looked at the specifics yet, but I suppose thats exactly where I would send that tar container
Or maybe there's another format that allows appending files on the fly while streaming it?
 
7:34 AM
@AndrasDeak Hm, I fail to see how that is different from PEP 472: Kwargs Strategy and the arguments against a new dunder seem pretty weak. Still feels very hacky to me, though at least it would all be wrapped away.
 
7:58 AM
@inspectorG4dget seems like the job for a linter such as flake8
 
8:10 AM
@MisterMiyagi The author says "....Since then there's been renewed interest in the feature." or did I get it wrong?
 
@python_learner They did, but interest does not change technical merit.
PEP 627 says "We agree that those [PEP 472] options are inferior to the currently presented, for one reason or another." which feels strange seeing how similar the presented ones are to the one from PEP 472.
 
8:35 AM
@MisterMiyagi from what I can tell the difference is "there's new evidence, your honour"
 
five sigma, I presume?
 
what are some good resources to practice writing one liners?
 
8:55 AM
How can I call a function in a function parameter? def bar(foo(x)):return x-1 I want to perform foo on x before I process it in bar, other than doing x=foo(x) inside the body? just curious no actual use case
 
if your foo(x) method returns something, couldn't you just write bar to accept it?
 
that is in a way similar to having bar(x) inside foo I wanted to know if there are other ways
 
foo(x: int):
    return x ** x

bar(bar_x: int):
    return bar_x + 1
then somewhere else in the code you could say: some_number = bar(foo(5)) # 3126
 
foo(x) inside bar, cant edit
 
in that case I don't think so?
 
9:04 AM
thanks for the suggestion though
 
@python_learner no way. Signature is evaluated at function definition time, not call time
Just put it in the body like normal people
 
laurel, yeah like I said no actual use case
 
@AndrasDeak implying devs are normal people lol
 
9:34 AM
@python_learner a decorator may be appropriate, though perhaps a bit overkill if you really just want to do x = foo(x)
 
I have not really used decorators in my code, I am just preparing for interviews so I was getting used to the unusual questions one might ask
is it too bad to rely on the REPL? the last interviewer told me to not use the REPL and I couldn't progress well (whiteboard interviews)
 
how did you manage to have a REPL on the whiteboard?
either way, the point of whiteboard interviews is to test your muscle memory and intuition. You shouldn't need to test whether the code works exactly as written, because that is not the point.
@JansthcirlU are you looking for one-liners in specific, or just concise code?
 
IMO for whiteboard questions the syntax is not really an issue, in all my interviews that were on a whiteboard I said something like "there are syntax errors but this is how I would solve this problem"
 
I am used to relying on REPL when I prepare, white board (notepad etc)so I cant progress how I normally tackle problems
 
@MisterMiyagi one-liners in specific where they're still acceptably readable
 
9:40 AM
You can train on paper, this way you can't rely on autocompletion and other features
 
so no cheesy one-liners with a bunch of semicolons in them
more like advanced list comps I guess
 
at times I just want to visualize data, say how does enumerate(seq,1) look like I get confused if index is first or the value stuff like that
 
@JansthcirlU I don't think such a thing exists in specific. Even for terse code, the goal is not to be one-line, but just no inappropriate fluff.
 
@JansthcirlUyou can try codegolf for all sorts of one liners
 
@python_learner that's exactly the stuff that does not matter on the whiteboard
 
9:41 AM
Yeah, I agree with @MisterMiyagi
oops
 
you should know that enumerate(seq,1) returns position and value. their order is secondary.
 
fair enough, I just really enjoy how one-liners can still accomplish so much
 
Whiteboard is used to test how you solve a problem, it's not used to test how well you know python syntax
 
maybe I must change my way of preparation, thanks for the suggestion all
 
Try to search for "algorithm interview questions" or something like that, and solve them by paper, then try to code them :)
 
9:44 AM
there is always leetcode :)
 
(I believe searching for "python interview questions" will yield python-specific questions that will be focused on the syntax)
 
^ this is what I have been doing all along
 
Yeah, I'm not a big fan of leetcode
But if it helps you solving problems on paper, go for it!
 
@JansthcirlU You may want to submit some of your code to CodeReview. Mind their asking guides, though.
Getting feedback on real problem that one has pondered already can be enlightening.
@python_learner FWIW, many of the coding challenges sites do not endorse idiomatic solutions, or even idiomatic problems for that matter. Take solving them with a grain of salt.
 
@MisterMiyagi nah it's alright, I don't want to specifically refactor some piece of code into a bunch of one-liners
 
9:49 AM
Then studying rules for shortening code can be problematic. IMO abstract problems do not help that much, because the challenge is applying them to real problems.
 
I have to say @python_learner in my country coding interviews (especially for juniors) aren't too tough
 
I have a bunch or projects but they arent of use if I cant clear the entry level coding test (almost 90% leetcode), India in case anyone is wondering
 
Same here, I got asked "please implement fibonacci, now do it the recursive way"
 
not sure if that's also the case where you live though, but I think most employers (unfortunately) mostly care about diplomas and company fit
 
and they were pleased when I solved Fibonacci, most of the other candidates took way too long
 
9:51 AM
its always do it recursively if you get it done iteratively, tree traversals :p
 
I think the dumbest interview question I had was to get a person's age based on their birthday and current date
apparently people neglected to take into account the current month and day
 
Well it depends, @python_learner, you can always @memoize the function ;)
@JansthcirlU I don't think it's dumb, if you need to parse string, do some calculation, take care of the weird cases, etc, it's a good interview question that reflects real-life problems
 
the purpose of many interview questions is not to see how good you are, but how bad you are not.
 
it's as simple as this
 
So having to trudge through mindless questions is par for the course.
 
9:56 AM
so while I understand it can be a good coding exercise, once you know how to do it in the simplest way there's no reason to ever carry out those calculations again
 
i get that, I hate the fact that they say dont use datetime to do this
 
you can still use a date time and convert it to a string, that's hardly a hurdle
 
maybe 10 years down the line if I interview people I will know why poeple ask these
 
what kind of job are you going for @python_learner?
I really dislike when companies ask hardcore data structure questions to someone who's applying to be a front-end UI/UX dev
 
been applying for python dev positions, nothing specific (webdev, ml etc)
 
9:59 AM
then it doesn't hurt to have a good grasp on all the theory I suppose
 
I was too relying on python libraries itertools to be exact and most of the solutions are brute force (got rejected) if I use them, so started a different plan
there was this upvoted reddit post (1k upvotes when I saw) who claims to have used DFS in a production code for the first time as a dev, makes me think why companies stress so much
 
they just need something that can be tested. people are more likely to have seen a basic grasp of theory problems than the exact practical problem that CompX cares about.
 
that makes sense, if they were to give a practical problem then they have to explain context which is not possible in interviews (time constraints). in a way interviews are exams still :)
 
that's exactly what coding interviews are
 
Sam
10:41 AM
Morning all. Any mlflow users here? I'm having some issues viewing artifacts via the ui. I've verfied the artifacts exist in the correct location but they don't seem to pipe through into the dashboard of a given experiment. Wondering if anyone has ever had similar issues?
 
 
3 hours later…
1:35 PM
morning cabbages, all
 
good afternoon sir
 
Oi
There is this windows based application that I have been using recently that is called Power Planner. It is what it sounds like, a planner. But the application is a bit buggy, so I wanted to figure out a way to send myself reminders of due dates.
 
Google Calendar?
or if you're on iOS I'm sure Apple has their own calendar app
or in the unlikely event that you're using a Windows phone, Outlook also has its own calendar functionality
 
They do have a calendar but then I have to manually transfer everything over
This way I could work on my coding
and it would be fun
 
If the question is "how can I write a Python script that checks my Power Planner due dates and sends me reminders about them?", it might be impossible* if the data isn't saved locally
(*or at least, too hard for mere mortals like us)
If the questions is "how do I write my own calendar/reminder app in Python? It doesn't have to interface with Power Planner", then that's easier
 
1:46 PM
data is saved locally
 
Ok, cool. Can you tell what format the data is saved in? Sometimes it's easy to tell and sometimes it's not
 
Hi Guys, how does thread safety work in this context (loading ML model in a flask webservice) stackoverflow.com/questions/32213893/…
 
Best case scenario: JSON. Worst case scenario: secret proprietary format encrypted with a key that only the Power Planner auth server knows
 
or the dreaded c,s,v format
 
shh, we dare not speak its name
 
1:50 PM
O.o csv? dreaded?
 
JSON would be much prefered
 
xml is worse than csv parsing
 
@erotavlas what, specifically, are you referring to? The model would be loaded within the threadlocal that is handling the request
 
I'm not sure how threading works for the flask web service - if the model is a global (loaded once and available for subsequent requests) I'm concerned when multiple requests come in the results from request A get delivered to request B
 
Sorry, not "loaded" but "run". Generally it does make sense to load the model globally if all you're doing is passing is passing input through a model that doesn't change throughout the app lifetime
Well, all the model is is a bunch of functions and classes isn't it? What you're imagining seems equivalent to wondering if calling a class in the global scope would end up mixing output between two separate requests, no?
 
1:57 PM
isn't that what thread safety deals with? the model must be loaded globally once to avoid loading it per request which will slow down the response times tremendously
 
@Aran-Fey Ok, regular csv is fine. The scary part is when the developer decides to write their own csv serializer and doesn't think very carefully about escaping quotes and newlines etc.
 
Hmm, yeah, thinking about it, csv is fine in theory but rarely in practice
 
@erotavlas I have to go on a call, will get back to you
 
ok
 
For some reason a lot of programs like to start their csv files with an '\ufeff' character lately
 
2:09 PM
One file format that looks scarier than it is is the zip archive. Usually the file won't have the ".zip" extension, so to a casual observer it just looks like unreadable uncrackable junk. But the savvy observer might notice that the file begins with a header indicating that it's a zip file.
The presence of a "PK" in the first few bytes is a dead giveaway
a zip file with no extension is the "frog that has the same color as a very poisonous frog but is not itself poisonous" of the file format world
 
So... a poisonous frog that doesn't eat what makes it poisonous :)
 
the "sometimes poisonous depending on what it eats, and it turns out that it did in fact eat what makes it poisonous recently" of the file format world is the zip file that contains a secret proprietary format encrypted with a key that only the auth server knows
And also the "gif where the police are chasing a man with a bucket on his head and the police knock the bucket off, revealing only a second smaller bucket" of the file format world
 
2:25 PM
Wait, do the shutil functions still not accept path-like objects as input? O.o
 
copyfile claims to, not sure about the others
there are four instances of "path-like" in the docs, and there are like 30 functions, so therefore you have a 13% chance
 
I checked the 3.7 docs and there it only accepts strings -.-
 
Alas.
 
@erotavlas Ok, what actually is the model?
 
a machine learning model
 
2:34 PM
Sure, but built using what?
 
why does that matter?
 
Because I'm trying to understand why you consider there's a way for responses getting muddled up across requests.
So unless it results in some funky object that starts handling things in async or with callbacks and puts things in a queue of some kind, I don't foresee the issue. I'm going to go with "it's thread-safe"
 
i don't know, my coworker is really worried about it for some reason, and it might be a valid concern
 
Well, it's simple enough to decouple it all
Just load the model in another process and set up a socket to pass the data back and forwards, and sign each request with a hash
Then you can compare it with some UUID (probably, rather than a hash) stored in the user's session
 
when two requests come in at the same time, how does flask handle them?
 
2:50 PM
See top two answers here
 
I don't think it's likely that one request could get a response intended for another request. I do think it's possible that the model mutates while processing a request, and it doesn't behave nicely if two requests mutate it at the same time.
 
Yeah, I was careful to caveat it with "doesn't change through the app lifetime " :P
 
If you're willing to sacrifice speed in exchange for peace of mind, putting a threading.Lock around the model code would neatly eliminate the average race condition
@roganjosh sensible. If the model is immutable, then thread safety is almost guaranteed.
 
mutate like the hulk?
 
The coworker is entitled to feel unease, because it's good to maintain a healthy paranoia when writing parallel code. But I reckon your due diligence ends once you've checked the docs for thread safety info, and maybe asked around a chat room or two. After that, the burden is on him to demonstrate a vulnerability in the app.
@erotavlas banner.color = "green" is certainly an example of mutability, yes
 
3:05 PM
ok let me ask this, can two threads access a machine learning model at the same time (i.e. at the very exact same time they try to pass their data into the model ) , causing the data to intertwine?
 
depends on your black box
I don't know what other kind of answer you're looking for with the information you've provided
Check line 241 for thread safety, I dunno
 
well forget it is an ML model, just say it is a function that multiplies two numbers
and this function is a global defined in the flask app
 
If the function doesn't mutate any shared state, you're safe
 
@erotavlas "Can my giraffe's head be intertwined with a power line when I transport it? Forget that it's a giraffe, say it's a mouse that has a neck"
 
haha :)
 
3:09 PM
A function that only multiplies two numbers will be thread safe.
(I think :P)
depends on where the numbers are coming from, of course
 
well an ML models is just like that but does more complex computation - maybe some matrix multiplication for one
 
@erotavlas ML models have a lot of state, that's what training is all about. Can you guarantee that the state doesn't change when you do what you're doing to it?
If you can guarantee that the state is frozen by the time you use it, then it's probably OK. Assuming your input can't get mangled (due to, say, two threads modifying a global quantity that is used as input)
 
why would the state change, the data you pass it doesn't change the state unless you are talking about training on the fly. No the weights (state) are set and don't change one the model is created
 
If the request is "model, do giraffes have long necks?", then it's not likely to cause a mutation. If the request is "model, please remember that giraffes have long necks", then mutation is a certainty
 
ok I see, thats reassuring :)
 
3:13 PM
@erotavlas how would I know what your black box does?
you keep saying "a ML model" as if that meant anything concrete
 
you wouldn't :) I was just reassuring you that the model state (i.e. weights) once trained cannot be changed the rest of the model is just the function (computation instructions)
 
perhaps I'm biased by my mistrust toward anything labelled ML
 
At the end of the day, the only way to verify that the code is threadsafe is to get a guarantee from the developer of the model. Either from the documentation they wrote, or from them in person when you pay them a visit in their bedroom at 2AM with your trusty ClueBat in hand
 
i'm the developer of the model :/
 
Oh good, then the interrogation won't be a felony
 
3:18 PM
lol
 
Verifying immutability isn't all that hard if you're familiar with the concept and have complete access to the full source
 
Did you read the link I sent, erotavlas? We keep mentioning threads but it's not relevant between requests because of the context stack
 
yeah I was just reading it
 
@roganjosh wouldn't that still mean that you're still only safe if the model works isolated for each context?
 
I never head of the context stack before this, so thanks
 
3:28 PM
I don't see the circumstance in which the model would work across context and more than it would get muddled between two serial inputs
 
I have global state in mind, if that helps. But I might be confused.
 
I'm 99.9% confident that this method is safe, and the 5 years of that question and 3K views without a single lamentation of some disaster is my meta buddy for support
But, I do think my UUID + separate process running the model would be the only way to guarantee that this was the case
It's probably safer that way too so that some weird input to the model couldn't pull down the whole site
Then again, I've only ever managed to kill gunicorn once and I can't remember how I did it :( Normally you'd just crash the worker process and gunicorn will just hire a replacement for their fallen comrade. So the "separate process to host the model is more stable for the site as a whole" justification probably doesn't mean a whole lot
 
3:58 PM
Incidentally I don't know a single thing about django's context system or the underlying mechanics of machine learning, so defer to anyone but me if there's a contradiction in my statements
 
4:17 PM
Me, covered in viscera: "I have slain the mighty rancor, as required for TPS-Z certification"
bureaucrat: "Well done. Now we just need your ratified TPS-Y form"
Me: "... TPS-Y form?"
bureaucrat: "Oh dear, you didn't ratify your TPS-Y form? You'll have to go back to the beginning, get the form ratified by the wise sage, and slay another rancor"
 
@Kevin another cheesy endless anime
 
Me: "... I shall return."
bureaucrat: "good luck!"
Me: "Y-you too"
Me, in the car, later: "You too? Idiot!"
 
Where does a installed pip package should look for files it needs to reference, in it's installed directory or the place you are running the code that uses that package/library?
 
@Kevin Your "you too" was a threat. If you fail you'll be back with a chainsaw.
 
I should step carefully, there. The TPS-Z clan is slow to anger but their fury demonstrates why hurricanes are named after people
 
4:20 PM
@AshwinPhadke it usually puts those files somewhere in site-packages
 
Jun 14 at 18:25, by Andras Deak
@ChrisP with your track record you are required to come with an MCVE when you ask for help. Have the shortest amount of code necessary to reproduce your issue, with a clear problem statement and question.
 
@inspectorG4dget Yes that I know, what I am seeing is that Flask is looking for the folder I gave the path in the python file in the directory I am executing the code and not in actual code directory which is in site packages.
In short it is looking for a let's call it static folder in the directory I am using the script instead in the actual installed code directory in site-packages
 
Why would it look in site-packages? Should it be doing that?
 
@roganjosh Shouldn't it be? I don't understand flask
 
What is the nature of the file?
 
4:25 PM
A video file
 
I mistakenly thought the question was "where does flask look for files it depends on?"
 
Morning, G4dge. I just started an 8-day break from work, so it's an immediate rhubarb too, sorry!
 
lol! haffun @holdenweb
 
@inspectorG4dget Partially correct though
 
@AshwinPhadke which has nothing to do with the functioning of flask itself, so it has no business being in site-packages
Relative paths are relative to the entry point to your app
 
4:27 PM
@roganjosh But to save the file I have mentioned a folder called uploads in app.config['UPLOAD_FOLDER'] and given the folder of the directory it is in.
@roganjosh Ohhhhh
My database and upload directory are both then not working.
Is there any way I can set Flask to look for directory in app rather then where it is been executed from?
 
and again, line buffering hates me
tail -f static/file.csv | stdbuf -oL cut -d ',' -f1,2
works just fine. Adding ` | grep '2020' ` causes "no output"
switching that to stdbuf -oL grep '2020' changes nothing
 
@inspectorG4dget Doesn't grep look inside file? Is 2020 somewhere inside file?
 
grep can take piped input. 2020 is the prefix on the lines I care about
really, I want to do `grep '^2020-', but that hasn't worked either
 
@AshwinPhadke I can't hope to mentally debug this because the structure of apps is entirely down to you
 
This is a cool package called handcalcs, for rendering and evaling formulas within your Jupyter notebook. A user posted his homework (in Portuguese), the ipynb shows the before/after. Very nice.
 
4:33 PM
@inspectorG4dget try grep -E if regexen are acting up
 
@roganjosh Yeah, it's just now I know that a packaged Flask will look for directories where you are executing the code and not where the actual library relies.
 
Though cell 47 makes me sad. He creates a 3x3 pandas dataframe just to get a nice tabular output.
 
@AndrasDeak that's a negative
 
OK, worth a shot
between grep and egrep the escapes are all over the place
 
that's just the thing. I asked about this recently, and grep was never the problem then
 
4:35 PM
@inspectorG4dget tail -f static/file.csv | awk -F ',' '/2020/{print $1, $2}'
not sure about -oL in stdbuf though
 
that's not working either. I even tried ± stdbuf -oL. I have a feeling I need to reboot my computer
 
I didn't test that awk though, but it would be a good way to replace grep+cut. How it plays with buffering? I have no idea.
you can tail -100 or whatever to check whether the awk bit works
/^2020-/ is probably even better but that's less important
 
@AshwinPhadke So you're not talking about Flask, you're talking about a package you've made that creates an app?
 
@inspectorG4dget perhaps unix.stackexchange.com/a/83853/416002 (flushing awk...)
check it with unbuffered input first to find any bugs I put in the awk part
 
@roganjosh I am talking about an app that uses Flask.
 
4:51 PM
But what do you mean by "a packaged Flask"? Why mention "packaged" if you're talking about just Flask? Otherwise we'd be referring to everything that way; "my packaged pandas leverages packaged numpy". I'm confuzzled
I'm being pedantic because one of my side projects actually launches an app as part of an installable package and if that is the case, then what I've been saying might not be true
 
If the question is "how should I write my program so that once I package it, it can correctly locate data files that I bundled with it in site-packages?", I am also interested in the answer, because I did it once half a year ago and would like a refresher
I suspect it has something to do with __name__
 
@roganjosh I mean flask is used in my app that I have packaged.
 
I got asked today about the ^ operator on sets, as in inactives = set(all_procs) ^ set(pr for pr in procs if pr.active()). I never thought about using ^ on sets, it turns out it is like an anti-intersection. You get all the values in either set that are not common to both. My recommendation, since the set of actives should always be a subset of the set of all, was to change it to - (subtraction) to make the intent clearer.
 
@Kevin This is the most appropriate way to put what I mean
 
One demerit to packaging.python.org/guides/… for saying "For more information, see Including Data Files from the setuptools docs." and then linking to a page with an anchor link that doesn't resolve to anything, and which mentions "data files" a grand total of one time in a totally unhelpful context
 
4:59 PM
I am lost for words as why couldn't I come up with that
 
@AshwinPhadke Choosing good phrasing for questions is one of the hardest problems in our profession, in my opinion
 
@Kevin This exactly is what I want to ask.
@Kevin Hmm, or maybe I couldn't put it the right way.
@roganjosh @Kevin can you help me out with it?
 
Deciding whether someone else's question is the same question as your question is another hard problem :-)
 
@Kevin lol yeah that is a skill actually
 
It's important that the path is relative to the place where someone imports it, and not relative to where the app is launched inside the package. Otherwise what happens when your user wants to update?
 
5:01 PM
@Kevin I did not understand a thing what they mean in that doc?
 
I think that's one of the unsolved problems of foundational logic actually. Get a nice million dollar prize if you can make a formula for that.
 
i miss the clean air from lockdown :/
 
@roganjosh Yes that is why I want it to locate the folders where it is installed but cannot do
@Kevin takers anyone?
 
@AshwinPhadke Me too, mostly. I'm not good at packaging unless it's a very simple project
 
@Kevin If I were to add a seperate argument to include package data then what is even the use of MANIFEST file it makes no sense.
 
5:05 PM
I assume there's a useful scenario for every bell and whistle provided by the packaging system, although I usually have no idea what that scenario would be
 
Aran-Fey fixed this for me, I'm just floundering around in search trying to find it
 
data_files completely counters package_data and both show as benefits,, what is going on with python packaging?
 
My wild guess is that it's an unfortunate violation of the principle of "there should be exactly one way to do things"
 
@roganjosh Not entirely sure what the goal is, but I suspect you're thinking of the import __main__; Path(__main__.__file__).parent thing
 
Sometimes old and busted options get deprecated by the new hotness, but the old and busted option hangs around for backwards compatibility reasons
 
5:08 PM
So how do i solve this issue?
 
Ah, __file__ might be what I was thinking of. It was one of those dunder wossnames for sure.
@Oak If the question is a few days old (and if it is a Python question), we don't mind a bit of self-promotion
 
@AshwinPhadke the fact I said I was trying to find it is indication that I was searching for your answer
Jun 24 at 8:59, by roganjosh
I've installed one of my packages locally with pip install -e . to play with. I want to bootstrap my app by creating a config file on a path relative to where the script is that imports my library. Is there a neat way to do this? I've found a way but it feels gross and possibly not workable across different OSs (though can't test that right now)
 
I don't see any benefits to making directories where the user is executing his script by importing my library because how do I find the package on an update and many other reasons.
@roganjosh Ah, didn't read thanks
 
Between you and me I suspect that just coming in here and saying "am I allowed to post a link to my question in here?" is enough to get a bit of views from users that are willing to click through to your user profile to see your most recently asked question.
But shh, don't tell anyone
 
I would rather have the person put his question here rather then letting people scroll through internet to understand your concern
 
5:13 PM
@AshwinPhadke I have no idea what you're talking about
 
@roganjosh What I am saying is it is more beneficial for the package to refer from where it is installed rather than wherever user is using it, package has control over where it is installed in case of update
 
Yeah sure, and when they want to update your package, the existing package is automatically deleted, all their uploaded files are deleted, and then they get a shiny new version with no content
 
(Allowing solicitation after a couple days is, I think, a nice compromise that puts the breaks on the overly eager, while still allowing through people that have diligently exhausted other avenues of inquiry and still need a hand. But I don't want to get too deeply into the justification of our policies)
 
This is what I did : python-packaging.readthedocs.io/en/latest/non-code-files.html but it seems like that is not useful at all
 
I'll be honest, I think there's a massive divide in understanding between us on what you're trying to build here
Have I invented something here? Are you only talking about static content that is distributed with the package?\
 
5:18 PM
@roganjosh static content is being served correctly, no issue with that. Kevin has put my question correctly
Packaging is confusing
 
Kevin's version of your question is the opposite of what I'm saying. It's not that he's misunderstood what you're asking, it's that I'm telling you this is a bad idea with user content
 
@PaulMcG "symmetric difference". It actually matches my mental model of "exclusive or"
 
I don't know with any true authority whether storing mutable user data in site-packages is bad or not, but my gut feeling is "yes, it is bad" and if roganjosh agrees that's good enough for me
 
@roganjosh So where do you suggest I save user content, all I know is the content that needs to be served to user should come from static folder and not the content that user uploads or saves, is that right?
 
By static, I don't mean the literal "static" folder. I mean static in the sense that your packaged project never stores any new content from a user
 
5:23 PM
When I posed my interpretation of Ashwin's question, I kind of assumed the data was static, so I didn't mention my concern
 
@Kevin at this point I think it's all fair game. I just can't pin down a consistent view of what they're doing :/
And worse, it's probably not helpful to ask for an MCVE because it's all conceptual. The worst kind of problem
 
@AshwinPhadke I know that in Windows, user-specific data is conventionally stored in the appdata folder. (I know that question is for C# applications but I think it applies to apps written in any language.)
I think the specific location of the appdata folder, and the specific subfolder you're supposed to use, varies between Windows versions. It's a bit of a pain in the butt, honestly
No wonder some programs will give up and stick the data in program files or C:\ or somewhere equally naughty
 
@AshwinPhadke at this point, please take some time to play with flask-migrate in a new, toy, project
 
@roganjosh There's code but it is just too big and I will need to comletely make a new code to write an MCVE which is more time consuming than discussing.
 
Then think about why it sets up the migrations folder relative to the import vs. in the package
 
5:28 PM
MCVEs can be time consuming, but they can be very valuable instructional resources even if you never share them with someone else
 
@Kevin Well this solves one thing, that I shouldn't store whatever user uploads in site-packages, I need an appdata kind of a fodler
 
Boiling down a problem to its essential components does wonders for understanding
 
folder*
 
@Kevin Yeah
@roganjosh SQLAlchemy supports sqlite? i am new to this
 
5:33 PM
It does, yes. The reason I'm suggesting this is because I don't want to be fighting your intuition over this, I'm trying to think of the simplest demo I can to show how it makes sense
 
@roganjosh Yes it is helpful
 
@AndrasDeak thanks. I'll check it out
 
Also is there any way where I can skip all the saving and database and just pass the uploaded file to process?
 
The demo is not going to be short - it's going to take some hours for you to build if you don't know the libraries. I still think that's invested time vs. restructuring an entire package with the wrong setup, having an "oh crap" moment at the end, and then have to restructure the entire thing
 
I'm pretty sure that wsgi-related frameworks can typically upload files directly from memory without saving the data anywhere, yeah. Unclear whether it's a good idea to leave no records of that transaction though. It depends on your use case.
If the interface requires a file-like object, you can always use StringIO
 
5:39 PM
@Kevin I found [stackoverflow.com/questions/20015550/… but trying to figure out, I just need the user to upload the file so that I can do some stuff on it and then pass the file to the user to download, does my use case support what you are saying?
 
Just going by that description, yes
 
Okay, I'll check.
 
(Disclaimer: I use flask once a year so I don't know the exact way to do file uploads/downoads)
 
@Kevin What's a suggested web server?
 
@Kevin do you make an occasion of it? Party hats?
 
5:41 PM
lol
 
I mail davidism an unmarked box of glitter
 
@AshwinPhadke he just said he doesn't use Flask :/
 
@roganjosh Good advice, will keep in mind, thanks.
 
@AshwinPhadke If I may chime in here...my experience is with Django rather than Flask. In Django, we have a static folder that contains static content like JavaScript and CSS files that are loaded with a page. We have a separate media folder where we save files uploaded by the user or other dynamic media used by the site.
 
5:42 PM
I'm sure in Flask you can do something similar, even if you use different names.
 
My coworker usually handles the deploying-to-web-servers part, but I hear nice things about gunicorn?
 
@Code-Apprentice I don't remember Flask having a media like folder or something
@Kevin gunicorn is good , but it's for deploying whatever you already have, I have not so far seen file handling
 
@Code-Apprentice The problem is that they want to have the content bundled up in their package. It would be equivalent to having a "media" folder inside site-packages/django/
 
Incidentally when I say "wsgi-related frameworks", that also includes django/flask, not just the server they're running on top of
 
gunicorn doesn't work on Windows :'( But yeah, it's a single command line to launch the server and by-far the easiest
 
5:46 PM
@roganjosh It doesn't work there? really?
@roganjosh Yeah that
 
i recently learned how to run a web service on linux, I had to run gunicorn using systemd so it restarts on boot
 
Not that I'd want to host my apps on Windows, but there's been a few times where I've wanted to test something locally and you just can't
 
how come linux doesn't have something like IIS for python webservices (i.e. why we have handle gunicorn part separate form nginx and make sure its restarts)
 
Things like Flask-ApScheduler. "Will it go bonkers in production? Who knows!" yes, yes it does.
 
@erotavlas Nice , also you can write a bash and use it to start a service, more configurable
@erotavlas I think then they use Apache and forget all worries
 
5:49 PM
Hello. Where I can find a discussion or chat about neural networks?
 
there is none
i tried creating a machine learning room once but it got closed because no one used it
 
Now this is something new : for-the-user.tumblr.com/post/159645715655/… why isn't flask documented completely.
@entithat Try stack exchange data science or something like that
 
ok thanks
 
It seems that the ML community has an abundance of truth-seekers but a shortage of wise old sages
It's hard to keep a community glued together with a deficit like that
 
how does './dirname' differ from 'dirname'?
 
5:52 PM
@Kevin yeah
 
@Kevin perhaps they are wise enough to live in hermitage
 
@Kevin Very few are learned, and they are goooood
 
@AshwinPhadke that's a complete non sequitur
 
I have a very simple question, but can't understand it for a few years...
 
I suspect they either go mad very quickly or cash out a fat IPO to go live in a secluded bungalow in the tropics
 
5:52 PM
ask it, now I'm curious
 
Both is also good
 
and then get destroyed by their AI creations like in Ex Machina?
 
The trick there is, don't make your robot hot
 
@erotavlas assuming it's python-related
 
@Kevin temperature or ?
 
5:54 PM
@AshwinPhadke yes. See Terminator 2 ending.
 
Temperature and attractiveness. You want to avoid scalds and being seduced by the robot and/or betrayed by a seduced colleague
 
CPU did some powering down before it burned out, and that stalled dont_kill_humans_loop. Needs more thermal gel
 
Make sure to seduce your colleagues regularly for maximum loyalty
 
@roganjosh it always stalls at something important
@Kevin lmao what?
@Kevin Kevin is on a different stream today
 
Yeah, the OS found the dont_clip_toenails_in_livingroom_loop more important because it only fires up every month or so and the other was a big CPU-hog
 
5:57 PM
Can't get sage advice from me unless you politely listen to my mad screeds as well
 
I'm under the impression syntax highlight changed colors for Python since yesterday and it looks worst...self doesn't have its own color now...
 
Can you give an example please?
 
no color is a color therefore it has its own color :P
 
Trying to wade through the main feed to find a class is low on my agenda. I tried a few and ended up just closing them :P In general it looks more shouty
 
6:14 PM
@bad_coder that's good. Self is not special.
 
Really?
It might not be special but I'm totally used to my IDE highlighting it
 
which IDE?
 
Now I'm questioning myself :P I thought VScode did it, but definitely Spyder does
 
looks like VS Code highlights it (just checked)
so does PyCharm
jupyter notebook doesn't
 
6:46 PM
self doesn't get special treatment from the language, but it does get special treatment by pep 8, along with cls. I wouldn't blame highlighters for coloring them.
 
@Kevin how does it not get special treatment? You can't call a classmethod on self and you can't call an instance method on `cls...They seem pretty essential to me.
@AndrasDeak by that logic anything that isn't a dunder or a declaration wouldn't deserve highlight...Ohhh well...
 
@bad_coder I don't follow
 
@bad_coder self has no intrinsic meaning. Make a class and change every self to poop
 
01:00 - 19:0019:00 - 00:00

« first day (3631 days earlier)      last day (1311 days later) »