ditch poetry for pip. converts pyproject.toml into requirements.txt.

Overview

Say No To Poetry

Did you grow up using just pip or conda? Are you being forced to use poetry everywhere at work? They try to convince you poetry just works? You spiraled down into the conclusion that poetry is better than pip?

Its dependency resolution is shit slow. If one of the package fails to install (yes looking at you uwsgi), poetry starts screaming like kid (printing out errors, which requires additional sheets), further won't install any of the other packages.

poetry is good only on good days, it is horrible on bad days. days where I need to conda install -c conda-forge uwsgi just for uwsgi. and since poetry gave up at uwsgi, I need to manually install other dependencies.

So?

Use this binary instead,

say_no_to_poetry pyproject.toml

It converts your pyproject.toml into a requirements.txt.

Example usage:

~/demo-sntp$ ls
hypothetical.pyproject.toml  say_no_to_poetry

~/demo-sntp$ cat hypothetical.pyproject.toml 
[tool.poetry]
name = "hypothetical"
version = "0.5.2"
description = "hypothetical utilities"
authors = []

[tool.poetry.dependencies]
python = "^3.8"
docopt = "^0.6.2"
scikit-learn = "^0.24.2"
stanza = { version = "^1.2", optional = true }
levenshtein = "^0.12.0"
tqdm = "^4.61.0"
pandas = "^1.3.1"
pydash = "^5.0.2"
furo = "^2021.4.11-beta.34"
pytz = "^2020.4"

[tool.poetry.extras]
asr = ["stanza"]

[tool.poetry.dev-dependencies]
pytest = "^6.2.4"
mypy = "^0.812"
jupyter = "^1.0.0"
black = "^20.8b1"


