The Python community has adopted or created a standard way of doing things for the (checks calendar) fourth or fifth time now.
It seems crazy to me that we don't have this yet.
[0]: There should be one-- and preferably only one --obvious way to do it. (from the zen of python)
python setup.py build_ext --inplace
I don't see a valid replacement for this invocation, but fortunately, it's the only one.When I include the library from a project that uses it, the same `pip install' command that brings the library in also performs all the compilation described by my setup.py.
All I'd need to move away from deprecated syntax entirely is a way to build the module when I'm testing it within it's own source directory. Until then I won't be changing anything.
Unfortunately, each response had a different recommendation. I wish I could find that thread again.
We have been talking about how to support customers who want to use python. At least for me it isn't very appealing, seems like it could take a lot of attention to keep up with what's expected.
For some of my projects, I produce a "compiled"/bundled executable that takes all the pain out of distribution. Here's my config, maybe it will be useful to you:
https://gitlab.com/stavros/harbormaster/-/blob/master/.gitla...
Maybe the single most underappreciated thing about Poetry compared to other options is its tendency to fail safe.
The poetry author doesn't want to support package version range overrides like yarn does [1]. His call I suppose, but I think it's the one major flaw in the otherwise giant step that poetry takes forward.
While it doesn't really matter for web/scripting use cases, it's an absolute godsend for DS/ML workflows.
But the resolver, oh why does the resolver take so long?
Python's environment difficulties make it exponentially harder for beginners to focus on actual programming concepts. Things like pyenv or virtualenvs or any of those things are blackboxes to beginners.
Go is simple, it's tightly coupled to version control so you can teach git at the same time in a meaningful way, and it's low level enough that CS concepts come up frequently, while being powerful enough that it will scale with a beginner's knowledge.
I love Python, and the ecosystem is vast, you're right, but it has a serious issue with packaging, delivery, and dependency management. I have almost a decade of software engineering under my belt, and Python environment issues give me a hard time _regularly_. For beginners, it is a major demotivating factor that can be a death sentence for learning.
Go By Example will take a beginner from Hello World to writing a server in a short time, and you can naturally splice in other skills.
Here's my simple-minded metric on when this problem can be called "solved":
Get a VPS from GoDaddy.
Deploy your Django app as easily as you can deploy a PHP app, say, Wordpress.
I have written about this before. I love Django. And yet I think that they have done a huge disservice with the development server and DB configuration out of the box. Even for a simple application, going from developing on your desktop to deploying the same application on, as an example, GoDaddy, is in a range between nightmare and impossible. I have personally given up multiple times and just said "Fuck it! Just use WP" even when I really, truly wanted to stay in the Python/Django ecosystem.
Try it. Develop a simple photo album application. Get a VPS from GoDaddy and deploy it.
No Heroku et. al., are not solutions. They are indicative of the problem.
i'm not saying that python packaging isn't a mess. but it can be largely mitigated.
This coming from someone who would truly like to use Python/Django exclusively. I hate, hate, hate telling people to just use WP or go a different route. I do not enjoy touching PHP. And yet...
I can teach a slightly technical person to deploy WordPress on a shared host with a pre-installed shared LAMP stack. I cannot do this with Docker, not to to the extent it's sustainable without ongoing help from me.
GoDaddy should burn in hell for their shady shit.
C'mon, get some perspective.
I have been using GoDaddy for, well, I forget how long, maybe two decades. I have run websites for multiple companies from their servers. I can't remember a single issue. Not one. Even hosting and managing email. Frankly, I don't know what you are talking about.
I have also used Linode, AWS, Dreamhost, Rackspace and a bunch of others for different kinds of work. Not sure where the hatred for GoDaddy comes from.
I also know a bunch of people using GoDaddy servers. I think people repeat shit just because they think they sound "cool" and yet have no clue what they are talking about. Also, GoDaddy support, on the rare occasions they are needed, has always been top notch. So, yeah, no clue what you are talking about.
Agreed. Though I would not call it a "nightmare," the python ecosystem and runtime are cumbersome and annoying to work with when compared to some other languages that have put in a lot of thought into DX.
Still, it could be worse.
Try out Ruby: so many Python syntax decisions make no sense after you see the Ruby way.
I must say though, I do miss Ruby and the syntactic sugar, packaging/dependency system, etc. The transition itself was also very painless. I’m keen on checking out the current state of Ruby and/or Rails 4-5 years later, as I’m sure much has changed!
The two main frameworks I use(d) have relative equivalents in both languages which is super nice (Flask and Sinatra, Rails and Django). Right now I’m in the FastAPI craze, but perhaps I’ll opt for Rails for my next personal project.
There are new niceties and improvements, but bundler is still bundler, everything is still an object, etc.
I know this is more rails but the fact that autoloading is even a thing speaks to the wild nature of ruby.
There have been a few version management tools (rvm, rbenv), but those were all "fine" and still are, AFAICT, and you don't strictly need them.
Meanwhile for inexplicable reasons in pythonland we keep reinventing package/version/environment management.
I had a friend who managed to mess up their local env this morning to the point of screwing up their OS install, and it reminded me of the XKCD on python env[0].
It's at least 3 years old, and things have not improved.
Python is such a joy to write and such a nightmare to maintain, set up, package and distribute.
Fixed that for you.
As someone who actually worked weeks on their spare time, I beg to differ. This is a very complicated problem to solve. And everyone has their own opinion on how things should work, which is goverened by their narrow use case. But you see a "standard" packaging tool needs to be the opposite of narrow use case. The main reason Anacond Inc exists is because they wanted to solve this for data science. Even with them being a relatively big corporation their "solution" is not loved universally, but works ok most of the time.
What has been happening is that someone writes a build tool to solve a specific problem that they have but they neglect to solve all the other ones. Why would they? They’re not being funded.
That’s what caused (and still causes) a lot of the churn in JS too.
- for librairy packaging and general dep maangement, poetry is the solution
- for packaging a web project and ship it on the server, shiv is the solution
- for distribution, half the solution is nuitka for compiling the program. Creating the installer is now the hard part
The Python Foundation needs to adopt or create standard and supported ways of doing things. I spend so much time dealing with issues that should have been solved a long time ago. Special shout out to the PyInstaller devs for providing so much value while constantly fighting to deal with upstream changes.