For PB6?: pbpm - PB Package Manager

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Yann64
User
User
Posts: 24
Joined: Wed Nov 10, 2004 1:06 pm
Contact:

For PB6?: pbpm - PB Package Manager

Post by Yann64 »

There is an increase in programming languages coming with a package manager to lower the burden of managing dependencies:
  • rust: cargo
  • NodeJS: npm
  • D: dub
  • fortran: fpm
  • etc…
In most cases, these package-managers will also handle the project directory creation/structure (so dependencies get correctly imported/linked).

Would that be something which would be of interest for a PB v6?
Yann64
User
User
Posts: 24
Joined: Wed Nov 10, 2004 1:06 pm
Contact:

Re: For PB6?: pbpm - PB Package Manager

Post by Yann64 »

Hi BarryG

Rust, Fortran, etc also create stand alone executable. The main added value of package managers is:
allow to easily manage external and up to date libs to be linked in the final stand alone executable.

Lets say I develop a lib/module/wrapper in pb. If you want to use it, instead of manually getting the files from my website, a package manager would ensure the latest and up to date version is used at each compile. So if I update my project, your project wil benefit from my changes.

Package managers can also have other functionalities like project structure initialization and management. Initialization of scm (git, mercurial, etc...), some even do the associated code documentation generation. But to me this is of lower priority.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: For PB6?: pbpm - PB Package Manager

Post by BarryG »

Hi Yann64, sorry, I deleted my post before you replied because I misunderstood what you meant, but you obviously saw it first.
Yann64
User
User
Posts: 24
Joined: Wed Nov 10, 2004 1:06 pm
Contact:

Re: For PB6?: pbpm - PB Package Manager

Post by Yann64 »

No problem :)
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: For PB6?: pbpm - PB Package Manager

Post by Sicro »

With the PB-CodeArchiv project on GitHub, I actually want to realize that in the end. But there is currently little interest in the PB community to manage codes in a versioning system like GitHub, which would actually be mandatory for a package manager.

In addition, I have created a feature request since a long time in the forum, which would be important for a PB package manager: IDE: Plugin system via PBI files
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Yann64
User
User
Posts: 24
Joined: Wed Nov 10, 2004 1:06 pm
Contact:

Re: For PB6?: pbpm - PB Package Manager

Post by Yann64 »

Hi Sicro, that's already quite some effort put in the good direction!

For source code management solutions (git, mercurial, ...) to be used by the community, I guess someone will have to come-up with a clear benefit for the community to start adopting it. A package would bring that benefit, so I guess someone has to deliver to initiate the whole thing :wink:

Two remarks:
  • I am not too sure the package sources should all be hosted in the same git repository as I fear managing package versions, package specific tickets, will quickly become too difficult as you will end-up with a huge repository.
    I would rather have a main repository somehow managing the package list. Packages themselves would be hosted in their own repository (structure to be standardized), with the added benefits that each of them can be imported independently (no git clone of the entire repository), compiled as a library for direct linking at compile time, and even host their own catalog to enable auto-completion when the library is imported. There should probably be a definition file at the root of the repository to define dependencies to other packages.
  • As the IDE was open sourced, it would maybe be possible to pass flags as compile time pointing to the downloaded libs? The package manager IDE can probably simply be added in the Tools menu (for a start).
Any thought on these points?
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: For PB6?: pbpm - PB Package Manager

Post by Sicro »

Yann64 wrote:I am not too sure the package sources should all be hosted in the same git repository as I fear managing package versions, package specific tickets, will quickly become too difficult as you will end-up with a huge repository.
Yes, I am aware of that. From the beginning, the CodeArchiv has the role of archiving the PB source codes from the forums in a categorized form where all the source codes work out-of-the-box. No cumbersome copy and paste of the source codes from the forum posts.

With the download of the archive you get a big package, with many source codes at once, and can work completely offline. If you want to have only specific source codes, you can simply navigate to the URL of the source code and download it individually (yes, I know, cumbersome if the source code has included source codes that have to be downloaded individually as well).

