« first day (2757 days earlier)      last day (2190 days later) » 
00:00 - 19:0019:00 - 00:00

12:50 AM
Hi! Um has anyone used github.com/cryzed/Selenium-Requests?
Selenium Requests?
I'm trying to use GET to read a page, but all I get back is a 200 response code.
while(substring not in response):
                response = self.browser.request('GET', pageurl)
response is just a constant 200
How can I um, get the actual page/value on it?
 
 
2 hours later…
2:33 AM
cabbage
 
3:05 AM
recbg
@Annabelle what's the type(response)
@Annabelle also: dir(request)
 
You mean retag-pls?
 
 
1 hour later…
5:16 AM
is 'cargo-cult' a polite way of describing people copy pasting something en masse?
 
No, cargo-cult is always derogatory
 
totally misunderstood it then, thanks!
 
5:37 AM
and I misunderstood your question, apparently
 
So it's possible to do cargo cult coding without literally cutting & pasting. The key factor is putting stuff into your code that you think you've seen somewhere with no real understanding of what it does.
 
blind cut/pasting is basically a subset of cargo-culting, then, by my understanding
 
wim
not really
'cargo cult' comes with an implication that the <way of doing the thing> is already common practice, and it persists just because its a common practice - and not necessarily because it is the best way or even a correct way. hmm, it's kind of hard to explain.
 
the way I've seen it used the focus was on a lack of understanding on the user's part
 
This is closely related to "magic incantation" coding, where statements / blocks of code are used without a clear understanding. Eg doing ,import tkinter and from tkinter import * in the same program.
 
wim
5:46 AM
it's like those "I'm with stupid" t-shirts
 
@wim don't you have a tattoo on your chest that says that?
 
wim
you're violating the be nice policy and i'm gonna write a blog post about it
 
uh-oh
 
wim
ᴏʟᴅ ᴘᴇᴇᴅ, what context did you see "cargo cult" in?
 
I'm reading up on setup.py, and I came across this repo which quoted Guido mentioning something about cargo culting setup.py
(3rd para)
 
wim
5:50 AM
hah
I could have guessed it was about setup.py
 
guido wouldn't be wrong; i would almost certainly have added one to my project despite the fact that it's not for packaging or distribution (the same internal use thingy we were talking about the other day)
 
wim
this is the worst thing for cargo culting
 
(contd)...had i not known better
 
wim
if you copy anyone's setup.py, don't copy kenneth reitz's.
 
phew, it has a few k stars
apparently 2k odd people disagree
 
wim
5:52 AM
nope
that's just the kennethreitz effect
 
yesterday, by wim
avoid cargo cult
 
wim
he could take a purple crap in an ice-cream cone and it would be starred 2000+ times.
 
ah, I see he's the guy who developed requests
 
purple is in this year
 
wim
yeah
 
5:54 AM
Guys, I'd really appreciate your advice on best practices for a project structure. I'm currently looking at github.com/pypa/sampleproject. I assume all tests go in the tests/ folder. If I have multiple components to my project, they each get their own folder in the top level directory. Am I good so far?
 
wim
this one is sadly outdated
 
I don't believe I will need to distribute my project, but I would like for someone to be able to setup all the stuff required to run it easily. Does this still warrant a setup file?
 
wim
yes
 
@wim any suggestions/recommendations for a good-to-follow example? Really starved for a good resource
I don't want to yam this up
 
wim
I can write you one now, it's trivial
 
5:57 AM
wow, I mean, nothing like it
 
I was going to joke about consulting with wimcorp, but you even get it for free
 
this is master right now, it is a dumpster fire
(please don't laugh, it was a collaborative effort to start the fire)
 
wim
$ tree my-proj
my-proj
├── requirements-dev.txt
├── setup.cfg
├── setup.py
├── src
│   └── mypackage
│       └── __init__.py
└── tests

3 directories, 4 files
contents of setup.py should be:
from setuptools import setup

if __name__ == '__main__':
    setup()
 
awesome. Couple of questions. Does it matter that it's requirements-dev.txt and not requirements.txt? Also, can I ditch the src folder and just have multiple top level sub-modules? They likely will not be related (although that may change)
Also, to prevent being a cargo-culter, what does that bare setup() do?
 
wim
it's because metadata for your package can go in setup.cfg these days, follow the setuptools docs for the syntax (it's .ini style).
list the development requirements (stuff like pytest, coverage, even nice-to-have things like ipython) you want in requirements-dev.txt. that's for you, or other maintainers, not for your app/lib.
the app/lib requirements go into setup.cfg. you probably don't need a requirements.txt, unless you have a complicated deploy and need to pin specific versions.
 
6:04 AM
this ties in with "don't put dependencies in requirements.txt", right?
right.
 
wim
yes. don't.
 
okay... I've followed till here. Now, say my app has a complicated requirement, like the installation/download of some non-python tool like coreNLP or apache tika. How would I specify a dependency like that, or have it automatically installed via setup?
 
wim
you can ditch the src folder but I wouldn't recommend it. the isolation it provides during test execution is nice.
 
I imagine src itself does not need to be a module
 
I don't see an __init__.py there
 
6:07 AM
just checking, o big brain
 
It could still be a namespace module? It probably isn't
this also implies that the module can't be imported locally but has to be installed first, right?
 
wim
src is intentionally not a module. call it "potato" or anything. the name is irrelevant (as is the name my-proj).
@AndrasDeak yes.
 
then I think I understand the gist of it
 
wim
if you put your package up one level, it is still importable because of that annoying empty string as first element of sys.path thing
 
yeah
 
wim
6:09 AM
you don't want your package importable from ''. you want it importable from site-packages.
 
hmm, wouldn't './' cover it anyway?
oh there's no './', that explains it
but then you wouldn't be able to import foo when foo.py is just a file right next to you, right?
 
I think the check for the file in the same directory is done by the interpreter even before it looks at sys.path
 
ooop, tutorial time
@cᴏʟᴅsᴘᴇᴇᴅ and if that's the case does that not cover a module in the same directory?
 
wim
@cᴏʟᴅsᴘᴇᴇᴅ the nicest way would be to make a .whl file for those deps, and then just add that as a dependency like any other dependency.
 
I'm just curious and clueless
 
wim
6:12 AM
a .whl file is just a .zip, by the way. it has some extra metadata that says where the stuff should be unzipped to.
 
@AndrasDeak I think it would work for modules the same way.
@wim of course, the whl does not go in my GitHub repo, I instead upload it somewhere, and have setup download as required?
 
wim
yes
the reason that's the nice way is you don't want to go compiling C code and stuff on each and every install
you want to compile it once-per-supported architecture
 
okay, I imagine that's how spacy, nltk and so on install their language models as well. I have more to read up on now
 
wim
the install should just be a download and extract
 
@AndrasDeak I understand that sentiment :'(
 
wim
6:16 AM
otherwise, users installing will need to have development headers, c++ compilers, blah blah blah ..
 
certainly, it makes sense.
thanks for your help. I'll work at this some more in the morning.
 
wim
bye
 
6:47 AM
cbg
 
cbg
 
7:06 AM
cbg
 
7:46 AM
time to make a sales pitch for my self-answered grouping Q&A
 
8:20 AM
cbg
 
recbg
 
8:52 AM
going to do a hip hop song with cbg
 
9:05 AM
brought to you by the new rap formation, the savage cabbages
 
9:25 AM
Hey Python People!
 
cbg shrek
 
cannabigerol?
sorry I ahve no idea what that means 😃
ah in rules cabbage
Neat way to enforce reading rules line by line
 
welcome
 
9:44 AM
I am trying to write a python runtime for a FAAS layer as a learning project, since I don't want people to be locked into either flask or cherry py or any other framework, I was wondering if there is a lower level API that could be used to abstract out the context passing logic to the python script that it'll run
or is writing a wsgi server my only option? I mean a wsgi middleware does sound like an ok option
*wsgi server -> wsgi middleware
 
