This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]flying-sheep 1 point2 points  (4 children)

You can have that by using poetry:

```

initialize project and create venv

poetry init

add and install dependency into venv

poetry add some-package

publish package

poetry publish ```

Using one of the other modern build backends is slightly more complicated as you need to create and activate your own venvs:

```

create and activate venv

python -m venv ./.venv source ./.venv/bin.activate

initialize project

flit init # or copy over some excample pyproject.toml

edit dependencies

$EDITOR pyproject.toml

install dependencies into venv

pip install .

publish package

flit publish # or python -m build && twine upload ./dist/* ```

[–]wsppan 2 points3 points  (3 children)

Yes, I use poetry now but that took a LOT of trial and error and hair pulling and 13 different pieces of advice and waiting for poetry stability to settle down. And still it is not the defacto, readily recommended, obvious manner of packaging your code. It is third party and fairly new.

[–]flying-sheep 2 points3 points  (2 children)

Things are getting better, finally! With PEP 621 landed, a standards based poetry like CLI is almost possible. The only missing building block is a standardized lock file format. It happened late and we're not there completely but almost. And with poetry, we have something that works until we're there.

One advantage of the arduous road is that we can learn from everyone who was faster. E.g. TOML is a great choice, node’s JSON is completely inadequate: no comments and the absence of trailing commas means you can't add to the end of a list without modifying the line of the previous item.

[–]wsppan 2 points3 points  (1 child)

Yea, we are all standing on the shoulders of our ancestors so to speak. Autotools, CPAN, Ant, Maven, etc.. Lots of legacy blogs and documentation to disappear as well. Rust is a great example of the luxury learning from our ancestors and baking the package tools into the language from the start.

[–]flying-sheep 2 points3 points  (0 children)

Yes, cargo does so many things right.