Skip to content

Releases: elixir-lang/elixir

v1.9.0

24 Jun 15:24
Compare
Choose a tag to compare

Releases

The main feature in Elixir v1.9 is the addition of releases. A release is a self-contained directory that consists of your application code, all of its dependencies, plus the whole Erlang Virtual Machine (VM) and runtime. Once a release is assembled, it can be packaged and deployed to a target as long as the target runs on the same operating system (OS) distribution and version as the machine running the mix release command.

You can start a new project and assemble a release for it in three easy steps:

$ mix new my_app
$ cd my_app
$ MIX_ENV=prod mix release

A release will be assembled in _build/prod/rel/my_app. Inside the release, there will be a bin/my_app file which is the entry point to your system. It supports multiple commands, such as:

  • bin/my_app start, bin/my_app start_iex, bin/my_app restart, and bin/my_app stop - for general management of the release

  • bin/my_app rpc COMMAND and bin/my_app remote - for running commands on the running system or to connect to the running system

  • bin/my_app eval COMMAND - to start a fresh system that runs a single command and then shuts down

  • bin/my_app daemon and bin/my_app daemon_iex - to start the system as a daemon on Unix-like systems

  • bin/my_app install - to install the system as a service on Windows machines

Why releases?

Releases allow developers to precompile and package all of their code and the runtime into a single unit. The benefits of releases are:

  • Code preloading. The VM has two mechanisms for loading code: interactive and embedded. By default, it runs in the interactive mode which dynamically loads modules when they are used for the first time. The first time your application calls Enum.map/2, the VM will find the Enum module and load it. There’s a downside. When you start a new server in production, it may need to load many other modules, causing the first requests to have an unusual spike in response time. Releases run in embedded mode, which loads all available modules upfront, guaranteeing your system is ready to handle requests after booting.

  • Configuration and customization. Releases give developers fine grained control over system configuration and the VM flags used to start the system.

  • Self-contained. A release does not require the source code to be included in your production artifacts. All of the code is precompiled and packaged. Releases do not even require Erlang or Elixir in your servers, as they include the Erlang VM and its runtime by default. Furthermore, both Erlang and Elixir standard libraries are stripped to bring only the parts you are actually using.

  • Multiple releases. You can assemble different releases with different configuration per application or even with different applications altogether.

Hooks and Configuration

Releases also provide built-in hooks for configuring almost every need of the production system:

  • config/config.exs (and config/prod.exs) - provides build-time application configuration, which is executed when the release is assembled

  • config/releases.exs - provides runtime application configuration. It is executed every time the release boots and is further extensible via config providers

  • rel/vm.args.eex - a template file that is copied into every release and provides static configuration of the Erlang Virtual Machine and other runtime flags

  • rel/env.sh.eex and rel/env.bat.eex - template files that are copied into every release and executed on every command to set up environment variables, including ones specific to the VM, and the general environment

We have written extensive documentation on releases, so we recommend checking it out for more information.

Configuration overhaul

A new Config module has been added to Elixir. The previous configuration API, Mix.Config, was part of the Mix build tool. But since releases provide runtime configuration and Mix is not included in releases, we ported the Mix.Config API to Elixir. In other words, use Mix.Config has been soft-deprecated in favor of import Config.

Another important change related to configuration is that mix new will no longer generate a config/config.exs file. Relying on configuration is undesired for most libraries and the generated config files pushed library authors in the wrong direction. Furthermore, mix new --umbrella will no longer generate a configuration for each child app, instead all configuration should be declared in the umbrella root. That's how it has always behaved, we are now making it explicit.

Other enhancements

There are many other enhancements. The Elixir CLI got a handful of new options in order to best support releases. Logger now computes its sync/async/discard thresholds in a decentralized fashion, reducing contention. EEx templates support more complex expressions than before. Finally, there is a new ~U sigil for working with UTC DateTimes as well as new functions in the File, Registry, and System modules.

v1.9.0 (2019-06-24)

1. Enhancements

EEx

  • [EEx] Allow more complex mixed expressions when tokenizing