if you don't want to be locked into flask etc, you'll be locked into the abstraction layer you wrote instead.
 
That is what I am trying to avoid, I guess WSGI is the most common solution here for context, the provider supports first-class node.js and since its using base http server in node mode application frameworks support ways to add support for it.
 
yeah, WSGI is the common API in python
 
10:21 AM
Cabbage
 
Broccoli!
 
All brassicas are welcome here, we don't discriminate. ;)
@ShrekOverflow Well spotted.
Cool username, BTW. Another option would be Shrek Ogreflow. :)
 
=D I missed those puns
 
10:42 AM
wup pythons
does anyone know a way to get models in tensorflow without acces to imagenet?
 
11:34 AM
is there any difference between installing virtualenv through apt and through pip?
I just found something on SO about it
 
if you install through apt you probably can't do python -m venv ...
 
pip throws connection error when I am trying to install packages using pip behind a proxy server. I have followed the steps mentioned in the answer to this stackoverflow.com/questions/19080352/… but still am getting exception when it is trying to make a socks connection. But I can access pypi.org through the browser behind the same proxy server
Can somebody help.. Thanks in advance
 
11:52 AM
@Arne you probably can but only with system python
@varshaneya did you read all the answers? One says the syntax changed
And there are other suggestions too
 
@AndrasDeak wup wup
 
Wup? I think?
 
12:35 PM
@AndrasDeak I will try it out. Thanks for pointing it out.
 
Hmm I think the side project I was working on yesterday will go on hiatus until js introduces operator overloading
Not really interested in doing multivariable arithmetic looking like a.plus(b).times(c.minus(d))
 
@Arne Another reason to set your default values to None: Your function works out-of-the-box with argparse.
def greet(greeting=None):
    if greeting is None:
        greeting = 'Hello World'
    print(greeting)

parser = argparse.ArgumentParser()
parser.add_argument('--greeting')

args = parser.parse_args([])  # no arguments; use default greeting
greet(**vars(args))  # output: Hello World
 
Getting the context back took me a while =D But that's also what I stuck with. Only downside is that it makes typing a bit more complicated.
 
I guess we could do with a canonical for stuff like this. I guess it's a bit confusing to see comparison operators being used on sets. OTOH, if people read the docs of the standard types...
 
Hmm, good point. Never considered the implications for type annotations.
 
12:49 PM
def add(a: int, b: int=None) -> int:
    return a + b
# IDE is fine with this, but mypy assumes that it is an optional parameter now =/
tmp.py:3: error: Unsupported operand types for + ("int" and "Optional[int]")
Didn't find the correct setting to mute that kind of error yet, mainly because it's currently not an issue in prod code
 
Huh, mypy doesn't report that error for me, it silently lets it pass O.o (using mypy 0.590)
 
0.600 here o.O
can reproduce, it passes with 0.590 lol
 
time to upgrade
It's right though. That is an error. If you add an if b is None: b = 1, it goes away.
 
nice. I guess it's never an issue then
 
o/
 
12:59 PM
ᶜᵇᵍ\o
 
1:22 PM
@Arne won't that be a runtime error ?
 
@ShrekOverflow what exactly do you mean?
 
int + NoneType, or are you using this just as an example
 
Do we have a dupe target for "why isn't my web scraper picking up page elements that are dynamically created by javascript?"?
 
I was wondering why you didn't do it yourself, then remembered the dupehammer
 
1:36 PM
cabbage
 
for some reason SO refuses to implement tag hierarchies, so here we are, manually retagging ~50% of all new questions
 
Implementing tag hierarchies: 100 dev hours. Making the proles do it themselves: 0 dev hours.
 
@ShrekOverflow Just an example. It occurs naturally with mutable parameters, where we don't want to pass falsey defaults.
 
Maybe mypy knows that ints are immutable and so it doesn't recognize that idiom in this context
 
1:52 PM
I think I'm missing something here, but I'm looking into how I (should be) handle relative paths in my project. I want to use a relative path in a module that will point to the same location when run directly or when imported. Can/should I do this, or is my thinking wrong?
 
