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

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
mathieuprog
Hello :waving_hand: Allow me to introduce you to Tz, an alternative time zone database support to Tzdata. Why another library? First a...
New
cjen07
parameterized pipe in elixir: |n> edit: negative index in |n> and mixed usage with |> are supported example: use ParamPipe ...
New
michalmuskala
Another small library today. PersistentEts Hex: persistent_ets | Hex GitHub: GitHub - michalmuskala/persistent_ets · GitHub Ets table ...
New
Jskalc
Hi! Today, after a couple weeks of development I’ve released v0.1 of LiveVue. It’s a seamless integration of Vue and Phoenix LiveView, i...
New
achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
markmark206
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
New
Qqwy
TypeCheck: Fast and flexible runtime type-checking for your Elixir projects. Core ideas Type- and function specifications are const...
336 14327 100
New
zoltanszogyenyi
Hey everyone :waving_hand: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New

Other popular topics Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

We're in Beta

About us Mission Statement