Live data from Hacker News

What the Heck Is Pyproject.toml?

snarky.ca

81–90 of 199 posts

Re: What the Heck Is Pyproject.toml?

#81

The thing i have yet to reliably figure out is this (i live in the science part of python): without a setup.py, how do I: from Cython.Build import cythonize import numpy as np import versioneer setup(..., version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), ext_modules=cythonize(extensions), include_dirs=[np.get_include()], ...) I'm 100% on board with not having executable configuration files, except…

pyproject.toml and setup.cfg can in some cases make a setup.py unnecessary.

That does not mean you should not use it anymore if you have a good reason to use it. The ones you listed are examples.

How ever, as explained in the article, you should still add the pyproject.toml

Re: What the Heck Is Pyproject.toml?

#82
post #77
post #45

Earlier quoted context omitted.

How do other people replicate your venv? How does production replicate your venv?

You pin all your direct dependencies in requirements.txt, run "pip freeze >requirements-frozen.txt" to get a list of the versions of all dependencies (direct and transitive), and then you ship that. Replicating is just "virtualenv --python=python3 venv && . ./venv/bin/activate && pip install -r requirements-frozen.txt". Am I missing something here? Yes, to be absolutely sure, you need to have the same versions of pyt…

This is worse than how it’s done on most modern languages.

Re: What the Heck Is Pyproject.toml?

#83
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…

Node does it better as well. So does java with maven which has been the dominant way to do it in java for over a decade.

Re: What the Heck Is Pyproject.toml?

#84
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.

Yes, Python’s packaging is partly bad because it’s based on C extensions, which are intrinsically bad, but it’s also just plain bad compared to its peers, like Ruby and NPM.

A lot of ruby is based on C extensions too.

Re: What the Heck Is Pyproject.toml?

#85
post #80

Earlier quoted context omitted.

That will probably be solved by the new pip resolver within the next few months.

Did that new resolver finally happen? The pip SAT-based solver was supposed to land in 2017 or 2018 after a GSoC, and nothing came of it. Is it finally going to use a different heuristic than "#yolo" for picking which version of dependencies to install?

Ya, funded PSF grant https://wiki.python.org/psf/Pip2020DonorFundedRoadmap

Re: What the Heck Is Pyproject.toml?

#86
post #82
post #77

Earlier quoted context omitted.

You pin all your direct dependencies in requirements.txt, run "pip freeze >requirements-frozen.txt" to get a list of the versions of all dependencies (direct and transitive), and then you ship that. Replicating is just "virtualenv --python=python3 venv && . ./venv/bin/activate && pip install -r requirements-frozen.txt". Am I missing something here? Yes, to be absolutely sure, you need to have the same versions of pyt…

This is worse than how it’s done on most modern languages.

That's why we use Poetry.

Re: What the Heck Is Pyproject.toml?

#87

Python desperately needs a better packaging solution than pip from Python Software Foundation. Stop all new features until this - the biggest pain point for Python across all expertise levels from newbies to experienced Python programmers - is officially solved. No pipenv, no poetry, no conda, etc from third party devs who sometimes get tired of the pressure [1]. It is immense. Combine all this virtualenv stuff with…

Containers solve this for non-GUI apps, and pip still works for 90+% of use cases. Not sure if yet another solution would improve the situation, would just be more fragmentation and competition with more general (non-Python-specific) solutions.

Re: What the Heck Is Pyproject.toml?

#88

Python desperately needs a better packaging solution than pip from Python Software Foundation. Stop all new features until this - the biggest pain point for Python across all expertise levels from newbies to experienced Python programmers - is officially solved. No pipenv, no poetry, no conda, etc from third party devs who sometimes get tired of the pressure [1]. It is immense. Combine all this virtualenv stuff with…

I am an experienced Python programmer. I often have to collaborate with people who are not. There is no greater hell than talking them through installing a working Python environment. It’s impossible. Meanwhile, the pip project is full of developers who tell you that your problem is not a problem and you’re discouraging people by pointing out that they’re blame shifting: https://github.com/pypa/pip/issues/4995 I hone…

Do you mean installing Python itself or the needed packages? I think Python itself is really painless (just use os Python is you have a recent Linux or get it from Python.org). For end users just ship Python along with your app in the same package (Docker image, OS X bundle etc).

Re: What the Heck Is Pyproject.toml?

#89
post #17

Earlier quoted context omitted.

I just started up a project using this. It’s pretty good so far. The documentation on common tasks is a little bit lacking. VS Code integration is sort of broken in a few random ways (for example if I try and do a find all function definition it just hangs). I also wish there was a npm style script section in the definitions. I do think it really just works though and I think it’s a great solution compared to require…

> 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.py` into an alias like `poetry run main` or `poetry run dev`.

Re: What the Heck Is Pyproject.toml?

#90
post #83
post #53

Earlier quoted context omitted.

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…

Node does it better as well. So does java with maven which has been the dominant way to do it in java for over a decade.

I would not use Node as an example of good packaging. It really hasn't been that long since left-pad. Then there's the fact that you still have multiple different tools to do the same thing (npm vs. yarn) and the end result node_modules/ is a fucking mess anyways.

    find node_modules/ -name "node_modules" | wc -l
         327
Post reply on HN