As in, you have some module widgets.py in some directory myWidgetProject, and you want to access some resource, let's say a text file, in myWidgetProject/resources/stuff.txt, by doing open("./resources/stuff.txt")? I don't think that would work if you're importing widgets, since the current working directory won't be myWidgetProject.
Unless the thing that's importing widgets also happens to be in myWidgetProject
Maybe you could do, like, open(os.path.join(os.path.dirname(__file__), "resources/stuff.txt")), but then you're not really using relative paths any more. And any way, I don't know if that's the idiomatic solution
 
2:08 PM
Structure is something like this:
project_folder/
    main_script
    input_parsers/
        scripts_for_handling_inputs
    output_generators/
        output_scripts
    generated_output/  <- default save file for output
I haven't written main_script yet, but I'm working on an input_parser and an output_script. To do this I'm demoing in main of the output script, calling the input parser, and wanting to save output document to the generated_output folder. I can hardcode it, but I expect to be installing the project, and calling the output_script from elsewhere (probably the parent directory where main_script is).
Is this something where I should be working out the abspath of the caller (which is probably in the uppermost parent directory, and working down from there, rather than doing this work in the imported module?
 
Like, trying to derive the location of generated_output, given only the absolute path of the thing that's importing widget? No, I don't think that's a useful approach, since the thing importing widget could be literally anywhere on your hard drive
I want to say "this is probably difficult because it's not normal to save mutable data in your project directory" but I've formally deployed like three Python projects ever so I honestly don't know what's normal
Perhaps your demo output document saving function could accept a file parameter. Then it's the caller's responsibility to choose where it ought to be saved (if anywhere; he could use StringIO if he liked, and then you aren't touching the file system at all).
 
Well, I imagine it's going to be main_script that's doing the importing, or at least starting whatever's doing the importing.
Should I be creating a default save place outside my project directory? I was sorta thinking about double-saving so that user could save/print however they like, but the program would have a record of previously created documents rather than relying on user to actually be competent.
 
2:26 PM
I mean, some programs do save their data in, like, c:\users\kevin\appdata\roaming\MyCoolProject, which is very much not where MyCoolProject itself resides.
 
It's plausible I'm overthinking/prematurely optimising/out_of_my_depth.
 
I think it makes sense to either 1) have the saved data directory inside the project directory, and you access it with the __file__ approach I described earlier; or 2) keep the saved data directory in whatever is the equivalent of the AppData folder for your OS
I don't think it's a good idea to do 3) creating a default save place somewhere other than 1 or 2
Hmm, the way docs.microsoft.com/en-us/windows/uwp/design/app-settings/… describes the intended usage of App Data, it does sound like you could justifiably put a "previously created document history" thing in there. But I think it's supposed to only be used by "apps", which a python script is not
 
Ironically, a bunch of apps' default location is 3 (including some git clients, PyCharm). I don't even know how to do 2, and definitely not in an os agnostic manner.
 
python-packaging.readthedocs.io/en/latest/non-code-files.html seems to indicate that approach 1 is not unprecedented
> Files which are to be used by your installed library (e.g. data files to support a particular computation method) should usually be placed inside of the Python module directory itself. E.g. in our case, a data file might be at funniest/funniest/data.json. That way, code which loads those files can easily specify a relative path from the consuming module’s __file__ variable.
 
@AnttiHaapala That doesn't seem to work. :(
Neither gives me what is on the page.
 
2:42 PM
I feel considerably more comfortable endorsing the __file__ approach now that a second person mentioned it as a possibility
 
@Annabelle they aren't supposed to give what's on the page but to show the type of the response / the member names of the response
 
@Kevin Is it still not if you make it into a .exe? I'm trying to build something for my wife that generates worksheets/tests, randomising questions from a set (because kids cheat).
 
since I cannot reach the same body of water by which you're located, nor can I give you the fish, I am just giving general information on how to fish by yourself :D
 
