kopiccino is a Python port of package.swift, an inbuilt package manager for Libterm.
Pip is the de-facto package manager for Python that has made distributing Python software reletively pain-free. However, what if you wanted to share one-off scripts that simply does not justify the use of a full-blown package?
This is where kopiccino steps in. You simply put into a zip file:
- the main script (entrypoint, in pip terms),
- other modules (if it is a Pip package, see below)
or just place the files/directories into a folder and let bao do the work for you, which yields a bao package (a.k.a a bun).
pip install kopiccino
A bootstrappable version for developemnt based on the latest Github commit is WIP.
From script to deployment:
$ mkdir helloworld && cd helloworld
$ echo 'print("Hello world!")' >> helloworld.py
# add metadata to helloworld.py here
$ kopiccino pour .
$ ls
helloworld.py helloworld.zip
where helloworld.zip
is the package bundled with the metadata in TOML format.
kopiccino parses the main script for the bun metadata, which should have the following attributes defined:
__doc__
(str): Docstring at the top of your script (package description)__author__
(str): The code authors.__license__
(str): The SPDX identifer. If your code uses a custom license, put its short form here.__version__
(str): The semantic version of the package (see this.
From there, you can host the package online and provide the direct URL of to the enduser (bun.zip must be in the same path as bun.toml).
To create a local repository, do:
mkdir testing && cd testing
kopiccino local init . # the name of the folder will be the repository nickname
# move your built/unbuilt packages here
kopiccino local register # register all packages and build them, if needed
This creates a MANIFEST.toml
file which contains a mapping of all packages to their
metadata. If you add any more packages, run kopiccino local register
again.
Alternatively, you can put your packages as folders (i.e unbuilt), and kopiccino will create them automatically for you.
For backward compatibility, kopiccino can use the Github REST(v3) API to download packages if the MANIFEST.toml file is not present (i.e in the LibTerm-Packages repo).
On Libterm, kopiccino uses userdefaults3 to modify package.swift
configuration so any packages installed through package.swift
is known to kopiccino and vice-versa.