|
I am currently overbrimming with the desire to beat Homebrew's python maintainers to death (with angry words). YET AGAIN, a random non python install just randomly upgrades python breaking the gently caress out of every goddamn virtualenv on my machine. People have been banging on about this being unnaceptable on variour homebrew related git issues for years, and ..... nothing gets done. The irritating thing is python has *multiple* methods of letting multiple pythons co-exist. Theres no need to uninstall the old versions.... Gah... At least a warning that "Hey this package will destroy your dev environment, just so you know" and an option to pull the eject lever..... < / rant >
|
# ? Nov 17, 2020 04:48 |
|
|
# ? May 22, 2024 17:52 |
|
Fork.
|
# ? Nov 17, 2020 05:48 |
Use pyenv on OSX imo
|
|
# ? Nov 17, 2020 09:48 |
|
duck monster posted:I am currently overbrimming with the desire to beat Homebrew's python maintainers to death (with angry words). As much as I used it for years and got my whole PhD doing work on a Mac Pro primarily with Homebrew...it is a trash package manager. You can pin a formula but the Homebrew rule that you can't build against outdated formulas really works against Python here. I don't think there is a good way to maintain Python on Homebrew as it exists when by rule you can't NOT upgrade dependencies. I believe if you pin a particular formula it will at least ask for confirmation before upgrading it. I believe you could also alias --confirm onto your brew commands to get it to behave more like a sane package manager by default. Use anything else to manage your Python environment on macOS, whether it is pyenv or conda or whatever else.
|
# ? Nov 17, 2020 15:38 |
|
I have kind of a dumb question about Poetry. The dir structure by default seems fine but I often find I need to put the actual app.py script in root level, e.g. one level above the main package that Poetry creates, because it's normal to write an app functionality as a package and then import it into the main script users actually run. For example I wrote a package that reads/writes JSON files, does operations based on the data, etc. Then I wrote a cli using Click and it is one dir above so it can import modules, classes, etc. from the main package. This cli doesn't have much logic, just an interface basically to the package. Anyway in the default dir structure that means your main.py or app.py is in the root dir, parallel to your module dir and 'tests' dirs. Does this seem weird? Should I be using the --src option and putting my root app there instead? Am I doing this wrong? Should my main app.py go in the same dir as the package? My intent is that anyone can use the functionality with whatever they want (e.g. run it in their own code, write their own frontend, whatever). But I might be actually unusual use case where I'm writing a lot of internal tools that need to be open in this way in case anyone wants to incorporate into CI pipeline for example. They can call the script or just import the package. But maybe having the main app / cli / whatever in the package would work fine too? I remember running into a ton of import issues and one point which may also have been related. But I try to use empty __init__ files and explicit imports so that I don't have to maintain the init files (I often use sub modules for my io for example).
|
# ? Nov 19, 2020 23:06 |
I use a src tree but just make a package directory and put your stuff in there. So alongside pyproject.toml you have app/__init__.py app/db/models.py app/cli.py etc. Always use absolute imports imo so import app.db.models or from app.db import models etc.
|
|
# ? Nov 20, 2020 00:17 |
|
OnceIWasAnOstrich posted:As much as I used it for years and got my whole PhD doing work on a Mac Pro primarily with Homebrew...it is a trash package manager. You can pin a formula but the Homebrew rule that you can't build against outdated formulas really works against Python here. I don't think there is a good way to maintain Python on Homebrew as it exists when by rule you can't NOT upgrade dependencies. I believe if you pin a particular formula it will at least ask for confirmation before upgrading it. I believe you could also alias --confirm onto your brew commands to get it to behave more like a sane package manager by default. I generally use Pipenv . But the work dev SOE is vanilla virtualenv. The problem in this case was that it actually somehow managed to break loving PyCharm which seemed to be packaged with a version of setuptools thats incompatible with 3.9. I ended up just going and manually rebuilding it. Unfortunately the Homebrew python maintainers are *really* uninterested in the problem , and its giving me flashback to the bad old days when Debian ruby maintainers would purposefully disable gem to encourage "correct package installation" (which apparently is "install everything globally via apt get and tough poo poo if your favorite gem isnt there, just grab a tar ball" Though my suggestion that they put a warning up that python developers should uninstall homebrew was perhaps a liitle on the trollish side, ill confess
|
# ? Nov 21, 2020 12:51 |
|
The homebrew maintainers also made it impossible to install older packages from a git commit, which you might want for development purposes, because in the Real World we have to use non-bleeding-edge software for compatibility reasons. Basically making it useless to developers. This is recent and they've been absolutely unresponsive and unsympathetic to the mess that this causes. It's not the "intended workflow", which they just changed without warning because they clearly don't care about how people actually use brew. It's always been garbage and now it's somehow worse than it's ever been.
|
# ? Nov 22, 2020 03:52 |
|
Trying to unfuck some code, for background I am going from python 2.5 to python 3.8code:
So I guess my question is, is the sub function calling the process_match function with the given 'string' variable as match or there some other black magic fuckery going on? If I only want the possible group match should I just do; code:
The caveat of working on this, is that this is for a template tag in django with nothing actually calling it right now so I have no fuckin way to test it without doing a fuckton more work and im just trying to work it out in my head but this code is so fucky its making my brain crap out.
|
# ? Nov 23, 2020 18:20 |
|
Jeesis posted:Trying to unfuck some code, for background I am going from python 2.5 to python 3.8 Well, the original appears to be passing the match object which is a lot more than just the string so I guess it depends what pre:process_butts I also don't know what string.replace is, if it was a method in python 2 it's gone in python 3. You could use re.sub or I think replace on the match object.
|
# ? Nov 23, 2020 19:00 |
|
quote:str.replace(old, new[, count]) Definitely a thing in 3.x.
|
# ? Nov 23, 2020 20:43 |
|
Phobeste posted:Well, the original appears to be passing the match object which is a lot more than just the string so I guess it depends what Yeh I am not really sure what is even going on here but I think I have it somewhat working, at least it will import. Going to consult the person who wrote this as they still work here but my gently caress is some fucky nested bullshit fuckery. There is a 30 line comment trying to explain just how the regex blob that unfurled to 79 char lines is 7 lines long works
|
# ? Nov 23, 2020 21:06 |
|
I'm currently making a game with pygame, and it's going okay. I'm enjoying the experience anyway, having not programmed at all since university and never in Python. It's 2D space combat game, made to mimic the sort of combat you see in The Expanse - namely, realistic physics, vast distances, and the ship doing a lot of the heavy lifting with the player mostly just giving the ship commands. One mechanic I'm working on right now is getting the ship to move through a coordinate. So far I'm only focused on getting it working from standstill so the ship's current velocity doesn't need taking into account, and so far I've got the ship finding a target 'rotation', spinning the ship to that rotation, then engaging thrust. Mostly working okayishly except with shorter distances. What I'm wondering is, since the game will have a lot of systems like this and largely be based around the 'ship computer' calculating correct angles, thrusts, velocities etc., would I potentially be better off working with PID instead, and simulating this in the game? If so, what's the best way of doing that? I'm assuming there are modules for PID control but honestly I'm not sure if it'll be necessary or not? I'm leaning towards it but it being better but obviously it does increase the complexity of things somewhat. That said I did work with PID a fair bit during my undergrad and wouldn't mind refreshing those skills.
|
# ? Nov 23, 2020 21:07 |
|
Loezi posted:I'm reading up on coroutines but getting tripped over by what's the current preferred method of doing stuff. I interpreted that deprecation warning as meaning that use of generator-based coroutines for async/await will be deprecated. This test still works on the 3.10 alphas: Python code:
duck monster posted:I am currently overbrimming with the desire to beat Homebrew's python maintainers to death (with angry words). This is because Homebrew's popularity is the result of trends and not because it is a superior package manager. Try out Macports or Fink.
|
# ? Nov 27, 2020 19:29 |
|
Maybe this is more of an AWS centric thing than a python issue, but I'm having some trouble when working locally with Lambda Layers in my SAM/Python Lambda project. I put my layer code in "/layers/python/example_layer.py" while my lambda lives in "/lambdas/example_lambda/example_lambda.py" and I import the layer using "import example_layer" in my lambda. SAM managed to deploy both just fine, and it works as expected in AWS, but on my local machine pylint does not like the import statement (unable to import example_layer). I figure that SAM packages layers correctly as long as they're in a folder named "python", but maybe python needs the layer code to be below the lambda code in my folder structure for it to be found when working locally. I can't really move it though, because I have more than one lambda, all in their own separate folders, and duplicating it would sort of defeat the point of a shared layer. Suggestions?
|
# ? Dec 3, 2020 16:03 |
|
I have the following code I whipped up just out of curiosity:code:
code:
|
# ? Dec 9, 2020 18:50 |
|
edit: it's the len(str(x))
mr_package fucked around with this message at 19:52 on Dec 9, 2020 |
# ? Dec 9, 2020 19:49 |
|
ooooh, I didn't even think that would be a serious issue
|
# ? Dec 9, 2020 20:03 |
|
Epsilon Plus posted:ooooh, I didn't even think that would be a serious issue Yep, creating and working with massive Python strings is definitely going to add a lot of overhead compared to simple integer or even bignum math. Depending on what you are curious about, using log10 gets you the same info without that particular performance hit although with exponentially-increasing bignums you'll hit some performance problems soon enough anyway.
|
# ? Dec 9, 2020 20:25 |
|
I just had a student a while back ask me about the maximum integer size in Python, I told her "there's not really one" and she was interested in the implications of that - I literally whipped it together in like ten seconds and threw in len(str(x)) just to indicate how big the numbers would get. Using math.log10 is way better, I'm just a math idiot and didn't realize that was a possibility.
|
# ? Dec 9, 2020 20:31 |
Yeah python is good at a lot of stuff but Ive run into it being bizarrely slow with a lot of string ops.
|
|
# ? Dec 10, 2020 12:13 |
|
That's converting an int to a ~600kb string.
|
# ? Dec 10, 2020 21:59 |
|
yeah now that I realize the nature of the issue I'm sure that taking a very, very, very large number and converting it into its string representation is going to be at least a little time-consuming
|
# ? Dec 10, 2020 23:00 |
|
My computer sure did some interesting stuff when I tried to create a ~5 GB string from a list and write it to a text file all in one go. Only made that mistake once.
|
# ? Dec 10, 2020 23:25 |
|
Anyone use Jupyter notebooks? And if you were to interview someone on their knowledge of them, what would you ask? I have a call coming up focused on Python and notebooks and it's been years since I used them so I don't know the cool new features or popular libraries (outside scientific computing)
|
# ? Dec 15, 2020 04:53 |
|
Analytic Engine posted:Anyone use Jupyter notebooks? And if you were to interview someone on their knowledge of them, what would you ask? I have a call coming up focused on Python and notebooks and it's been years since I used them so I don't know the cool new features or popular libraries (outside scientific computing) I really like notebooks and I hire SW people to write python code. We actually have a "production" (runs nightly with nbconvert) bit of code in a notebooks, I love them that much. I can't imagine quizzing someone on how to use an incredibly simple to learn tool though. This might help tho: https://www.youtube.com/watch?v=9Q6sLbz37gk If you're the one doing the quizzing, prob don't.
|
# ? Dec 15, 2020 05:04 |
|
They may just ask you to do something in a notebook, that would be a straightforward test
|
# ? Dec 15, 2020 05:49 |
Analytic Engine posted:Anyone use Jupyter notebooks? And if you were to interview someone on their knowledge of them, what would you ask? I have a call coming up focused on Python and notebooks and it's been years since I used them so I don't know the cool new features or popular libraries (outside scientific computing) Probably worth making sure you know some of the 'magic' commands and introspection stuff: https://ipython.readthedocs.io/en/stable/interactive/python-ipython-diff.html .
|
|
# ? Dec 15, 2020 22:42 |
|
Thanks
|
# ? Dec 16, 2020 03:56 |
|
Analytic Engine posted:Anyone use Jupyter notebooks? And if you were to interview someone on their knowledge of them, what would you ask? I have a call coming up focused on Python and notebooks and it's been years since I used them so I don't know the cool new features or popular libraries (outside scientific computing) Except when how the plots are produced is essential, I find that notebooks tend to be bad for long term code quality. Results have been better when Ive pushed teams to get proper IDEs
|
# ? Dec 19, 2020 00:59 |
|
hhhmmm posted:Except when how the plots are produced is essential, I find that notebooks tend to be bad for long term code quality. Results have been better when Ive pushed teams to get proper IDEs Still thinking about this proud Netflix post: https://netflixtechblog.com/notebook-innovation-591ee3221233?gi=2d21ad3f17d6
|
# ? Dec 19, 2020 05:31 |
|
hhhmmm posted:Except when how the plots are produced is essential, I find that notebooks tend to be bad for long term code quality. Results have been better when Ive pushed teams to get proper IDEs Yeah this is the big pitfall of jupyter notebooks, it's easy to get results that are not easily reproducible or simply wrong if you're not careful
|
# ? Dec 19, 2020 06:07 |
|
QuarkJets posted:Yeah this is the big pitfall of jupyter notebooks, it's easy to get results that are not easily reproducible or simply wrong if you're not careful Its not a bug its a feature, the notebook will reproduce the results...it's code It also gives you the freedom to run things iteratively or out of order. I use notebooks to generate/analyze different metrics for our business, for example. I dont always want the same metrics and I frequently want to add new stuff that I wont always use.
|
# ? Dec 19, 2020 06:19 |
|
CarForumPoster posted:Its not a bug its a feature, the notebook will reproduce the results...it's code Right, nonlinear code execution is not a bug (I never said that it was) but it is a pitfall
|
# ? Dec 19, 2020 07:14 |
|
QuarkJets posted:Right, nonlinear code execution is not a bug (I never said that it was) but it is a pitfall It’s not a bug it’s a feature is a common quote and clearly I am disagreeing that it is a pitfall in many situations
|
# ? Dec 19, 2020 07:25 |
|
CarForumPoster posted:It’s not a bug it’s a feature is a common quote and clearly I am disagreeing that it is a pitfall in many situations That's kind of the definition of a pitfall though: something that is usually not a problem but can become one if you're either unaware or just not thinking about it. I use this nonlinearity feature too, I think most notebook users do because it's very useful, but it's absolutely a pitfall in that it can surprise you if you're not careful
|
# ? Dec 19, 2020 08:02 |
|
Analytic Engine posted:Anyone use Jupyter notebooks? And if you were to interview someone on their knowledge of them, what would you ask? I have a call coming up focused on Python and notebooks and it's been years since I used them so I don't know the cool new features or popular libraries (outside scientific computing) Not interview fodder as it's too new and maybe radical and I don't know how used it is outside of fast.ai so probably ignore this. I noticed that the fast.ai ml framework is developed using nbdev, a tool also from them: https://github.com/fastai/nbdev . nbdev is used to transform the output of the notebooks to plain Python stuff. It appears to me to be a very interesting way to use jupyter Python notebooks for literate programming.
|
# ? Dec 19, 2020 10:10 |
|
I always thought notebooks were mainly used in university courses that teach programming to non-programmers. I would not neccesarily look down my nose if it popped up in a CV, but it would be if that was the only programming experience.
|
# ? Dec 19, 2020 10:53 |
|
Notebooks are pretty common in academic research and are prolific among AI practitioners, like it's not uncommon at all to learn that a machine learning project was developed entirely in Jupyter since a lot of neural networks are largely developed by tinkering On a CV you would list Jupyter notebooks alongside framework skills like Tensorflow, Spark, etc. QuarkJets fucked around with this message at 11:24 on Dec 19, 2020 |
# ? Dec 19, 2020 11:22 |
|
|
# ? May 22, 2024 17:52 |
|
as a data guy who needs to run lots of one-off scripts and snippets here and there, i love notebooks. they’re a critical piece of my workflow within the anaconda platform.
|
# ? Dec 19, 2020 16:12 |