Well type(response) didn't do anything but dir(response) gave this:
['attrs', 'bool', 'class', 'delattr', 'dict', 'dir', 'doc', 'enter', 'eq', 'exit', 'format', 'ge', 'getattribute', 'getstate', 'gt', 'hash', 'init', 'init_subclass', 'iter', 'le', 'lt', 'module', 'ne', 'new', 'nonzero', 'reduce', 'reduce_ex', 'repr', 'setattr', 'setstate', 'sizeof', 'str',
'subclasshook', 'weakref', '_content', '_content_consumed', '_next', 'apparent_encoding', 'close', 'connection', 'content', 'cookies', 'elapsed', 'encoding', 'headers', 'history', 'is_permanent_redirect', 'is_redirect', 'iter_content', 'iter_lines', 'json', 'links', 'next', 'ok', 'raise_for_status', 'raw', 'reason', 'request', 'status_code', 'text', 'url']
 
so how about then response.text
 
2:45 PM
@toonarmycaptain Let's see... Apparently Windows apps have the .appxupload extension. At least before you get them onto the Microsoft Store.
I'm now wondering whether the __file__ approach even works if you use py2exe and friends on your project... I'm going to guess "no, because the directory isn't there any more"
 
Oh that worked! @AnttiHaapala Thank you!
I'll have to remember that for the future
 
A super smart module-to-executable program would do some real cool sleight of hand to make the script think it's still in its usual environment. I don't expect any existing module-to-executable programs to be that smart.
 
@Kevin Oh, well nevermind bothering to do that then. I plan on bundling a venv with the package anyway, but that's way in the the future.
 
mornin' folks
 
re-cbg
 
2:56 PM
I mean, it's worth checking if py2exe does have support for local file reading/writing. I just don't think it's enormously likely.
 
Hmm, I didn't realise file in the imported module would still return the path of that module, rather than the caller, even when the function it resides in is imported and used by another script. That might be by which regard my currents turned awry.
 
I asked a grateful OP to consider accepting my answer, complete with a link to the relevant meta page about accepting. Their reply:
Have done it long back. Thanks again — Perl 2 hours ago
 
He accepted you within his heart
 
@Kevin I just assumed making an .exe might be simpler for portability (so my wife can say "here, install this"), but I'm assuming a setup.py, (even, if necessary if called by a short .exe and unpacking a short .exe runner that runs the installed project) would work equally as well.
 
@Kevin It's nice to be appreciated, but it ain't no green checkmark. :)
 
3:01 PM
Currently annoyed at Python multiprocessing slower than single, which claims that his two approaches run in 2 and 8 seconds, when in actuality I'm pretty sure they both crash
Does multiprocessing suppress stack traces? If so, I guess OP could simply be unaware that his Pool doesn't work. No excuse for the single threaded approach, though
 
@Kevin But how quickly do they crash?
 
Ah, I'll know the next time I want Kevin to answer my question, I'll pose as another Kevin to post it
 
@toonarmycaptain The single threaded one crashes faster :>
Somehow over time I've gone from "I hope my insights earn me some points" to "I hope my insights cause OP to self-delete with mild embarrassment since I yanked at a loose thread on their question and it unraveled completely"
In this way, un-asking questions is more fun than answering them
 
that's evil... I love it
 
Now, the aim of the exercise is still for the OP to walk away knowing how they should proceed with their project. If they self-delete because they think that I'm just being an unhelpful jerk, and they're still stuck, that doesn't count as a win.
 
3:10 PM
You'd think he'd notice that random.shuffle shuffles in place, and as is conventional for such functions in Python it returns None...
 
Unpopular opinion: I think quite a few functions that currently return None should instead return the object they're operating on.
 
If I agreed, I'd never say so.
 
I feel bad every time I inadvertently click on 2.x documentation from google. I want to go back and say no, that was an accident, don't bump it in search results please.
 
oh I didn't cbg in yet, oops, cbg \o
 
Same, but for W3schools
2.X docs I'm willing to click on, but I want the page to have the same styling as Windows 3.1's Hot Dog Stand theme, so I know I'm using a relic of the past
 
3:15 PM
cbg
 
Returning the object you mutate is such a java thing...
 
