DEV Community

Cover image for PLZ a new PIP
Juan Carlos
Juan Carlos

Posted on

PLZ a new PIP

PLZ is a PIP Alternative designed for Dockers, Alpines, Vagrants, and containers.

Features

  • 1 Megabyte, 1 file, 0 Dependencies, ~500 Lines of code.
  • Documentation Generator with Markdown to HTML & PDF
  • No Garbage Collector (Rust-like memory management).
  • Single file, it can even delete itself after use.
  • Install, uninstall, reinstall, download, upload to PyPI, etc.
  • Checks GPG if package has it, checks SHA sum for all packages.
  • Designed for Docker or Alpine usage.
  • Inferred Strong Static Typing with Z3 Theorem Prover.
  • Immutable programming, No Global Mutable State.
  • The only PIP alternative in the world that just works even with Python/Virtualenv completely broken. Can fix a broken PIP.
  • Machine code performance, as fast as optimized C.
  • High performance with low resources (RPi, VPS, cloud, old pc, etc).
  • No Installs, no setups, just copy & paste and run.
  • Colored output on the Terminal.
  • Project skeleton creator to create your own new Python projects.
  • Wont save any passwords, databases, keys, secrets, to disk nor Internet.
  • No temporary folders nor files.
  • Not meant as a drop-in replacement for anything pre-existing.
  • Tiny single file source code (not counting string constants).
  • Works fully isolated, self-contained standalone application.
  • It does NOT depend on pip (Not a pip wrapper).
  • GitHub Actions CI Builds every commit from zero.

Alt Text

Use

$ plz install pre-commit   # Install 1 or more packages
$ plz uninstall pre-commit # Uninstall 1 or more packages
$ plz reinstall pre-commit # Reinstall 1 or more packages
$ plz download pre-commit  # Download 1 or more packages
$ plz hash file.py         # Show SHA CheckSum of file/package
$ plz open file.py         # Open a module in your default code editor
$ plz backup /folder/      # Compressed backup of file/package with SHA Checksum
$ plz init                 # New Python project template (Interactive)
$ plz stats                # PyPI official service status report
$ plz newpackages          # List all the new Packages uploaded to PyPI recently
$ plz lastupdates          # List all existing Packages updated on PyPI recently
$ plz lastjobs             # List all new Job Posts updated on Python recently
$ plz userpackages         # List all existing Packages by User (Interactive)
$ plz latestversion        # Show the Latest Version of a PYPI Package (SemVer)
$ plz forceInstallPip      # Force install PIP on arbitrary folder (get-pip.py)
$ plz doc file.md          # Markdown/ReSTructuredText to HTML  (MD/RST can be mixed).
$ plz doc2latex file.md    # Markdown/ReSTructuredText to Latex (MD/RST can be mixed).
$ plz doc2json file.md     # Markdown/ReSTructuredText to JSON  (MD/RST can be mixed).
$ plz upload packg-1.0.zip # Similar to "twine upload" (Interactive,asks user,wont need Twine).
$
$ plz --enUsUtf8           # Force Encoding to UTF-8 and Language to English
$ plz --cleanpyc           # Clean all __pycache__ and *.pyc
$ plz --cleanpypackages    # Clean all __pypackages__
$ plz --cleantemp          # Clean all temporary folder.
$ plz --cleanpipcache      # Clean all PIP Cache folder.
$ plz --cleanvenvs         # Clean Virtualenvs (interactive, asks Y/N 1-by-1).
$ plz --publicip           # Show your Public IP Address (Internet connectivity check).
$ plz --log=file.log       # Full path to a verbose local log file.
$ plz --backuplogs         # Compress old PLZ Logs at exit, to save disk resources.
$ plz --putenv:key=val     # Set an environment variable "KEY=Value", can be repeated.
$ plz --nice20             # Runs with "nice = 20" (CPU Priority, smooth priority).
$ plz --suicide            # Deletes itself permanently and exit (single file app).
$ plz --dump               # Show system info JSON and quit (for Developers and Bug Reporting).
$ plz --version            # Show Version
$ plz --help               # Show Help
Enter fullscreen mode Exit fullscreen mode

Example

$ plz install bottle

