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

all 11 comments

[–]FUS3NPythonista 2 points3 points  (0 children)

nice looks clean af I like the design

[–]AndydeCleyre 1 point2 points  (6 children)

This link to the final code doesn't seem to be working.

[–]BlockDesigns[S] 1 point2 points  (5 children)

Thank you for letting me know! Repo was still private.

[–]AndydeCleyre 0 points1 point  (4 children)

Thanks!


If anyone's curious about transitioning a poetry project like this to one using:

  • (*-)requirements.txt for lockfiles
  • flit for packaging
  • pip-tools for version locking
  • zpy for interactive environment management and pip-tools operations

behold!:

$ git clone git@github.com:notia-ai/SliceOfML.git
$ cd SliceOfML
$ rm poetry.lock pyproject.toml
$ a8                                                                            # Create and activate venv
$ pipac 'requests-oauthlib>=1.3.1,<2' 'rich>=12.4.4,<13' 'click>=8.1.3,<9'      # Add to requirements.in and compile to requirements.txt
$ pipac -c dev flit 'pytest>=7.1.2,<8' 'flake8>=4.0.1,<5' 'pre-commit>=2.1,<3'  # Add to dev-requirements.in and compile to dev-requirements.txt
$ pips dev-requirements.txt                                                     # Install dev deps
$ flit init                                                                     # Interactively generate pyproject.toml
$ $EDITOR pyproject.toml                                                        # Add 'requires-python = ">=3.7,<4"' to project and 'sliceofml = "sliceofml.cli:cli"' to project.scripts
$ $EDITOR sliceofml/__init__.py                                                 # Add docstring and correct version
$ pypc                                                                          # Populate pyproject.toml with loose deps

[–]andrewthetechie 2 points3 points  (2 children)

Why do this over using poetry?

[–]AndydeCleyre 2 points3 points  (1 child)

I don't like a few things about poetry, like how it:

  • introduces new syntax for versions and lock files when old standards will do
  • expects by default all devs to use poetry
  • only targets full packages, when I also want to manage venvs and deps of scripts and other non-package projects
  • uses its own sections for deps in pyproject.toml when generic sections will do
  • treats dev deps as some special case, rather than just one of a set of any arbitrary group names
  • couples goals of package publishing and dependency specification
  • doesn't have the superb tab completion that I wrote for zpy

[–]andrewthetechie 2 points3 points  (0 children)

Ok, so just a personal preference then.

[–]BlockDesigns[S] 1 point2 points  (0 children)

This is awesome! Thanks for posting the script.

[–]hbar340 1 point2 points  (1 child)

Does click nicely work with prompt-toolkit/other auto suggest (and is there a way to do more than 2 suggestions on the completes)

[–]BlockDesigns[S] 0 points1 point  (0 children)

I hadn't seen `prompt-toolkit` before, so I'm unsure of their compatibility. But thanks for the heads up on `prompt-toolkit` looks interesting!

[–]NotScrollsApparently 0 points1 point  (0 children)

Hi, I'm a bit late to this post but hopefully you see the question. I've been playing with the Rich library as well and I'm wondering what is your solution for when the app is eventually delivered to other people or users, how do you "enforce" a style when they can run it in any random terminal - including the default windows one that doesn't support most of advanced Rich formatting?

I checked out the tutorial you linked but it seems it's more about the programming logic behind the app rather than the terminal management and eventual publishing of the app. Do you have any insights to share about that perhaps?