Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for importing packages from the registry and http/https served files #1049

Merged
merged 23 commits into from
Aug 16, 2024
Merged

Conversation

shehab299
Copy link

The package installer is a module embedded in the Faust compiler that interacts with the registry to download packages.

Dependency: libcurl

The package installer relies on libcurl for handling networking tasks such as downloading packages. To ensure the package installer functions correctly, make sure libcurl is installed on your system.

To install libcurl, you can follow the tutorial available here. This guide provides detailed instructions for various operating systems, including Linux, Windows, and macOS.


Downloading Packages

When you import a package using the pkgUrl syntax, the package installer automatically downloads the specified package from the registry.

Example

import("pkg:faust/username/[email protected]");

In this example, the Faust compiler will:

  1. Resolve the package URL: The pkgUrl is parsed to identify the user, library, and version.
  2. Download the package: The package installer fetches the specified version of the library from the remote registry.
  3. Cache the package locally: The downloaded package is cached in the local registry for future use.

If the package is already cached, the installer will use the cached version instead of downloading it again, unless a different version is specified.

Caching Packages

When you import a package using pkgUrl, Faust caches these packages in a local registry on your device.

Local Registry Path

The path to the local registry is configurable via the environment variable:

  • FAUST_REGISTRY_PATH: Defines the location of the local registry.

Default Paths

By default, FAUST_REGISTRY_PATH is set to:

  • Linux:

    $HOME/.faust/registry
    
  • Windows:

    %AppDATA%\Faust\registry
    
  • macOS:

    $HOME/Library/Faust/Registry
    

Default Registry URL

By default, the package installer deals with the official Faust Registry, which is hosted on GitHub:

  • FAUST_REGISTRY_URL: An environment variable that defines the URL of the registry.
    • Default: https://github.com/shehab299/Registry.git

Default Branch

The package installer uses the default branch of the registry repository for fetching packages:

  • FAUST_REGISTRY_BRANCH: An environment variable that defines the branch of the registry to use.
    • Default: main

Custom Registry Configuration

If you want to create replicas of the registry in your organization or use a different branch, you can configure these using the environment variables FAUST_REGISTRY_URL and FAUST_REGISTRY_BRANCH.

Testing

A Python script has been added to the faust repo to automate testing. This script runs all DSP files in the examples folder and indicates whether each test passed or failed.

python3 test.py
  • There are failed test because of a stackoverflow error

@orlarey orlarey merged commit dde84df into grame-cncm:master-dev-pacman Aug 16, 2024
sletz pushed a commit that referenced this pull request Jan 7, 2025
…erved files (#1049)

* Added package manager module

* Fixing Error Messages and Error handling

* Added --package-only and --pkg-list options in the compiler

* Changed Example to use the new package format

* Changed help to contain the new options

* Added a url handling library and changed the way i handle the registry url

* Added WASM compatiable code

* Batch to fix stackoverflow error in browsers

* add node support for xhr requests

* Update Downloader.cpp

* change xhr requests to fetch

* testing

* x

* xmlrequest support

* remove async debug

* Fix the versions in examples and add a test script

* update libraries

* add author in error messages

* Solve the problem with XMLHttpRequest isn't a constructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants