Находки в опенсорсе
10.6K subscribers
11 photos
1 video
3 files
816 links
Привет!

Меня зовут Никита Соболев. Я занимаюсь опенсорс разработкой полный рабочий день.

Тут я рассказываю про #python, #c, опенсорс и тд.
Поддержать: https://boosty.to/sobolevn
РКН: https://vk.cc/cOzn36

Связь: @sobolev_nikita
Download Telegram
​​Nicene is a collection of extra Credo checks for linting #elixir code.

https://github.com/sketch-hq/nicene
​​Build reactive applications with the #ruby on Rails tooling you already know and love.

You just discovered an exciting new way to build modern, reactive, real-time apps with Ruby on Rails. StimulusReflex eliminates the complexity imposed by full-stack frontend frameworks. And, it's fast.

Inspired by #elixir's LiveView feature.

https://github.com/hopsoft/stimulus_reflex

Personal opinion: one can better use Elixir and Phoenix if LiveView is required.
​​Helpful #elixir assertions for ExUnit

There are three things this library offers:

- Concise, expressive assertions for common types of tests
- Flexibility through composition
- Exceptional error messages

https://github.com/devonestes/assertions
​​Domo is an #elixir library to model a business domain with type-safe structs and composable tagged tuples.

It's a library to define what piece of data is what and make a dialyzer and run-time type verification to cover one's back, reminding about taken definitions.

The library aims for two goals:

-to allow a business domain entity's valid states with a struct of fields of generic and tagged types
- to automatically verify that the construction of the entity's struct leads to one of the allowed valid states only

The validation of the incoming data is on the author of the concrete application. The library can only ensure the consistent assembly of that valid data into structs according to given definitions throughout the app.

https://github.com/IvanRublev/Domo

Both ids for User and Order structs are of the integer type. How to ensure that we don't mix them up throughout the various execution paths in the application? One way to do that is to attach an appropriate tag to each of the ids with tagged tuple like the following:
​​Unobtrusive Dependency Injector for #elixir

definject is a useful macros for transpaling normal functions into dependency-aware ones. It does not require you to modify function arguments or body. Instead, you just need to replace def with definject. It also allows injecting different mocks to each function. It also does not limit using :async option as mocks are contained in each test function.

https://github.com/definject/definject

Example:
​​New Gleam website!

For ones who don't know about Gleam yet:

> Gleam is a fast, friendly, and functional language for building safe, scalable systems!

Features:

- Safe: Gleam's powerful static type system helps find and prevent bugs at compile time, long before it reaches your users. It also serves as a productive refactoring tool, enabling programmers to confidently make large changes to unfamiliar code, quickly and with low risk. For problems the type system can't solve (such as your server being hit by a bolt of lightning) the Erlang virtual machine provides well tested mechanisms for gracefully handling failure.

- Friendly: Hunting down bugs can be stressful so Gleam's compiler provides clear and helpful feedback about any problems. We want to spend more time developing features and less time looking for bugs or deciphering cryptic error messages. As a community we want to be friendly too. People of all backgrounds, genders, and experience levels are welcome and must receive equal respect. See our community code of conduct for more.

- Performant: Gleam builds on top of the Erlang virtual machine, a best-in-class runtime that has enabled companies such as WhatsApp, Ericsson, Heroku, and Klarna to provide low-latency services at a global scale. Gleam takes full advantage of the Erlang runtime and adds no overhead of its own, so all Gleam programs are as blazingly fast as their #erlang counterpart.

- Erlang compatible: Gleam makes it easy to use code written in other BEAM languages such as Erlang, #elixir and LFE, so there's a rich ecosystem of thousands of open source libraries for Gleam users to make use of. In return Gleam code can be easily used by programmers of other BEAM languages, either by transparently making use of libraries written in Gleam, or by adding Gleam modules to their existing project with minimal fuss.

https://gleam.run

#gleam
​​A resource based framework for building #elixir applications.

Traditional MVC Frameworks (Rails, Django, .Net, Phoenix, etc) leave it up to the user to build the glue between requests for data (HTTP requests in various forms as well as server-side domain logic) and their respective ORMs. In that space, there is an incredible amount of boilerplate code that must get written from scratch for each application (authentication, authorization, sorting, filtering, sideloading relationships, serialization, etc).

Ash is an opinionated yet configurable framework designed to reduce boilerplate in an Elixir application. Ash does this by providing a layer of abstraction over your system's data layer(s) with Resources. It is designed to be used in conjunction with a phoenix application, or on its own.

To riff on a famous JRR Tolkien quote, a Resourceis "One Interface to rule them all, One Interface to find them" and will become an indispensable place to define contracts for interacting with data throughout your application.

To start using Ash, first declare your Resources using the Ash Resource DSL. You could technically stop there, and just leverage the Ash Elixir API to avoid writing boilerplate. More likely, you would use extensions like Ash.JsonApi or Ash.GraphQL with Phoenix to add external interfaces to those resources without having to write any extra code at all.

Ash is an open-source project and draws inspiration from similar ideas in other frameworks and concepts. The goal of Ash is to lower the barrier to adopting and using Elixir and Phoenix, and in doing so help these amazing communities attract new developers, projects, and companies.

https://github.com/ash-project/ash
​​Elixir v1.11 released