@MooingRawr CBG!
 
@Code-Apprentice cbg
 
Can we just have tkinter.widget.pack() return the widget instance? That's the only one I really need.
That will reduce the question activity on the tkinter tag by like 50% overnight
 
cbg code :D
 
3:23 PM
@Kevin I'd be happy with that, and of course the same for .grid(). .place should raise NotImplementedError, or something. :)
 
Hear hear
 
Multiprocessing Kevin has edited his code. Unfortunately, I can't help him since I don't know the multiprocessing module.
 
@wim what's a good place to put data? Inside src? Or do I have a dedicated TLD called data/?
 
3:50 PM
@Kevin Sometimes I miss Win3.1
 
3.1 is a bit before my time. I miss the maze screensaver from 95.
I miss the version of Excel that had a spy hunter easter egg
 
@Kevin I don't remember that one. I remember the one with Flight Simulator.
 
I also remember the flight simulator.
The ocean undulated in a quite unsettling way
Oh, there it is in the related video sidebar. Trip down memory lane.
 
@Kevin Gee, way to imply I'm old, in addition to being inadequate :p
 
I don't think of anyone in here in terms of age. We are beyond such trivialities.
 
DSM
4:04 PM
Friday get-off-my-lawn cabbage for all!
 
4:15 PM
Cbg again room 6 :D
 
age is just a number!
 
DSM
Too large a number. :-/
 
well, if you want another trip down memory lane, there's this song: youtu.be/2WPCLda_erI
the staple of youtube 2010 tutorial background music
the typing-in-notepad types... "hey guyzzzz!!!1" (followed by rapid backspacing)... and so on
 
4:52 PM
today I will show u how to intall^H^H^H^Hstall runescape hacks
 
I usually close out any Youtube tutorial in the first 1.5 seconds so I'm not aware of their typical background music
 
5:13 PM
quick google didn't come up with anything, is there a built in numpy function similar to numpy.array_equal or numpy.array_equiv that compares if an array is the "equal" in terms shape and values just rotated or flipped (using np.rot90, and np.flip).
 
DSM
85% sure not.
 
example [['1' '2'] ['1' '1']] and [['1' '1'] ['2' '1']] would yield true but [['1' '2'] ['1' '1']] and [['1' '1'] ['3' '1']] would yield false
hmm okie then, I guess I can built a function that does the manual rotation and flips. Thanks :D
 
DSM
There might be some weird ndimage thing, but I never use those modules so I can't be too confident.
 
Something like any(np.array_equal(x, np.rot90(x, i)) for i in range(1, 4))?
 
yeah... but now add flip to the combination I guess I can built off of that
 
5:28 PM
I've done something like that in the past, when I was doing caching on a minmax function for... Othello, or something like that.
I wasn't using numpy so I don't know if they have a thing for it.
I wrote a method canonical_form() which looked at all the possible flips and rotations of a board, and decided which one was the "truest" way of representing the data
Not that some kinds of Othello boards are more true than other ones, so I think I just picked whichever had the smallest hash.
Then I could tell if two othello boards were equal-ish by doing a.canonical_form() == b.canonical_form()
 
DSM
"Truest" like lexicographically smallest when read in some order or something?
 
Yeah, that would work.
Interpret the board as a sequence of trinary digits, empty = 0, black = 1, white = 2, then convert to integer... Something like that.
 
@Kevin I've done that sort of thing when working with Game of Life patterns.
 
Woe be to you, though, if two possible candidates have an identical hash
 
Then you just have to compare the actual data.
 
5:36 PM
Even if you're lazy like me and leave it to chance, you're only comparing at most eight values, so the birthday paradox won't get you or anything. Uh, I think.
 
Hey, I 'earned' the Yearling badge - has it been a year already?
 
Member since 2017-04-30 04:01:46Z. Checks out.
 
5:53 PM
@Kevin Certainly noone in here would believe I spoofed my userdata.
 
If you snuck into the SO server room, Mission Impossible style, and changed your reg date, then you deserve the badge anyway. Enjoy
 
