« first day (3536 days earlier)      last day (1395 days later) » 

12:13 AM
This is also interesting @Aran-Fey stackoverflow.com/a/17492103/2124148
 
 
2 hours later…
1:44 AM
@roganjosh I wonder if that's been recently resolved. I filed an issue/bug a couple of years ago and they basically said they're not going to solve the issue because it's minor. Ctrl+d was mentioned further down, but not Ctrl+.
 
 
10 hours later…
11:35 AM
Is there an easy way to tell if my documentation covers all of my classes/functions? The only thing I could find was sphinx.ext.coverage, which straight up doesn't work (doesn't find any undocumented things even though there are some)
 
If you documenting through docstrings then you probably can use pydocstyle. But if you're not then it's just be an annoyance
 
Well, I do use docstrings, but the question is whether all the relevant ones have been included in the HTML output
 
 
2 hours later…
2:12 PM
That is filled with wrong answers
If any expert in the matter wants to pitch in
 
too broad ^ stackoverflow.com/questions/62499437/… ("which one is faster or better?")
 
But yet you didn't cast a close vote. It would be a good question if it was a little more specific.
 
@NicolasGervais Why do you keep insisting that Ann's answer is wrong when she fixed it before you even posted your first comment on it?
 
I probably started typing before she did, while doing some research. My comment below is true, however. This person posts a lot of wrong answers, and then edits them after the fact. So new users who ask questions, who don't double check, often accept or vote the answer to the top just because it's the first answer.
 
2:29 PM
Well, on the bright side, if she's editing them into shape she's already doing a better job than most other new users (:
 
@NicolasGervais I decided to hammer it.
 
@NicolasGervais I didn't?
 
I see that the "thank you for this answer" emoji button has changed from praying hands to clapping hands. Slack still uses the praying hands (I guess as in "thanks be to God").
 
Oh now you did. For some reason it didn't appear before a minute at least.
 
What is the difference again, between "thanks" and "upvote"? Does "thanks" earn any rep?
Yes, it was already hammered just now when I looked at it.
 
2:35 PM
@PaulMcG A/B test? I see "praying hands" (actually high-five I think)
 
@Aran-Fey yes that would be the bright side haha
 
@PaulMcG upvote leads to rep, thanks leads to facebook
 
@PaulMcG As Andras said, it's an A/B test: "We’re testing two versions of the “thank you” icon:"
 
Well I'm not using this button.
At least not until it's a laughing emoji
 
Yes, thanks for the link to meta. Interesting discussion, seems the negative comments outweigh the positive.
 
2:56 PM
@NicolasGervais "This person posts a lot of wrong answers, and then edits them after the fact." Ok, that's not good. But as Aran-Fey said, at least she does fix the faults when they're pointed out. She's obviously enthusiastic about Python & SO. She's almost hit 6k in 5 weeks, and posted over 500 answers (and 14 questions). We need to encourage her to reduce the quantity a little & improve the quality. I prefer to do that with positive constructive criticism.
BTW, this new feature was mentioned 6 months ago. See meta.stackexchange.com/q/339283/334566PM 2Ring Jun 18 at 11:09
A few days ago, LinkBerest mentioned that this Reactions thing may cause the organization he works for to stop using Teams:
2 days ago, by LinkBerest
The teams literal reaction: "we wanted to use SE to avoid all the Slack level chatting that happens and steals focus from work - why would we want this?" — LinkBerest 25 mins ago
2 days ago, by LinkBerest
yeah, the two companies (or to be more accurate government agency teams) decided on Stack over Slack mostly because of that during the whole Covid remote-work change over (literally, regulations make "reactions" sit in a weird "does this met regulation, orders, and requirements" status - which directly state "no social media platforms for communication"). They might be changing off Stack to MS Teams now just because of this so its been a bit of a discussion
 
3:13 PM
Not trying to be biased or anything, but I love MS Teams
 
@PM2Ring Perhaps. I will also point out that most of these points are from questions that more experienced users would vote to close rather than answer.
 
@NicolasGervais Well sure. It can be hard work convincing FGITW answerers to close / dupe questions rather than answer them. ;)
 
Sorry could you tell me what's FGITW before I started trying out all the permutations?
 
@NicolasGervais That's because high rep users stop caring about rep and look for duplicates instead
 
BTW, Ann has been hanging out in this room. She hasn't been here for a few days though.
@NicolasGervais Fastest Gun In The West.
 
3:26 PM
Oh she has a nickname
 
Their modus operandi: Answer first, think later. ;)
 
@PM2Ring But what if you live in the east, south or north?
 
@NicolasGervais FGITW is a standard term across the network.
 
@NicolasGervais be nice
 
Let's try to be respectful of people, especially when they aren't here to defend themself.
 
3:29 PM
No need for the second half
 
Note that FGITW answerers often slow down once they have enough rep to do useful stuff, and can become high quality contributors to the site.
 
 
1 hour later…
4:54 PM
Hello everyone!!! anyone who is django expert? i have this question stackoverflow.com/q/61528642/…
 
hello
 
5:06 PM
@PM2Ring Yeah, its a security discussion now but looking heavily like we will move platforms (not MS Teams as that removed the ability to turn off emojis in 2018 and haven't added it back yet, looking like the paid version of one of Google's options or WebEx or ..... uh, I forgot that last one)...which is sad. SO was much better than these options.
 
How do people deal with the backwards compatibility code + code coverage problem? Just annotate everything with # pragma: no-cover? Like
if hasattr(os, 'PathLike'):
    FilePath = Union[str, bytes, os.PathLike]
else:
    FilePath = Union[str, bytes]  # pragma: no-cover
 
side note: I think that should go next to else:
 
It works if you spell it correctly, i.e. no cover with space instead of dash
 
works, but if you put it next to the else: it will semantically refer to the whole suite
I don't know if the else: line gets counted otherwise
 
nah, the else is excluded as well. Even with branching enabled
 
5:16 PM
ah
 
5:26 PM
hi
hey, uh, anyone knows any good tensorflow tutorials?
 
Took longer than expected, but I finally got the first of my projects all cleaned up. Starting to repopulate my github and populate pypi for the first time as of today. Can't wait to look at the download statistics for the first time and see a bunch of zeroes.
 
@Aran-Fey nox/tox + coverage. You can join multiple coverage reports into one.
 
Ah, I see. That's related to the .coverage folder I delete every time because it causes stupid problems, isn't it
 
I don't recall seeing it produce folders. However here's the tox.ini I used to deal with it. The "coverage:paths" section tells coverage how to merge the files. But it's pretty simple otherwise
 
I understand like 1% of the stuff going on in that file. Need to spend some time with the tox documentation to untangle all that
I wasn't aware of that library btw. Now I need to think about if I'll continue to develop mine or start using yours
 
5:37 PM
I didn't recommend it when I recomended PyTypes cause the code is, err, 'yam'.
 
I'm amazed you found all those version incompatibilities to be honest. There's no way I or my test suite would ever pick up anything of the sort
 
I spent quite a while on it and I brute force check against all types in typing and typing_extensions. Tox and Travis really helped
 
 
1 hour later…
6:57 PM
@Aran-Fey Run CI with all Python/... versions supported. Especially for legacy code, CI coverage is a lifesaver. "works on my machine" is not sufficient for cross-compatibility.
 
@MisterMiyagi With this method you still need to combine the coverage reports. Using tox/nox allows for the same tests in the CI and on the machine.
 
Oh, CI can do that? That's pretty neat
 
@Peilonrayz I need to combine them anyways, since my machine only runs MacOS, CPy3.7, CPy2.7, PyPy3.6 and PyPy2.7. It doesn't run Linux, it doesn't run FreeBSD, it doesn't run CPy3.6, CPy3.8, CPy3.9, nightlies or whatever.
 
