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: https://hex.pm/blog/announcing-hex-core

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: https://github.com/hexpm/hex_core/issues/32.

Where Next?

Popular in Libraries Top

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
hpopp
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
sabiwara
Dune is a sandbox for Elixir and aims to safely evaluate user-provided code. You can try it out using this basic Elixir playground made ...
New
josevalim
EDIT: since Ecto 3.0 final version is out, this post was amended to use the final versions in the instructions below. Hi everyone, We a...
New
blatyo
https://www.conduitframework.com/ The best overview for how things are tied together is this presentation. Modules and functions are pre...
New
tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
Qqwy
Hello everyone, I wrote a small library today called MapDiff. It returns a map listing the (smallest amount of) changes to get from map...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
wmnnd
Hi there, for my project DBLSQD, I needed a file storage solution that is a bit more flexible than Arc. Because I thought others might f...
New
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_or...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
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
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Sub Categories:

We're in Beta

About us Mission Statement