Navigating individual package versions via version numbers is not planned for the CodeArchiv. Older source code versions can only be checked out via older commits.

However, the CodeArchiv is also rather to be seen as a whole, therefore it is (or was) planned to version the CodeArchiv as a whole: Project Releases Using PB Version as Tags
Yann64 wrote:I would rather have a main repository somehow managing the package list. Packages themselves would be hosted in their own repository (structure to be standardized), with the added benefits that each of them can be imported independently (no git clone of the entire repository)
Yes, this is how I have planned it. There will be a new repository "PB-Packages", which will then only provide a package list and the source codes in the CodeArchiv will each be moved to separate repositories as packages. The authors of the packages should create their own repositories and manage them themselves.
Yann64 wrote:compiled as a library for direct linking at compile time
Are you talking about PB PureLibraries? As I can read from this README (purebasic/sdk/libraries-maker/README), the creation of these PB PureLibraries requires that the source code is written in ASM or C. However, most write PB source codes here, so this is not an option. But recently it was announced by the PB developers that they are developing a C compiler backend for the PB compiler. Maybe then PB PureLibraries can also be created with PB source codes. I am curious.

Currently, I haven't found a good way to automatically include PB source codes during compilation.

If we write a preprocessor that temporarily modifies the user's PB source code before compilation by automatically including the packages with IncludeFile lines at the top, there is a serious drawback: if the user has an error on line 5 in his PB source code, the compiler might report that the error was made on line 100, because the user's PB source code lines shift, due to the automatically included package PB source code. I already had the idea, see here: viewtopic.php?p=521087#p521087
In addition, auto-complete is missing.
Yann64 wrote:and even host their own catalog to enable auto-completion when the library is imported
Not required for PB PureLibraries as far as I know. And in case the library is PB source code, the package manager can create such a catalog automatically during package installation.

In addition, PB IDE has no such catalog support yet and would have to be developed first. In the PB IDE there is a feature called "Managing Projects". There is the option:
Scan file for AutoComplete
Files with this option will be scanned for AutoComplete data even when they are not currently loaded in the IDE. This option is on by default for all non-binary files. It should be turned off for all files that do not contain source code as well as for any files where you do not want the items to turn up in the AutoComplete list.
Maybe we could extract the PB source code of this function from the PureBasic IDE source code and adapt it for this purpose.
Yann64 wrote:There should probably be a definition file at the root of the repository to define dependencies to other packages.
Yes, definitely. There are already discussions about this and some other topics: Improvement of code metadata
Yann64 wrote:As the IDE was open sourced, it would maybe be possible to pass flags as compile time pointing to the downloaded libs?
The solution should not be PB IDE dependent, because PB source codes can also be compiled without the PB IDE. As written above, unfortunately I haven't found a good solution yet to include PB source codes automatically.
Yann64 wrote:The package manager IDE can probably simply be added in the Tools menu (for a start).
Yes, should work as a PB IDE tool, but also as a standalone tool.
Yann64 wrote:For source code management solutions (git, mercurial, ...) to be used by the community, I guess someone will have to come-up with a clear benefit for the community to start adopting it. A package would bring that benefit, so I guess someone has to deliver to initiate the whole thing
Sure. I will do that. But currently I think I'll wait until there are clean ways to be able to include packages automatically so that auto-complete is also available. Developing the package manager and everything that goes with it will be a lot of work again. Because of the mentioned reasons, I see therefore currently no sense to start the work. As written above, it may be possible soon when the C compiler backend is developed and then maybe PB PureLibraries can also be built from PB source code.
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
User avatar
PureBasti
New User
New User
Posts: 8
Joined: Sat Oct 13, 2018 9:02 am

Re: For PB6?: pbpm - PB Package Manager

Post by PureBasti »

A package manager would be greate :)
Post Reply