Elixir

  • [Access] Allow Access.at/1 to handle negative index
  • [CLI] Add support for --boot, --boot-var, --erl-config, --pipe-to, --rpc-eval, and --vm-args options
  • [Code] Add static_atom_encoder option to Code.string_to_quoted/2
  • [Code] Support :force_do_end_blocks on Code.format_string!/2 and Code.format_file!/2
  • [Code] Do not raise on deadlocks on Code.ensure_compiled/1
  • [Config] Add Config, Config.Reader, and Config.Provider modules for working with configuration
  • [File] Add File.rename!/2
  • [Inspect] Add :inspect_fun and :custom_options to Inspect.Opts
  • [Kernel] Add ~U sigil for UTC date times
  • [Kernel] Optimize &super/arity and &super(&1)
  • [Kernel] Optimize generated code for with with a catch-all clause
  • [Kernel] Validate __struct__ key in map returned by __struct__/0,1
  • [Module] Add Module.get_attribute/3
  • [Protocol] Improve Protocol.UndefinedError messages to also include the type that was attempted to dispatch on
  • [Protocol] Optimize performance of dynamic dispatching for non-consolidated protocols
  • [Record] Include field names in generated type for records
  • [Regex] Automatically recompile regexes
  • [Registry] Add Registry.select/2
  • [System] Add System.restart/0, System.pid/0 and System.no_halt/1
  • [System] Add System.get_env/2, System.fetch_env/1, and System.fetch_env!/1
  • [System] Support SOURCE_DATE_EPOCH for reproducible builds

ExUnit

  • [ExUnit] Allow multiple :exclude on configuration/CLI
  • [ExUnit.DocTest] No longer wrap doctest errors in custom exceptions. They ended-up hiding more information than showing
  • [ExUnit.DocTest] Display the actual doctest code when doctest fails

IEx

  • [IEx.CLI] Copy ticktime from remote node on IEx --remsh
  • [IEx.CLI] Automatically add a host on node given to --remsh

Logger

  • [Logger] Use a decentralized mode computation for Logger which allows overloads to be detected more quickly
  • [Logger] Use persistent_term to store configuration whenever available for performance

Mix

  • [Mix] Follow XDG base dir specification in Mix for temporary and configuration files
  • [Mix.Generator] Add copy_file/3, copy_template/4, and overwite?/2
  • [Mix.Project] Add preferred_cli_target that works like preferred_cli_env
  • [mix archive.uninstall] Allow mix archive.uninstall APP to uninstall any installed version of APP
  • [mix new] No longer generate a config/ directory for mix new
  • [mix release] Add support for releases
  • [mix release.init] Add templates for release configuration
  • [mix test] Allow running tests for a given umbrella app from the umbrella root with mix test apps/APP/test. Test failures also include the apps/APP prefix in the test location

2. Bug fixes

EEx

  • [EEx] Consistently trim newlines when you have a single EEx expression per line on multiple lines

Elixir

  • [Code] Quote :: in Code.format_string!/1 to avoid ambiguity
  • [Code] Do not crash formatter on false positive sigils
  • [Enum] Ensure the first equal entry is returned by Enum.min/2 and Enum.max/2
  • [Kernel] Improve error message when string interpolation is used in a guard
  • [Kernel] Properly merge and handle docs for callbacks with multiple clauses
  • [Kernel] Guarantee reproducible builds on modules with dozens of specs
  • [Kernel] Resolve __MODULE__ accordingly in nested defmodule to avoid double nesting
  • [Kernel] Type variables starting with an underscore (_foo) should not raise compile error
  • [Kernel] Keep order of elements when macro in/2 is expanded with a literal list on the right-hand side
  • [Kernel] Print proper location on undefined function error from dynamically generated functions
  • [System] Make sure :init.get_status/0 is set to {:started, :started} once the system starts
  • [Path] Do not expand ~ in Path.expand/2 when not followed by a path separator
  • [Protocol] Ensure debug_info is kept in protocols
  • [Regex] Ensure inspect returns valid ~r// expressions when they are manually compiled with backslashes
  • [Registry] Fix ETS leak in Registry.register/2 for already registered calls in unique registries while the process is still alive

ExUnit

  • [ExUnit] Raise error if attempting to run single line tests on multiple files
  • [ExUnit] Return proper error on duplicate child IDs on start_supervised

IEx

  • [IEx] Automatically shut down IEx if we receive EOF

Logger

  • [Logger] D...
Read more

v1.9.0-rc.0

04 Jun 11:26
Compare
Choose a tag to compare
v1.9.0-rc.0 Pre-release
Pre-release
Release v1.9.0-rc.0

v1.8.2

12 May 14:50
Compare
Choose a tag to compare

1. Bug fixes

EEx

  • [EEx] Raise readable error message on bad EEx state

Elixir

  • [Protocol] Ensure :debug_info is kept in protocols

Logger

  • [Logger] Make sure Logger v1.8 does not get stuck in discard mode
  • [Logger.Translator] Translate remote process crash in Logger

Checksums

  • Precompiled.zip SHA1: 661dbf612c4b5fdb4390ff54121d82ff9452c3f3
  • Precompiled.zip SHA512: f110669f99f8716e71f66b74d9604edabd1ed5b041e69962c01bae5274165e86ae95773d2e117ebf7f462fb68f3a2ae7891e50df372d676c2f1d975da59aa9e5
  • Docs.zip SHA1: 9bafded1b743437938af8e29d63d06dea44ee96e
  • Docs.zip SHA512: 409030abaaf1bcc87dbda850058f36a2f4e4b29ef7c086c130b1619f3d44c79276b8ec42796fb9723704a948db1f828146dc85aa15477029e3cceeb6d6007163

v1.8.1

30 Jan 10:47
Compare
Choose a tag to compare

1. Bug fixes

Elixir

  • [Float] Fix rounding for subnormal floats

IEx

  • [IEx] Fix IEx.pry crash when IEx isn't running
  • [IEx.CLI] Add IEx warning when using --remsh with "dumb" terminal
  • [IEx.Helpers] Sort results by arity on h helper

Mix

  • [mix compile] Do not include optional dependencies in extra applications as it is incompatible with shared deps in umbrellas

Checksums

  • Precompiled.zip SHA1: 9b9a15b299b15c78ec9c1c92cdcf293905290d09
  • Precompiled.zip SHA512: 17c2d07eb4bc259031e7b9f1449bc2a16745a6fb1f3685ed5153da624f87fe49cc61b304a0cb531cbda3407f041b517e2b508cf0b3aa9a998e23598c301c7886
  • Docs.zip SHA1: 6b98c75d8e905c849898b708b60e3449ba0c5291
  • Docs.zip SHA512: d3f9bc4821c0d1c284b3e233d2f46c7eb6a3173d5a58d1066078ae62a9cf06c3235d0073715083fc67dda279603a9ea4fbe937d042c321fdec56531588dd0c9a

v1.8.0

14 Jan 15:03
Compare
Choose a tag to compare

Elixir v1.8 comes with many improvements at the infrastructure level, improving compilation time, speeding up common patterns, and adding features around introspection of the system.

Custom struct inspections

Elixir now provides a derivable implementation of the Inspect protocol. In a nutshell, this means it is really easy to filter data from your data structures whenever they are inspected. For example, imagine you have a user struct with security and privacy sensitive information:

defmodule User do
  defstruct [:id, :name, :age, :email, :encrypted_password]
end

By default, if you inspect a user via inspect(user), it will include all fields. This can cause fields such as :email and :encrypted_password to appear in logs, error reports, etc. You could always define a custom implementation of the Inspect protocol for such cases but Elixir v1.8 makes it simpler by allowing you to derive the Inspect protocol:

defmodule User do
  @derive {Inspect, only: [:id, :name, :age]}
  defstruct [:id, :name, :age, :email, :encrypted_password]
end

Now all user structs will be printed with all remaining fields collapsed:

#User<id: 1, name: "Jane", age: 33, ...>

You can also pass @derive {Inspect, except: [...]} in case you want to keep all fields by default and exclude only some.

Time zone database support

In Elixir v1.3, Elixir added four types, known as Calendar types, to work with dates and times: Time, Date, NaiveDateTime (without time zone) and DateTime (with time zone). Over the last releases we have added many enhancements to the Calendar types but the DateTime module always evolved at a slower pace since Elixir did not provide support for a time zone database.

Elixir v1.8 now defines a Calendar.TimeZoneDatabase behaviour, allowing developers to bring in their own time zone databases. By defining an explicit contract for time zone behaviours, Elixir can now extend the DateTime API, adding functions such as DateTime.shift_zone/3. By default, Elixir ships with a time zone database called Calendar.UTCOnlyTimeZoneDatabase that only handles UTC.

Other Calendar related improvements include the addition of Date.day_of_year/1, Date.quarter_of_year/1, Date.year_of_era/1, and Date.day_of_era/1.

Faster compilation and other performance improvements

Due to improvements to the compiler made over the last year, Elixir v1.8 should compile code about 5% faster on average. This is yet another release where we have been able to reduce compilation times and provide a more joyful development experience to everyone.

The compiler also emits more efficient code for range checks in guards (such as x in y..z), for charlists with interpolation (such as 'foo #{bar} baz'), and when working with records via the Record module.

Finally, EEx templates got their own share of optimizations, emitting more compact code that runs faster.

Improved instrumentation and ownership with $callers

The Task module is one of the most common ways to spawn light-weight processes to perform work concurrently. Whenever you spawn a new process, Elixir annotates the parent of that process through the $ancestors key. This information can be used by instrumentation tools to track the relationship between events occurring within multiple processes. However, many times, tracking only the $ancestors is not enough.

For example, we recommend developers to always start tasks under a supervisor. This provides more visibility and allows us to control how those tasks are terminated when a node shuts down. In your code, this can be done by invoking something like: Task.Supervisor.start_child(MySupervisor, task_specification). This means that, although your code is the one who invokes the task, the actual parent of the task would be the supervisor, as the supervisor is the one spawning it. We would list the supervisor as one of the $ancestors for the task, but the relationship between your code and the task is lost.

In Elixir v1.8, we now track the relationship between your code and the task via the $callers key in the process dictionary, which aligns well with the existing $ancestors key. Therefore, assuming the Task.Supervisor call above, we have:

[your code] -- calls --> [supervisor] ---- spawns --> [task]

which means we store the following relationships:

[your code]              [supervisor] <-- ancestor -- [task]
     ^                                                  |
     |--------------------- caller ---------------------|

When a task is spawned directly from your code, without a supervisor, then the process running your code will be listed under both $ancestors and $callers.

This small feature is very powerful. It allows instrumentation and monitoring tools to better track and relate the events happening in your system. This feature can also be used by tools like the "Ecto Sandbox". The "Ecto Sandbox" allows developers to run tests concurrently against the database, by using transactions and an ownership mechanism where each process explicitly gets a connection assigned to it. Without $callers, every time you spawned a task that queries the database, the task would not know its caller, and therefore it would be unable to know which connection was assigned to it. This often meant features that relies on tasks could not be tested concurrently. With $callers, figuring out this relationship is trivial and you have more tests using the full power of your machine.

1. Enhancements

EEx

  • [EEx] Optimize the default template engine to compile and execute more efficiently

