4.2. Package manager and module management
PikaPackage is a monolithic application for the windows platform. Based on the development of the go language, it integrates the go-git component, which can realize the pull, update and version switching functions of the git repository without installing git.
The directory where PikaPcakge is located is
https://github.com/pikastech/pikascript/tree/master/tools/pikaPackageManager
- The first is to check whether the /tmp/pikascript folder exists. If not, it will clone a pikascript repository first.
The /tmp directory refers to the tmp folder in the root directory of the disk where pikaPackage.exe is currently located. For example, if pikaPackage.exe is on drive C, then /tmp is C:/tmp, and if it is on drive D, then /tmp is D:/tmp. The clone repository uses the gitee source, so don’t worry about the network connection problem, and it is also very fast in China.
Update repository to latest state.
Read the modules in the current request.txt file.
The following is an example of a requestment.txt file. The format of this file is the same as that of the mainstream python pip package manager. Fill in the module name and version number to pull the corresponding module. Currently only the == symbol is supported, which means strictly matching the version number. There is also a special version of latest, which means to pull the latest module. This latest refers to the latest version of the master branch in the pikascript repository. **If you are a user of a module rather than a developer, please be careful to avoid using the latest version whenever possible. Because the latest version is constantly changing, newer versions of modules may cause compatibility issues.
- pikaPackage.exe checks /tmp/pikascript/packages.toml file, which is a module description file in a repository, this file describes all available modules and their versions. The following is the intercepted part of the packages.toml file. In this file, there are four modules, pikascript-core, PikaStdLib, PikaStdDevice, and STM32, which can be pulled, and the release section under each module describes the version that can be used.
If you also want to publish the module, you can fill in the packages.toml file in the same way, and the package manager can recognize the module you published.
name = "pikascript-core"
releases = [
"v0.8.1 af42fd61884dc7048628b0d3bafaa42697f6e8ea",
"v0.8.2 af42fd61884dc7048628b0d3bafaa42697f6e8ea",
"v0.8.3 af42fd61884dc7048628b0d3bafaa42697f6e8ea",
"v0.9.0 332ef8afb0692cddd194782a07e30f2688d0f813",
"v0.10.0 c86eaefa4516dd82b1050fa74a7d85399459d5ed",
"v1.0.0 7b816b1546ef91a03f77760d4b10806ab956d452",
"v1.1.0 845d1fc6520237e2238087800f72608dcb81afa6",
"v1.1.1 c77e42450ed0eb09fcd7bb2b7d7c2b7eeeb55a2e",
"v1.1.2 f6ad2c78f49162ab3f898abc6a0a4d87777ce655",
"v1.1.3 6539072bf7bebb242ea40f8595bfb5c9aae3de7f",
"v1.2.1 e29a77527fd753c4eb811b047899534472bfc8ec",
"v1.2.2 5316ede928b01a20571103616a64666abbc40e0a",
"v1.2.3 5ae86929851ff6a62342a7072b77e9cf5be85f1c",
"v1.2.4 b7ac057d75e88736cc844de0bafb447a48f2fb6d",
"v1.2.5 db51f0520a673074a14ef0f5c4434da0d5c3425f",
]
[[packages]]
name = "PikaStdLib"
releases = [
"v1.0.1 af42fd61884dc7048628b0d3bafaa42697f6e8ea",
"v1.1.0 0b3b866dbacc363c7b6b3899faa0cbcaccd59d5e",
"v1.2.0 ca29e112687525ee7511bd30418d368754627a00",
"v1.2.1 5ae86929851ff6a62342a7072b77e9cf5be85f1c",
"v1.2.2 b7ac057d75e88736cc844de0bafb447a48f2fb6d",
]
[[packages]]
name = "PikaStdDevice"
releases = [
"v1.4.0 29c3c5b3b0cb4d3e41e6a2a0aef9e2826bc6f7ba",
"v1.4.1 6539072bf7bebb242ea40f8595bfb5c9aae3de7f",
]
[[packages]]
name = "STM32"
releases = [
"v1.0.0 af42fd61884dc7048628b0d3bafaa42697f6e8ea",
"v1.0.1 af42fd61884dc7048628b0d3bafaa42697f6e8ea",
"v1.0.2 af42fd61884dc7048628b0d3bafaa42697f6e8ea",
"v1.1.0 a18910b5dc349c64297bba3a13b7044f41d48e5f",
"v1.1.1 91818aab0fa87b007e84866d479af5ac507339fe",
"v1.2.0 6bd4aac6e9aba2a603da602be8583021da1272c0",
"v1.3.0 7b816b1546ef91a03f77760d4b10806ab956d452",
"v1.4.0 29c3c5b3b0cb4d3e41e6a2a0aef9e2826bc6f7ba",
"v1.4.1 6539072bf7bebb242ea40f8595bfb5c9aae3de7f",
"v1.4.2 8866710f653ad005f5c3edc5e6417ad31075b7d5",
"v2.0.0 e29a77527fd753c4eb811b047899534472bfc8ec",
"v2.0.1 5ae86929851ff6a62342a7072b77e9cf5be85f1c",
]
If you want to publish a module, create a new folder with the same name as the module in the pikascript/package directory, and then copy all the files contained in the module to this folder. After submitting the folder and obtaining the commit id, fill in the commit id into the packages.toml description file.
Note: To limit the complexity of modules and improve maintainability, nested folders are not supported in module folders.
- The *.py and *.pyi files contained in the module folder will be automatically copied to the current folder, in order to be able to recognize the python module (python only recognizes the module files in the current folder when importing a module.)
If you are suspected of encountering problems during use, you can run pikaPackage.exe in cmd to view the complete log information.