Over the last releases, the #elixir team has been focusing on the compiler, both in terms of catching more mistakes at compilation time and making it faster. Elixir v1.11 has made excellent progress on both fronts. This release also includes many other goodies, such as tighter Erlang integration, support for more guard expressions, built-in datetime formatting, and other calendar enhancements.

During this period, we have also started publishing a series of production cases on our website, featuring Elixir’s usage at Brex, Farmbot, and Heroku, with many more cases coming soon.

Features:
- Tighter #erlang integration
- Compiler checks: application boundaries
- Compiler checks: data constructors
- Compilation time improvements
- config/runtime.exs and mix app.config
- And many others!

https://elixir-lang.org/blog/2020/10/06/elixir-v1-11-0-released/
​​Compile #elixir applications into single, easily distributed executable binaries.

Bakeware extends Mix releases with the ability to turn Elixir projects into single binaries that can be copied and directly run. No need to install Erlang or untar files. The binaries look and feel like the build-products from other languages.

Here's a quick list of features:
- Simple - add the bakeware dependency and the Bakeware assembler to your Mix release settings
- Supports OSX and Linux (We wrote the code with Windows and the BSDs in mind, so support for those platforms may not be far off)
- Zstd compression for small binaries
- Optional support for automatic software updates
- Commandline argument passing conveniences
- Lots of examples

https://github.com/bake-bake-bake/bakeware
​​Erlang/Elixir NIFs in Nim

Nimler is a library for authoring #erlang and #elixir NIFs in the #nim programming language. It has mostly complete bindings for the Erlang NIF API and some accessories for making writing NIFs easier, including idiomatic functions for converting between Erlang terms and Nim types, and simplifications for using resource objects.

Mostly, Nimler is a minimal, zero-dependency wrapper for Erlang NIF API.

https://github.com/wltsmrz/nimler
My new article is out! It is all about typeclasses in Python and dry-python/classes.

Today I am explaining what typeclasses are and how to use them. I give examples in 4 very different languages: #rust, #elixir, #haskell, and #python to show that this concept is universal.

I am also showing that this idea is very pythonic by comparing our classes implementation with functools.singledispatch. There are lots of different details!

Check how easy it is to define a typeclass with classes:

from classes import AssociatedType, Supports, typeclass

class Greet(AssociatedType):
"""Special type to represent that some instance can `greet`."""

@typeclass(Greet)
def greet(instance) -> str:
"""No implementation needed."""

@greet.instance(str)
def _greet_str(instance: str) -> str:
return 'Hello, {0}!'.format(instance)

def greet_and_print(instance: Supports[Greet]) -> None:
print(greet(instance))

greet_and_print('world')


Check it out!
​​Livebook is a web application for writing interactive and collaborative code notebooks for #elixir, built with Phoenix LiveView. Inspired by Jupyter and Deepnote.

It features:
- Code notebooks with Markdown support and Elixir cells where code is evaluated on demand.
- Shareable: notebooks are stored in the .livemd format, which is a subset of Markdown with annotations and KaTex for mathematical formulas. This means your notebooks can be saved, easily shared, and play well with version control.
- Interactive widgets via Kino: manipulate Vega-Lite charts, tables, and more.
- Rich code editor through Monaco: with support for autocompletion, inline documentation, code formatting, etc.
- Reproducible: Livebook ensures your code runs in a predictable order, all the way down to package management. It also tracks your notebook state, annotating which parts are stale.
- Custom runtimes: when executing Elixir code, you can either start a fresh Elixir instance, connect to an existing node, or run it inside an existing Elixir project, with access to all of its modules and dependencies. This means Livebook can be a great tool to provide live documentation for existing projects.
- Persistence: persist your notebooks to disk or any S3-compatible cloud storage.
- Collaboration: multiple users can work on the same notebook at once. It works out-of-the-box either in single-node or multi-node deployments - without a need for additional tooling.

https://github.com/livebook-dev/livebook
​​Dataframes for #elixir

Explorer is a dataframe library for Elixir. First and foremost, Explorer is an API for data manipulation. Its high-level features are:
- Simply typed series: :float, :integer, :boolean, :string, :date, and :datetime.
- A powerful but constrained and opinionated API, so you spend less time looking for the right function and more time doing data manipulation.
- Pluggable backends, providing a uniform API whether you're working in-memory or (forthcoming) on remote databases or even Spark dataframes.
- The first (and default) backend is based on NIF bindings to the blazing-fast polars library.

The API is influenced heavily by Tidy Data and borrows much of its design from dplyr.

The aim here isn't to have the fastest dataframe library around (though it certainly helps that we're building on one of the fastest). Instead, we're aiming to bridge the best of many worlds:
- the elegance of dplyr
- the speed of polars
- the joy of Elixir

That means you can expect the guiding principles to be 'Elixir-ish'. For example, you won't see the underlying data mutated, even if that's the most efficient implementation. Explorer functions will always return a new dataframe or series.

https://github.com/elixir-nx/explorer
​​KDL is a document language with xml-like semantics that looks like you're invoking a bunch of CLI commands! It's meant to be used both as a serialization format and a configuration language, much like JSON, YAML, or XML.

Features:
- Node-based, you won't have to mess with identation to make it work
- Type annotations
- Implementations in different languages: #python, #elixir, #rust, #java, #js, #ruby, #php, etc

https://kdl.dev/