Elixir

  • [Calendar] Add Calendar.TimeZoneDatabase and a Calendar.UTCOnlyTimeZoneDatabase implementation
  • [Calendar] Add callbacks day_of_year/3, quarter_of_year/3, year_of_era/1, and day_of_era/3
  • [Code.Formatter] Preserve user's choice of new line after most operators
  • [Date] Add Date.day_of_year/1, Date.quarter_of_year/1, Date.year_of_era/1, and Date.day_of_era/1
  • [DateTime] Add DateTime.from_naive/3, DateTime.now/1, and DateTime.shift_zone/3
  • [File] Allow :raw option in File.exists?/2, File.regular?/2, and File.dir?/2
  • [File] Allow POSIX time as an integer in File.touch/2 and File.touch!/2
  • [Inspect] Allow Inspect protocol to be derivable with the :only/:except options
  • [Kernel] Do not propagate counters to variables in quote inside another quote
  • [Kernel] Warn on ambiguous use of :: and | in typespecs
  • [Kernel] Add :delegate_to @doc metadata tag when using defdelegate
  • [Kernel] Improve compile-time building of ranges via the .. operator
  • [Kernel] Compile charlist interpolation more efficiently
  • [Kernel] Add floor/1 and ceil/1 guards
  • [Kernel.SpecialForms] Add :reduce option to for comprehensions
  • [List] Add List.myers_difference/3 and List.improper?/1
  • [Macro] Add Macro.struct!/2 for proper struct resolution during compile time
  • [Map] Optimize and merge nested maps put and merge operations
  • [Range] Add Range.disjoint?/2
  • [Record] Reduce memory allocation when updating multiple fields in a record
  • [Registry] Allow associating a value on :via tuple
  • [String] Add String.bag_distance/2
  • [Task] Add $callers tracking to Task - this makes it easier to find which process spawned a task and use it for tracking ownership and monitoring

ExUnit

  • [ExUnit] Add ExUnit.after_suite/1 callback
  • [ExUnit.Assertions] Show last N messages (instead of first N) from mailbox on assert_receive fail

IEx

  • [IEx.Helpers] Add port/1 and port/2
  • [IEx.Server] Expose IEx.Server.run/1 for custom IEx sessions with the ability to broker pry sessions

Mix

  • [Mix] Add Mix.target/0 and Mix.target/1 to control dependency management per target
  • [Mix.Project] Add :depth and :parents options to deps_paths/1
  • [mix archive.install] Add a timeout when installing archives
  • [mix compile] Include optional dependencies in :extra_applications
  • [mix escript.install] Add a timeout when installing escripts
  • [mix format] Warn when the same file may be formatted by multiple .formatter.exs
  • [mix test] Allow setting the maximum number of failures via --max-failures
  • [mix test] Print a message instead of raising on unmatched tests inside umbrella projects

2. Bug fixes

Elixir

  • [Calendar] Allow printing dates with more than 9999 years
  • [Exception] Exclude deprecated functions in "did you mean?" hints
  • [Float] Handle subnormal floats in Float.ratio/1
  • [Kernel] Remove Guard test tuple_size(...) can never succeed Dialyzer warning on try
  • [Kernel] Expand operands in size*unit bitstring modifier instead of expecting size and unit to be literal integers
  • [Kernel] Do not deadlock on circular struct dependencies in typespecs
  • [Kernel] Raise proper error message when passing flags to the Erlang compiler that Elixir cannot handle
  • [Kernel] Do not leak variables in cond clauses with a single matching at compile-time clause
  • [NaiveDateTime] Do not accept leap seconds in builder and parsing functions
  • [String] Fix ZWJ handling in Unicode grapheme clusters
  • [StringIO] Handle non-printable args in StringIO gracefully

IEx

  • [IEx.Helpers] Use typespec info (instead of docs chunk) and properly format callbacks in b/1

Logger

  • [Logger] Allow Logger backends to be dynamically removed when an application is shutting down

Mix

  • [mix compile] Ensure changes in deps propagate to all umbrella children - this fix a long standing issue where updating a dependency would not recompile all projects accordingly, requiring a complete removal of _build
  • [mix compile] Av...
Read more

v1.8.0-rc.1

02 Jan 19:32
Compare
Choose a tag to compare
v1.8.0-rc.1 Pre-release
Pre-release
Release v1.8.0-rc.1

v1.8.0-rc.0

24 Dec 14:42
Compare
Choose a tag to compare
v1.8.0-rc.0 Pre-release
Pre-release
Release v1.8.0-rc.0

v1.7.4

24 Oct 18:18
Compare
Choose a tag to compare

1. Enhancements

Elixir

  • [Kernel] Expand left..right at compile time in more cases, which leads to improved performance under different scenarios, especially on x in left..right expressions

Mix

  • [mix deps.loadpaths] Add --no-load-deps flag. This is useful for Rebar 3 compatibility

2. Bug fixes

Elixir

  • [Calendar] Fix for converting from negative iso days on New Year in a leap year
  • [Kernel] Ensure @spec, @callback, @type and friends can be read accordingly
  • [Module] Avoid warnings when using Module.eval_quoted in the middle of existing definitions

Mix

  • [mix archive.build] Unload previous archive versions before building
  • [mix format] Expand paths so mix format path\for\windows.ex works
  • [mix test] Ensure that --cover displays correct coverage in an umbrella app

Checksums

  • Precompiled.zip SHA1: eb328d3b071b33d80ad4cb4b3b203c1b2d7a5186
  • Precompiled.zip SHA512: 807002481ae129fa1610a1facabe19765e2542397923d5c89e16b58f54870f2e444973e136d6b1207190b3117c03a37430860b6e3e6b7d59b3afb1b01852c6e3
  • Docs.zip SHA1: 47ae4cea91a2da8ff040e346c059afccbdbffa13
  • Docs.zip SHA512: 5b760a37e45640ab5816ad3ef2b581071e534fd0c409aa1a5348ee9a44980b099f54d66a3f9228be4ece1481a24b7109b1c9ac01d0aa0df4713fb0be1ca2de35

v1.7.3

24 Aug 18:53
Compare
Choose a tag to compare

1. Bug fixes

ExUnit

  • [ExUnit.Assertions] Do not attempt to expand try/1 as it is a special form

Mix

  • [mix compile.app] Do not include applications with runtime: false as a runtime dependency for applications coming from Hex

Checksums

  • Precompiled.zip SHA1: 9bfe816aaedeb9c5d40095b4eb4f5cb07eb33c2b
  • Precompiled.zip SHA512: f8b0ac405531d46f4b65f459970c4b82892f8db51028f172072748269a922db65cb58e36239cd26dc39e5bdebd08a0e630ecbc267b6ff55a15d188483d78a0e5
  • Docs.zip SHA1: 3ef076afc86a10fb422ec340f57079bb2480863c
  • Docs.zip SHA512: a3cf7bb9bf31ce4bdbaa44470c2be82f9482f3b8ff3eb7fec86ba89debcf639a27c0a045ea65ce8e80aa86c2e9e4bbb8fa98f6389a6093191518f2180833aa2d

v1.7.2

05 Aug 07:21
Compare
Choose a tag to compare

v1.7.2 (2018-08-05)

1. Bug fixes

Elixir

  • [Kernel] Do not emit warnings for repeated docs over different clauses due to false positives

Mix

  • [mix compile] Properly mark top-level dependencies as optional and as runtime. This fixes a bug where Mix attempted to start optional dependencies of a package when those optional dependencies were not available
  • [mix compile] Avoid deadlock when a config has a timestamp later than current time
  • [mix test] Do not fail suite if there are no test files

2. Enhancements

Elixir

  • [DateTime] Take negative years into account in DateTime.from_iso8601/1

Mix

  • [mix help] Show task and alias help when both are available

Checksums

  • Precompiled.zip SHA1: 97051389559547248d7e7f497ed3866ef11e3072
  • Precompiled.zip SHA512: e7ebdfcd301737967d0c04df50d3ba5b5a0663d2a2e2ac771cf61b9aa8d73a8f64dd9a408890ff0e2db4e48df8f94ff4d5fb7060f25592411e54910cdfc567a0
  • Docs.zip SHA1: 7fbcff81b1032570c1f9a0dfa232e8b1bdd0490a
  • Docs.zip SHA512: 8625522139f6a961fedb18b00cc78cad5e344f17b5a8a72746ceb284aab3f712db4b7ad57a4cfb86cdfa799a6c0f0b0b6c417117865321bbb70b6bbe0d8f0dd6