A simple project
Now let's say we create a new package and name it
package
.
my_package/ ├── package.prlx └── spec.prlx
The folder named my_package
is just named and the
name is not important while creating the package.
The file package.prlx
is the main file for the
package so that when the user uses the package, this file will
be run.
The spec.prlx
file is considered the most
important file when the package is downloaded because it is
used to store information for the package and if it is not
there, it means the package cannot be downloaded even if it is
deleted using ppm
.
Here is an example for the files example.prlx
and
spec.prlx
:
class factorial :__edit__ { $math:eq $factorial:__key__ "do"; if $math:result { $math:r 1 :i 1; loop $factorial:do { $math:mul $math:r $math:i; $math:r $math:result; $math:add $math:i 1; $math:i $math:result; } $factorial:result $math:r; } } factorial $factorial;
class config :name "package" :version "1.0.0"; class info :summary "A normal testing package" :description none # No description :license "MIT" # A license that PPM supported :tags "tools" :dependencies "prolix >= 2.1.0" :homepage "https://github.com/prolix/sort"; class build :source "package.zip" :username "Your username" :password "Your password" :api_key "Your API key";
Including other files
To add other files to your package, you need to create a folder with the same name as your package.
my_package/ ├── package/ │ └── external_file.prlx ├── package.prlx └── spec.prlx
Uploading the distribution archives
Finally, it’s time to upload your package to the PPM Server!
The first thing you’ll need to do is register an account by
using command ppm register
, which is a separate
instance of the package index intended for testing and
experimentation. It’s great for things like this tutorial
where we don’t necessarily want to upload to the real index.
Register an account and complete the steps on that command
asked. You will also need to verify your email address before
you’re able to upload any packages.
When you've verified that creating an accound, you can upload it to the PPM server with the upload command but you must compress your package into a zip file:
my_package/ ├── package.zip └── spec.prlx
ppm upload C:/Users/Admin/Desktop/my_package/spec.prlx
After the command completes, you should see output similar to this:
Clearing all caches.. done Connecting to the server.. done Searching package for package.. failed Successfully uploaded package@1.0.0
Installing your newly uploaded package
You can use ppm
to install your package and
verify that it works.
ppm install package
pip should install the package from PPM server and the output should look something like this:
Connecting to the server.. done Searching package for sort.. done Searching lastest version for sort.. done Collecting sort@1.0.0 Installing sort.zip (533 B).. Successfully installed sort@1.0.0 Clearing all caches.. done
You can test that it was installed correctly by importing the package. Make sure you’re still in your virtual environment, then run Prolix:
> require package > $factorial:do 7 > $io:write $factorial:result :write "\n" 5040