Live data from Hacker News

What the Heck Is Pyproject.toml?

snarky.ca

191–199 of 199 posts

Re: What the Heck Is Pyproject.toml?

#191

I have found this blog post[1] quite informative regarding Python projects packaging. It describes well how all the tools (pyenv, poetry, black, flake8, isort, pre-commit, pytest, coverage, tox) fit together. Poetry seems the go-to tool for dependencies management and it centralizes all your package configurations alongside its dependencies in pyproject.toml. [1] https://medium.com/georgian-impact-blog/python-tooling…

Still have some critical bugs here and there[1], many about resolving dependencies. Don't get me wrong, I use it for my own current side project github.com/rmpr/atbswp, but imho a lot of things need improvement.

[1]: github.com/python-poetry/poetry/issues

Re: What the Heck Is Pyproject.toml?

#193
post #89

Earlier quoted context omitted.

> I also wish there was a npm style script section in the definitions. Is that like [tool.poetry.scripts] ?

I don't think so. From their docs: > This section describe the scripts or executable that will be installed when installing the package I want something such that I can run `poetry run script_name` and it will run that command line in the poetry context. Right now I either rely on my bash history or use a bash script to mimic the behavior of npm / yarn scripts. I want to turn this `poetry run python project_name/main…

That's what tool.poetry.scripts does.

Re: What the Heck Is Pyproject.toml?

#194
post #89

Earlier quoted context omitted.

I don't think so. From their docs: > This section describe the scripts or executable that will be installed when installing the package I want something such that I can run `poetry run script_name` and it will run that command line in the poetry context. Right now I either rely on my bash history or use a bash script to mimic the behavior of npm / yarn scripts. I want to turn this `poetry run python project_name/main…

That's what tool.poetry.scripts does.

O thats great. So just weirdly worded on the docs / I didn't understand. Thanks!

Re: What the Heck Is Pyproject.toml?

#195
post #173

Earlier quoted context omitted.

I think something people are forgetting when comparing Python's packaging system to other languages and runtimes is how old Python and its ecosystem is. For instance, Python's public release predates Linux's public release(Feb 1991 versus Aug 1991). The first release of setuptools was 2004 and it isn't like people weren't sharing Python code even before then ( https://github.com/pypa/setuptools/commit/8423e1ed14ac169…

The age also means Python has had plenty of time to come up with something new!

People in the Python ecosystem have come up with plenty of new things over the years - eggs, wheels, conda, poetry... Coming up with something new is the easy bit. Getting everyone to agree that a new thing is better and stop using/recommending other things is much harder - almost impossible, if those other things serve some use cases fairly well.

The fragmented ecosystem is one of the main complaints about Python packaging today. And that's really tricky, because the main way the open source world knows to solve problems is to create new tools, and that doesn't help when the problem is 'too many tools'.

Re: What the Heck Is Pyproject.toml?

#196
post #189

Earlier quoted context omitted.

I'm not sure how old you are, but if you don't know the name "Borland" you might not realize how novel it is to have a compiler on every major OS. While Python's age means it has been around to see a lot of changes occur, that also means it had pre-existing practices and code to also consider whenever a shift in the industry occurred. Plus in hindsight things look obvious, but during the transition it isn't obvious w…

I’ve been doing this for over 20 years. It’s no excuse, python should have a solution.

It sounds a bit more understandable if you rephrase it as "a small group of largely unpaid volunteers should find a solution for which millions of users and several billion-dollar businesses will happily abandon their current long-running and well-tested solutions".

Re: What the Heck Is Pyproject.toml?

#197
post #53
post #44

Earlier quoted context omitted.

This is BS. most other languages, with the same constraints, have done far better. Take Ruby as one example.

Ruby serves one ecosystem (web), barely. Python serves several huge ones: web, datascience, 3d graphics, sysadmin... all with different needs, different conventions, different “standard” tools to do this and that. The community is orders of magnitude bigger than ruby by now, and anything that requires coordination is much harder to accomplish than in a lot of other ecosystems. Python is now on par with ecosystems lik…

That’s the “oh we can’t use methods from others, we are too special” argument, which is always BS. Coupling the misapprehension to a snooty misconception is doubly unfortunate.

Re: What the Heck Is Pyproject.toml?

#198
post #22

Earlier quoted context omitted.

I teach Python to some middle school kids. Pip vs Pip3 and PYTHONPATH wasted entirety of two class sessions. By the way, Python should go beyond Go. It should single binary the someone can install without root privileges. The fact that I have hundreds of Chromebooks at my school and I can’t use any of them - school IT, correctly, doesn’t want me mucking with advanced settings.

One can easily install Python without root. You have to build from source and use the --prefix option to, say, install under $HOME. Also helpful to avoid the system Python which usually lags far behind on systems like RHEL.

> "easily"... "build from source"...

You think the school IT department won't let the GP install Python but will let them install a compiler toolchain? The benchmark for "easy" is you download one binary and run it in userspace. Add any additional steps and you can't use that word anymore.

Re: What the Heck Is Pyproject.toml?

#199
post #196
post #189

Earlier quoted context omitted.

I’ve been doing this for over 20 years. It’s no excuse, python should have a solution.

It sounds a bit more understandable if you rephrase it as "a small group of largely unpaid volunteers should find a solution for which millions of users and several billion-dollar businesses will happily abandon their current long-running and well-tested solutions".

First, programmers have choices, and Python's lack of a good user experience on this front will turn off people that have better options with other languages which have found a way to deliver a better experience given the same constraints as python.

Second, there is the python foundation, which funds people to work on areas of python. This should be a priority, and can be done by paid contributors.

Post reply on HN