@MisterMiyagi Yes. "run CI" alone doesn't solve the problem as it's not combining the coverage reports.
 
@Peilonrayz Neither does "using tox/nox".
 
7:07 PM
...
 
@Aran-Fey Yeah, CI providers have lots of OS' and runtimes available. The travis CI list is pretty extensive, for example.
Remember how wim and me talked about having online coverage reports? As part of the CI setup, they get the reports from all individual runs and combine them.
 
I'll figure out tox first, then move on to Travis. I need all the older python versions installed locally for developing anyway
> congratulations :)
aw, that's cute. I'm using tox more often now.
 
7:56 PM
Hello, anyone here?
 
Nope
 
hi
 
Hi
 
i need some help regarding my pygame installation
 
What game?
 
8:08 PM
Hello
 
And which os?
 
Windows 10
i just intalled my pygame
 
@ChrisP wait for the question first
 
but when run 'import pygame
print (pygame.version.ver)'
nothing happens
 
did you install it with pip3 ?
Or with other package manager?
which python version do you have?
 
8:14 PM
i installed it with pip 1.9
then i updated my pip to 2.1
python version 3.8
 
What do you mean "nothing happens"? Python hangs?
 
mmm like... it waits 3 seconds but then it returns to stand by
like nothing had happened
 
So import seems to work.
 
Sounds like the import succeeded, then. Although it's weird that it doesn't print anything. What if you try to rerun the print?
 
what do you mean 'return the print'?
 
8:20 PM
rerun, not return
i.e. execute print(pygame.version.ver) again
Ok, I'm lost. How the heck do I make coverage.py ignore the path of my module? I.e. get rid of the .tox/py/lib/python3.8/site-packages garbage
 
@Aran-Fey IIRC coping the coverage:paths will do that
 
8:36 PM
Adding that made no difference. I also tried --source {envsitepackagesdir}/my_module vs --source my_module, but still no dice
 
Hmm it matches the path, .tox/*/lib/python*/site-packages. Maybe coverage has breaking changes around this.
 
That seems likely, because I tried your -source {envdir}/lib/site-packages/typing_inspect_lib and got no output. Had to replace that with {envsitepackagesdir}
 
can you have a .coveragerc as well as a tox.ini?
 