6:08 PM
Hi guys, need a little help here: dpaste.com/2B2KSQ8
Getting error: ImportError: No module named config
Did some research and it should work
I also have init.py as well
 
@Damon: Are you sure api.py is running on the computer you think it is, under the same filesystem you think it is, not in a chroot or anything, and with permission to read config.py?
 
wim
if config gets imported somewhere else, earlier, you will see that
 
perm are root root
that might be the issue
 
wim
it's poor form to modify sys.path directly from within the runtime, because it makes import ordering matter
 
fixing perm did not fix issue
 
wim
6:13 PM
@cᴏʟᴅsᴘᴇᴇᴅ You can do either. If it's data that will be included along with an installation, I prefer it included alongside the package, rather than at top-level. If it's data you just need for tests, keep it out.
 
I don't know why its not working ...
With this import I think even init.py is not needed
 
stackoverflow.com/q/50180644/1222951 dupe of stackoverflow.com/questions/1701211 help a struggling hammerer fix their mistakes :( thanks
 
@toonarmycaptain pineappple!
 
@wim only tests. so it goes into data/ in tests or data/ at the top?
the latter, right?
 
Should I bother adding the python tag to this? I kinda want to close vote it, but I'm not sure what close reason to use... stackoverflow.com/questions/50180360/…
 
wim
6:21 PM
I would probably put it under tests subdir
 
@Code-Apprentice Melon.
 
okay, so here's a bit more info. The project actually consists of two main portions. One portion is static, mostly utilities that communicate with AWS and other NLP logic. Another part will use the utilities from part 1 to run a simulation over a lot of data.
 
@toonarmycaptain did you have to look that up? I would because I'm not very fluent in salad.
 
so the data I spoke of will not only be used by tests, but by part 2
 
Avocado *nods*
[Although not with a lot of effort: when I enter 'sal' into the browser, it autocompletes...]
 
wim
6:23 PM
if it will not be installed in a distribution, it's immaterial where you put it. you will make a pytest fixture which locates it from a path relative to the conftest.py file in which the fixture is defined.
 
After taking your advice, my project structure looks like this:
my_project
├── README.md
├── docs
│   └── DynamoSetup.md
├── requirements-dev.txt
├── setup.cfg.txt
├── setup.py
├── something_that_is_run_once
├── something_that_uses_src_a_lot_but_not_part_of_src
├── src
│   ├── submodule_1
│   ├── submodule_2
│   └── utils
└── tests

8 directories, 5 files
I'm not sure what to do with the something-* folders.
 
wim
setup.cfg is a magic name. don't use setup.cfg.txt.
 
whoops, that was a mistake
I still have to fill in the blanks and make sure nothing is broken. I have been at this since morning (though still unsure of those last 2 something-* folders)
 
@toonarmycaptain I guess I haven't visited that page enough for chrome to bring it up for me
 
cbg
 
Do tests/ include unit tests as well as black box tests?
 
I usually keep them in tests/ and use prefixes like test_modulename for unit tests. For blackbox tests I guess you could do test_(black box operation).py
 
typo, I guess stackoverflow.com/questions/50180999/… It has an upvoted answer, but I guess in this case it's warranted. :)
 
I really like WSGI 😃 so elegant!
 
wim
6:48 PM
I don't know what black box tests are.
 
Should I keep classmethods and staticmethods at the top or bottom of class definition?
 
wim
Are you talking about integration testing? tests which need network activity/interacting with other components which are not mocked out.
 
Is there a preferred style?
 
wim
@Ajit no. it doesn't matter.
the preferred style is to not use staticmethods at all, they are more or less useless and can just be a module-level function.
 
Ok. I see
 
6:52 PM
@wim err, I mean something that tests the entire system from end-to-end.
 
DSM
Some of us like them well enough to provide different constructors. If I have something which fits naturally as a staticmethod, I'm not going to put it somewhere else just because I can.
 
The only thing that can bump __init__ from the top of my class definition is __new__
 
00:00 - 19:0019:00 - 00:00

« first day (2757 days earlier)      last day (2190 days later) »