[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

~/demo-sntp$ ./say_no_to_poetry hypothetical.pyproject.toml 

~/demo-sntp$ ls
hypothetical.pyproject.toml  requirements.txt  say_no_to_poetry

~/demo-sntp$ cat requirements.txt 
black>=20.8b1
scikit-learn>=0.24.2
furo>=2021.4.11-beta.34
pytz>=2020.4
mypy>=0.812
pandas>=1.3.1
stanza>=1.2
tqdm>=4.61.0
pytest>=6.2.4
jupyter>=1.0.0
levenshtein>=0.12.0
docopt>=0.6.2
pydash>=5.0.2

Caveats

Only after finishing this code, I realized there is an export support in poetry itself.

So if you already have poetry globally/any-venv you can directly use it.

Also regarding this binary itself, complete syntax of how version can be defined is here for poetry. the binary handles only the ^ and exact ones. not the ~, * ones. Also doesn't set the upper bound.

So is this useless?

Yeah whatever. It works, but pointless at this point of time. If you don't like poetry, don't have it in your system. use this binary, if you frequently need requirements.txt for setting up stuff.

It also helps in a situation where you want to use somebody's repo in your particular project/random environment. And if they happen to have pyproject.toml, convert it into requirements.txt, you can install dependencies without going through poetry, poetry install and poetry managing its own virtual environment for that repo.

tldr: you don't want to use poetry, happy with pip. Use this.

Learnings

  • my very first rust project.
  • I should google more before starting a project. re-search.
  • It could have been easier if I had taken time, to write down the steps and functions that'll make the project complete. And think if that's the most efficient way to do it. I ended up writing regex based file extraction (with look-aheads), to extract version for all possible version definitions. Without realzing it is just an ordinary .toml file. Later used the toml parser crate to do most of the hardwork.
  • lazy_static is interesting, to avoid compiling regex patter several times, it is just done once during later stages while running. Therefore if there is a need to compile same pattern repeatedly, one can use this to save up runtime speed.
  • I tried to write code such that each function is being told what to do directly, and given only the relevant information. no additional useless stuff.
You might also like...
Minimal recursive "truncate file/directory names to meet requirements" tool

trunc_filenames ssokolow@monolith ~ % trunc_filenames --help trunc_filenames 0.1.0 Rename files and directories to fit length limits. WARNING: Will n

Converts images into textual line art.
Converts images into textual line art.

img2utf Transform images to textual line art! Images require pre-processing to come out nice. It's expected that users will do the following: Apply ga

📜🔁🎶 A CLI which converts morse code into sound

morse2sound 🎵 A CLI which converts morse code to sound Big shoutout to Br1ght0ne for guiding me how to use Rust on stream

Untree converts tree diagrams produced by tree back into directory file structures.
Untree converts tree diagrams produced by tree back into directory file structures.

Untree: Undoing tree for fun and profit Untree converts tree diagrams produced by tree back into directory file structures. Let's say you have the fol

lemmy-help is a emmylua parser as well as a CLI which takes that parsed tree and converts it into vim help docs.
lemmy-help is a emmylua parser as well as a CLI which takes that parsed tree and converts it into vim help docs.

lemmy-help is a emmylua parser as well as a CLI which takes that parsed tree and converts it into vim help docs.

A swc plugin that automatically converts React component libraries into "React Client Component"

A swc plugin that automatically converts React component libraries into "React Client Component". For example, you can automatically convert components from @mui into "React Client Component" without having to wrap a component that uses "use client".

A native Rust port of Google's robots.txt parser and matcher C++ library.

robotstxt A native Rust port of Google's robots.txt parser and matcher C++ library. Native Rust port, no third-part crate dependency Zero unsafe code

rbdt is a python library (written in rust) for parsing robots.txt files for large scale batch processing.

rbdt 🚨 🚨 🚨 🚨 rbdt is a work in progress, currently being extracted out of another (private) project for the purpose of open sourcing and better so

Texting Robots: A Rust native `robots.txt` parser with thorough unit testing

Texting Robots Crate texting_robots is a library for parsing robots.txt files. A key design goal of this crate is to have a thorough test suite tested

security.txt for Solana Contracts

security.txt This library defines a macro, which allows developers to provide easy-to-parse information to security researchers that wish to contact t

rsv is a command line tool to deal with small and big CSV, TXT, EXCEL files (especially 10G)

csv, excel toolkit written in Rust rsv is a command line tool to deal with small and big CSV, TXT, EXCEL files (especially 10G). rsv has following fe

A simple command line tool which quickly audits the Disallow entries of a site's robots.txt.

Domo Arigato A simple command line tool which quickly audits the Disallow entries of a site's robots.txt. Disallow entries can be used to stop search

A lightweight async Web crawler in Rust, optimized for concurrent scraping while respecting `robots.txt` rules.

🕷️ crawly A lightweight and efficient web crawler in Rust, optimized for concurrent scraping while respecting robots.txt rules. 🚀 Features Concurren

FUSE filesystem that provides FizzBuzz.txt(8 Exabyte)

FizzBuzzFS root@8a2db3fc6292:/# cd /mnt/FizzBuzz/ root@8a2db3fc6292:/mnt/FizzBuzz# ls -l total 9007199254740992 -rw-r--r-- 1 501 dialout 9223372036854

A project for automatically generating and maintaining Debian repositories from a TOML spec.

Debian Repository Builder A simple utility for constructing and maintaining Debian repositories. Configuration of a repo is based on the directory hie

crates is an extension aims to help people to manage their dependencies for rust (crates.io & TOML).
crates is an extension aims to help people to manage their dependencies for rust (crates.io & TOML).

crates Hello Rust & VSCode lovers, This is crates, an extension for crates.io dependencies. Aims helping developers to manage dependencies while using

A TOML encoding/decoding library for Rust

toml-rs A TOML decoder and encoder for Rust. This library is currently compliant with the v0.5.0 version of TOML. This library will also likely contin

Find unused dependencies in Cargo.toml

cargo-udeps Find unused dependencies in Cargo.toml. While compilation of this tool also works on Rust stable, it needs Rust nightly to actually run. I

Extract documentation for the feature flags from comments in Cargo.toml

Document your crate's feature flags This crate provides a macro that extracts documentation comments from Cargo.toml To use this crate, add #![doc = d

Releases(0.1.0)
Owner
Jaivarsan
chilling at some local minima.
Jaivarsan
Turn GitHub into an RSS reader

NotCraft::NotFeed An RSS reader running entirely from your GitHub repo. Free hosting on GitHub Pages. No ads. No third party tracking. No need for bac

NotCraft 22 Nov 30, 2022
The [cain!] macro is a macro that rewrites sequential Rust branch statements into nested branches

Note! This crate is experimental and under development. It may include bugs that alter the behavior of your code in unexpected ways. You should review

Fredrik Østrem 2 Jan 19, 2022
Tools that parsing Rust code into UML diagram (in dot format currently).

rudg Rust UML Diagram Generator Tools that parsing Rust code into UML diagram (in dot format currently). Usage $ rudg.exe --help rudg 0.1.0 USAGE:

Zhai Yao 16 Nov 13, 2022
Merge multiple Juniper object definitions into a single object type.

juniper-compose Merge multiple Juniper object definitions into a single object type. crates.io | docs | github Motivation You are building a GraphQL s

Kit Isaev 3 Aug 5, 2022
Turn any web page into a desktop app (but, lightweight <1MB)

Intro Turn any web page into a desktop app (but, lightweight <1MB) The bundle will be less than 2MB Demo: https://i.imgur.com/BLr03oF.mp4 Install carg

null 9 Dec 27, 2022
Deserialize (potentially nested) environment variables into your custom structs

envious allows you to deserialize your serde enabled structs from environment variables. See it in action: use serde::{Deserialize, Serialize}; #[der

Marcel Müller 46 Feb 19, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Ditch your status bar for some snazzy desktop notifications.

citron Ditch your panel for some snazzy desktop notifications. citron is: a non-intrusive alternative to status bars. on-demand, i.e. does not run in

Aziz Ben Ali 1 Jan 11, 2022
Explain semver requirements by converting them into less than, greater than, and/or equal to form.

semver-explain Convert SemVer requirements to their most-obvious equivalents. semver-explain is a CLI tool to explain Semantic Versioning requirements

Andrew Lilley Brinker 27 Oct 29, 2022
coins20's graduation requirements checker

tanici 筑波大学の履修管理システム twins が出力するCSV(UTF-8)をもとに,coins20(情報科学類2020年度生)が卒業可能であるかを判定し不足を出力します.おまけとしてGPAの算出も行います. (免責事項:精度の保証はしません.あくまで参考程度に,責任は負いません.) Usa

cyanolupus 1 Jan 31, 2022