AFAIK you can, but you can also configure coverage directly in the tox.ini
[coverage:paths]
source =
    src
    .tox/*/lib/python*/site-packages
    .tox/*/site-packages
like that
 
I remember having lots of pain setting up pytest and coverage to run only my code, and this is what worked for me in the end
[run]
source = my_package
...

[paths]
source = src
...
 
8:43 PM
Hmm. What if I don't have a src folder?
 
Oh, that might be it. I've never not used a src layout so I don't have a clue how to fix that. :(
 
@Aran-Fey can you still add it? makes tooling stuff a lot easier
there'll surely be a way, but I'd have to debug a while
 
Is the [paths] section even relevant if I don't use combine?
I went the --append route
 
I forgot ^^
 
@Arne that'll be my last resort :P
My tools don't tell me how to do stuff. I tell my tools how to do stuff. And if they refuse, I get stubborn.
 
8:52 PM
some tools have a tendency to wear that kind of resolve down for me, though. and while coverage.py is amazing, I distinctly remember thinking "I never want to debug it again" once I found a stable workflow.
might be worth a question, or do you not interact with main SO on this account?
 
not with this account, no. I still use the other account to ask questions, though
 
I see, wasn't sure if the other one was frozen now
 
Hmm, evidently coverage is ignoring my [coverage:run] section. That probably means the [coverage:paths] section as well
 
It looks like the paths section is working. Have you tried changing src to introspection?
 
Let me try. Though I'll need to rewrite this to coverage combine
 
9:07 PM
I just remembered one more thing you could try. I installed a pytest plugin that calls coverage at some point. It doesn't add any configs, but it meant that if pytest tests/ works correctly, pytest tests/ --cov will also work.
 
Still no dice. Why the heck can combine read the source ini value but doesn't accept it as a command line argument? This thing is a mess
Somehow it crashes at coverage combine but works when I execute that command manually
Ah, I forgot to fix my COVERAGE_FILE value in the env that generated the report.
 
9:28 PM
just so I'm understanding this correctly, the only difference b/w logging.info and logging.debug is the level? So for the client I just want them to see info but when I'm debugging or working on it, it would be helpful for me to see the extra info so I set my level to debug so those statements are output too?
 
Yeah, that sounds about right
@Aran-Fey You get it fixed? Nice
 
Yeah, it works. I'm still wrestling with it because I want to remove all the stuff that's not needed from the config file though
 
right, but I'm working on a backend where I guess everything should be logged 🤔
in that case I'll set the default level to debug and use both just as a naming difference I guess, since ultimately I want to have everything when needed
 
The relative-files option could've saved me a lot of trouble if it worked
Is there a way to only select python environments in tox? Excluding utility envs like [testenv:clean]. Something like [testenv:py*] maybe?
 
Sorry I migrated to nox a year ago, so everything I knew about tox I no longer do.
 
9:38 PM
I'm so confused with logging on my backend, I literally replaced all my print statements with logging.info and it just works, the nice part is that I have more control over the output
 
@aadibajpai this is all convention, but a backend should usually not log on debug level. that one should only be switched on 1) during tests suite runs 2) in test / staging environments
 
@Arne what would I want to log in debug and not in info for a backend?
 
the important difference between debug and info is that debugs can be placed wherever, including loops. any other log messages should only report on some kind of event
 
I understand the distinction for something client facing but not really for a backend
 
it's hard to put into words for me..
 
9:42 PM
That sounds like some good advice Arne. I hadn't really thought of it that way
 
def is_title_mismatched(words: List[str], full_title: str, max_err: int) -> bool:
    err_cnt = 0
    for word in words:
        if word.lower() not in full_title.lower():
            err_cnt += 1
            print(f'broke on {word}')
            if err_cnt > max_err:
                return True
    return False
so for a function like this, replacing the print statement with logging.info is not a good idea?
that's more suited for debug?
(I forgot how formatting works here btw)
because when I view my logs it generally would be useful to see the words it broke on
 
@aadibajpai To do that with my interpretation of Arne's advice would be to then reproduce the issue in the testing environment. In this environment you'd be logging debug message and so would get that info.
 
I don't know jack about logging, but it seems more reasonable to make a single log call like f"is_title_mismatched called with {words}, {full_title}, {max_err}". That contains all the information you need
 
9:59 PM
@Peilonrayz that makes sense, because right now those broke statements appear also for successful cases where I don't need them. But then I don't really have a testing environment so for the important cases it would mean some manual setup
@Aran-Fey hmm, true because I think the words it broke on is eyeball-able
 
was afk, to continue: To give an example, if I look at a logfile and I see something like this:
INFO: Initialising configreader.
INFO: Loading config from path/to/conf.ini
INFO: Reading config value foo with value 'bla'
INFO: Reading config value bar with value 'blubb'
INFO: Reading config value baz with value '1'
INFO: Reading config value qux with value '2'
INFO: Reading config value quuz with value '3'
INFO: Finished reading config.
I'd think "those 5 in the middle don't really convey new information, and they clutter everything up. they should probably be debug-only." So, mostly a feeling.
 
that adds up to my example! so I should make them debug, yes, but then where will you see those?
 
uhm, in the logfile?
 
no but you said the default level should be info
 
yeah
I actually have my servers on warning
 
10:04 PM
so you will have to recreate the setup and then run it with the debug level to view those reading config values?
 
staging on info, and debug only for local tests.
 
is there a way to print debug statements only on certain cases?
I see
 
there are ways to change log levels during the lifetime of a service.
 
is that something generally done?
 
very seldom, I'd be too spooked to try
 
10:05 PM
eg, I'd be happy to see where it broke on cases where is_title_mismatched returns true but idc about it when false
I see
will go the Arne way, I think then
 
=)
 
or, maybe a combination of that and what Aran said, because eyeballing it for regular cases and debug statements on testing sounds like the best of both worlds
 
Bye bye
Good day to all.
 
@aadibajpai If I were to merge the two advices I'd personally make it a list comprehension. You can then use len to see whether to return true or false.
 
yeah, this printing one by one thing is dumb and I've been planning to change it, especially because in some cases an issue is opened up and I'd like to include this info there which would be easier if there was a list of words it broke on so I'd have all info in one place
I think there was a reason I wanted to see the times in order it broke instead of all at once, but I can't recall it now.
 
10:16 PM
May 22 at 19:45, by Andras Deak
@ChrisP please don't ask for help here with fresh questions on the main site as per our rules
 
but the usual workflow where I'd look at logfiles would be
Manager: "hey arne, we're seeing dropped requests on these users [list of user IDs]"
Arne: "[nothing, because he's very shy irl]"
step 1 -> check production logs using the user IDs. Try to find WARNINGs that explain the problem
step 2 -> no dice? run the request using the ID list in some kind of test env that has logging on INFO.
step 3 -> no dice? boot up the service locally with logging on DEBUG, run the requests once more.
step 4 -> no dice? you should have logged more, arne. Now you have to use a debugger again. and we hates the
@aadibajpai In case it wasn't clear, I'd replace the "broken on word" part with a debug log, and add an info log before returning True
 
@Arne that's what I'm doing, but also adding an info log with the words before this function is called or inside the function to view what's been passed to it. That should be enough to eyeball it and if there's a problem, when I do it locally then the debug logs will provide more info
 
the classic decorator example is one where all function parameters get logged, so doing that seems sensible enough. whatever helps you reproduce the problem reliably in case things go wrong is valuable information.
 
that is a good idea, but would start giving me more info than I need right now so I'm thinking of scaling it as I go. Maybe later it might be useful to do that and then replace logging statements that were doing the same thing.
 
10:31 PM
You don't have to decorate every function, just the questionable ones
 
technically you only have to put a single logging call where the bug is ;)
 
Right before the bug is even better
 
without the bug is best
 
Of course this is a suboptimal solution. The optimal one is writing bug-free code.
 
10:33 PM
I'm thinking of just removing bugs and getting rid of logging
yeah
 
That's a narrow view of "optimal"
 
btw, does logging after an except Error: fall under error or warning? is it an error if you handled it?
 
If all you do after logging is "raise", then actually you didn't
 
it's like
            except AttributeError:
                print(f'Path did not end in lyrics: {path}')
so it's something that can happen sometimes, and I know it will happen sometimes but is it an error 🤔
 
Depends wether it's a problem or not. If it's completely recoverable, info or no log could be fine, too.
 
10:37 PM
catching an error and handling it are two different things
 
the doc said error is when you weren't able to perform some function but this one is not up to me so I was thinking warning because it says the software is still working as expected but something unexpected happened
hmm, I would definitely like to know when it happens
I think warning feels most appropriate for this case 🤔
 
You'll see what logs are clutter and which aren't once you start looking at your logs a lot. Better to start logging too much than too little until then.
 
11:06 PM
is it a bad idea to log half tokens to see that they were in fact changed? because I once had a bug where they weren't updating.
 
I personally would run them through a hash first, assuming they're secrets
 
right
also why are logging docs still on the old %s formatting instead of the vastly superior fstrings :pepehands:
 

« first day (3536 days earlier)      last day (1395 days later) »