2020-03-27T17:04:52-03:00, PID is 419469, 1 packages to download and install ["bottle"]
Generate Install Script? (y/N): n

bottle  0.12.18
https://files.pythonhosted.org/packages/d9/4f/57887a07944140dae0d039d8bc270c249fc7fc4a00744effd73ae2cde0a9/bottle-0.12.18.tar.gz
71557 Bytes total (compressed)
SHA256 (bottle-0.12.18.tar.gz) = 0819b74b145a7def225c0e83b16a4d5711fde751cd92bae467a69efce720f69e
https://files.pythonhosted.org/packages/d9/4f/57887a07944140dae0d039d8bc270c249fc7fc4a00744effd73ae2cde0a9/bottle-0.12.18.tar.gz.asc 
HTTP-404? (Package without PGP Signature)

x bottle-0.12.18/bottle.egg-info/PKG-INFO
x bottle-0.12.18/bottle.egg-info/SOURCES.txt
x bottle-0.12.18/bottle.egg-info/dependency_links.txt
x bottle-0.12.18/bottle.egg-info/top_level.txt
x bottle-0.12.18/MANIFEST.in
x bottle-0.12.18/README.rst
x bottle-0.12.18/bottle.py
x bottle-0.12.18/setup.py
x bottle-0.12.18/PKG-INFO
x bottle-0.12.18/setup.cfg

2020-03-27T17:04:55-03:00 0 Failed, 1 Success on 1 second, 887 milliseconds, 565 microseconds, and 957 nanoseconds to download+install 1 packages

$
$ plz init

New Python project name?: example
Generate optional Unitests on ./tests (y/N): y
Generate optional Documentation on ./docs (y/N): y
Generate optional Examples on ./examples (y/N): y
Generate optional DevOps on ./devops (y/N): y
Generate optional GitHub files on .github (y/N): y
Generate .gitignore file (y/N): y
Generate optional files (y/N): y
Use Markdown(MD) instead of ReSTructuredText(RST)  (y/N): y

Created a new Python project skeleton, happy hacking, bye...

$ ls example/
AUTHORS.md  CHANGELOG.md  CODE_OF_CONDUCT.md  CONTRIBUTING.md  devops  docs examples
LICENSE.md  Makefile  MANIFEST.in  README.md  requirements.txt  setup.cfg  setup.py  tests

$ echo "Hello **World**" > example.md
$ plz doc example.md 
Hello <strong>World</strong>

$ cat example.html
Hello <strong>World</strong>

$ plz doc2latex example.md
Hello \textbf{World}

$ cat example.tex
Hello \textbf{World}

$ plz --dump
{
  "hostCPU": "amd64",
  "hostOS": "linux",
  "cpuEndian": "littleEndian",
  "getTempDir": "/tmp/",
  "now": "2020-03-27T17:40:00-03:00",
  "getFreeMem": 151552,
  "getTotalMem": 528384,
  "getOccupiedMem": 267376,
  "countProcessors": 8,
  "arch": "x86_64",
  "ssd": true,
  "FileSystemCaseSensitive": true,
  "git": "2.25.1",
  "node": "v13.9.0",
  "python": "3.8.1"
}

$ plz --suicide  # Good bye world :(
true

$ plz
Command not found: plz
Enter fullscreen mode Exit fullscreen mode

Output, messages and other stuff may change in the future.

Star PLZ on GitHub

Stars over time

We re-implemented PIP on ~500 lines of code, it deserves a Star ?.

👑

Top comments (3)

Collapse
 
mburszley profile image
Maximilian Burszley • • Edited

What does this solve over Poetry? (which is seeing a lot of adoption and is an experience similar to yarn, building on PEP517/518)

Also, having everything in a single file does not make it desirable to use. It makes me think the author doesn't know how to make their code modular.

Collapse
 
kunitoki profile image
kunitoki • • Edited

you don't really need to modularise if the whole app is 500 lines of code divided in 4 or 5 files. Poetry has hundreds of files with some of them even reaching more than 1000+ lines of code: should they modularise more instead ?

Collapse
 
moigagoo profile image
Constantine Molchanov •

Looks amazing! Will try it at the first chance.

Does it aim to compete with Poetry, i.e. in the area of package management? Or is it purely a pip alternative?