« first day (4902 days earlier)      last day (40 days later) » 

1:13 PM
@MisterMiyagi haha yeah, I worked with nvidia code and since then I claim that they are overvalued. But in the end that's the nice thing about the market, you can talk as long as you want, if you don't short it, you don't believe what you say. And I guess I'm an all talk, no shorting person :P Or I am right, but my risk preferences are just way too low
 
 
2 hours later…
2:58 PM
stackoverflow.com/questions/78180877/… is kind of a weird error that stumps me.
 
@paul23 well, how did you run it without asyncio.run?
Did you just turn def get_count_async into async def get_count_async and inside that await self.aget_count_async(...)?
 
3:31 PM
see the comment :) - and the tag of dajngo rest framework.
 
Does django automatically run async def functions as async? The error suggest it doesn't.
 
Well the error is just an assertion on the types, not really a "ducktype" error
 
3:47 PM
I'm not entirely sure what you mean by that. The error is telling you that instead of calling a regular function, an async function was called and then never awaited.
The Response is inside that called async function, but you don't get it unless the function is awaited.
 
I don't understand this close reason (or the downvote). How could I add more details? The vague warning in the documentation is all I have to work with.
-1
Q: Why might `runpy` leave functions or classes in an incorrect state?

KodiologistThe documentation for runpy warns "…any functions and classes defined by the executed code are not guaranteed to work correctly after a runpy function has returned." Why is that? If they functioned normally during runpy execution, what might happen after runpy returns to make them go awry?

 
@Kodiologist Sorry, I have no idea why some curators misuse close reasons like that. votes to reopen
 
Thanks.
 
I've also given the question a bit of an edit. Some folks interpret "why ..." questions very badly as well.
 
4:03 PM
I feel like Stack Overflow is a bit more close-happy than it used to be.
 
@Kodiologist SO, is on it's downfall, long gone are it's glory days
 
@Kodiologist you get the response outside the async. the "outer" scope however is waiting for the inner scope - by using asyncio.run() which is what you should do to run an async context from a synchronous context.
@Hakaishin whereto next though
 
@paul23 Sorry, I'm not following which code version you are talking about. If you define async def get_count_async then it should not contain asyncio.run.
 
Hello, is it common to use relative imports once development is packaged?

I was unable to reach modules without switching to relative imports but that seems to have broken pytest
I understand tests shall not import package (unless they test package itself) but access files with absolute or relative imports
 
@Aran-Fey This has turned out to be a great idea, thanks. Instead of importing all the XyzAbcAlphaOmega types all into one namespace (where they needed to be disambiguated) and shuffling data to them there, I was able to turn them all into self-validating factories. One mega-file has now turned into just a dozen lines of code to load some generic EntryPoints pointing to as many factories as I need.
@aeiou Eh? My tests always import the package, just like users of my package would.
In your own words, what is the difference between "import package" and "absolute or relative imports"? An absolute import would also reference a package, that's what makes it absolute.
 
4:21 PM
@MisterMiyagi Do you then need to create and install a package before you can unit test any change to the package?
 
I usually install them in editable mode, so somewhere between yes and no. I need to install them once and can then repeatedly test them even when changes are made.
 
So packaging becomes a pre-requisite for testing?
 
If you don't have a src setup or don't mind setting PYTHONPATH, you wouldn't beed packaging either. Though it's very simple these days...
 
I follow src layout
I understand that once you start packaging, unit tests shall import the package, ergo you need to reinstall package to unit test a change
Without packaging, it is much simpler as you access a specific file from local repository
 
Are you aware of editable installs?
@aeiou I'm wondering... the point of src layout is to not access the local files directly. Why do you use src but then access the files directly anyway?
 
4:25 PM
@MisterMiyagi to separate source from ci setup or tests
@MisterMiyagi i came across this, since you mention it i guess this is a good way forward
does it then mean that ci pipeline triggered on change will not only need to install external modules but also new package itself with which it runs unit tests? so package becomes dependent on itself?
 
I'm not sure what you mean by that. The tests/CI depends on the package, that doesn't mean the package depends on the package.
 
i mean ci is running unit tests and unit tests depend on the package. then, does not the new version of package need to be installed in environment where ci runs?
 
Unless you run your CI locally, erm, yes? That seems to be always the case - the CI can only test your package when it's actually there.
 
It does, but how that'd be a problem?
 
ok, thanks for confirming. packaging then makes everything a lot more complex.
 
4:31 PM
Eh? I'm not sure where that came from.
How does your CI gain access to your code right now?
 
until now, i was not creating an installable wheel. so i just specified source code path in pyproject.toml and pytest was able to access the modules.
 
Making a package does not require wheels
You can install packages just from .py files just as well
 
sure, if running one additional command is too much complexity, then yes, I guess it's a lot more complex.
 
actually i do not get it. let's say i want to release a new version of software once unit tests pass. in order to run unit tests, i need to release the package and make it installable.
this is solved by venv? which creates virtually the package?
 
erm, no. You just install from source.
 
4:35 PM
so i do not need to publish it to pypi
 
no. oO
you can install from the local filesystem, git, ...
 
@Kodiologist I don't see much of a reason why the code would stop working. There are some things are temporarily modified (sys.argv[0] and sys.modules), so those changes could theoretically cause a crash, but in practice that seems extremely unlikely
 
@MisterMiyagi when you say install, you mean pip install package?
 
in a way.
you run pip install -e . from the package directory
 
but, this requires publication to pypi?
 
4:39 PM
Nope.
 
so the trick is pip install -e, to create a package from local directory, bypassing pypi?
 
pip install . installs from the local directory. -e makes that install editable.
 
last Q: this option does not add package to the folder with all imported packages in python installation directory?
it is sort of temporary package?
 
You mean "with all installed packages"? Yesn't. It creates a symlink or a .pth file there
But the code isn't copied there, so whenever you import it you get the latest version
 
thanks all, i find this difficult to reason about.
 
5:00 PM
@MisterMiyagi yes I am NOT using async def.. Using async def returns a coroutine - drf does a assertion that you are returning an actual value and not a coroutine
 
 
2 hours later…
6:41 PM
@Kodiologist voted to re-open; you're back in business. Also, I agree that that shouldn't have been closed as I also find the statement vague and I don't see what else you coudl take from that statement.
 
7:15 PM
Just added another 16 input fields to a web form that's now gonna take my code (across HTML, JS and backend validation) well over 2,000 lines, more like 2.5k. For one web form :'( . I feel like something has gone terribly wrong here
 
8:13 PM
I think that something is HTML and CSS
 
The base HTML and JS is taking up a good 1500 lines with fancy-pants dynamic values based on dropdowns etc. Select a currency -> every other field gets a new currency field in the form dynamically updates. Select a supplier -> Nope, I already know their base currency. But I am tempted to see whether I need a framework at this point because it's getting laborious in the extreme
 
9:03 PM
In separate news, it looks like Cisco and Splunk have merged. That's a pretty big acquisition
 

« first day (4902 days earlier)      last day (40 days later) »