wojtekmach

wojtekmach

Hex Core Team

Announcing hex_core

Today we are releasing the first version of hex_core, an Erlang library to interact with Hex.pm and other servers implementing Hex specifications.

Before talking about hex_core, let’s ask a simple question: What is Hex? The short answer is, it’s a package manager for the Erlang ecosystem. The long answer is that by Hex we may mean a few different things:

  1. A set of specifications of building clients and servers that can interact with each other: https://github.com/hexpm/specifications
  2. A server for hosting packages like the official server located at https://hex.pm
  3. Clients for interacting with servers, e.g. Hex for Elixir and rebar3_hex for Erlang projects

The goal of hex_core is to be the reference implementation of Hex specifications used by Hex clients and servers.

As of this announcement the hex_core package itself is available on Hex.pm.

Usage in an Erlang project

  1. Create a new project: rebar3 new lib example

  2. Add hex_core to rebar.config:

    {deps, [
      {hex_core, "0.1.0"}
    ]}
    
  3. Start the shell to and count all packages published to Hex.pm:

    $ rebar3 shell
    erl> inets:start(), ssl:start(),
    erl> Config = hex_core:default_config(),
    erl> {ok, {200, _, #{packages := Packages}}} = hex_repo:get_names(Config),
    erl> length(Packages).
    6764
    

Usage in an Elixir project

  1. Create a new project: mix new example

  2. Add hex_core to mix.exs:

    defp deps() do
      [{:hex_core, "~> 0.1"}]
    end
    
  3. Start the shell to and search for all packages matching query “riak”:

    $ iex -S mix
    iex> :inets.start() ; :ssl.start()
    iex> config = :hex_core.default_config()
    iex> options = [sort: :downloads]
    iex> {:ok, {200, _, packages}} = :hex_api_package.search(config, "riak", options)
    iex> Enum.map(packages, & &1["name"])
    ["riak_pb", "riakc", ...]
    

See README at https://github.com/hexpm/hex_core for more usage examples.

Future work

After the initial release we plan to work with the community to integrate hex_core into their projects and respond to feedback.

We will also be focused on releasing a minimal Hex server, built on top of hex_core, to be a starting point for people wanting to run Hex on their own infrastructure. Stay tuned!

Link to original announcement: Announcing hex core | Hex

Most Liked

aseigo

aseigo

w00t! Already using it in hexagon. Not a big fan of the API exposing the http details so directly (response codes and raw headers) as I feel it exposes implementation details too directly, but other than that small niggle it’s been a pleasure to use. Kudos to the hex devs! :slight_smile:

wojtekmach

wojtekmach

Hex Core Team

Hexagon is exactly the kind of project we wanted people to build with hex_core, thanks again for that! I’ve created an issue to discuss the API: High-level API · Issue #32 · hexpm/hex_core · GitHub.

Where Next?

Popular in Announcing Top

Azolo
Hey everyone, I just released WebSockex which is a Elixir WebSocket client. WebSockex strives to work as a OTP special process, be RFC6...
New
pkrawat1
Hey guyz We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it. Have...
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: GitHub - devonestes/assertions: Helpful a...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
384 14585 119
New

Other popular topics Top

grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54092 488
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44608 311
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement