Находки в опенсорсе
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
​​REST API for any Postgres database.

Using PostgREST is an alternative to manual CRUD programming. Custom API servers suffer problems. Writing business logic often duplicates, ignores or hobbles database structure. Object-relational mapping is a leaky abstraction leading to slow imperative code. The PostgREST philosophy establishes a single declarative source of truth: the data itself.

Declarative Programming: It’s easier to ask PostgreSQL to join data for you and let its query planner figure out the details than to loop through rows yourself. It’s easier to assign permissions to db objects than to add guards in controllers. (This is especially true for cascading permissions in data dependencies.) It’s easier to set constraints than to litter code with sanity checks.

Leak-proof Abstraction: There is no ORM involved. Creating new views happens in SQL with known performance implications. A database administrator can now create an API from scratch with no custom programming.

https://github.com/PostgREST/postgrest

#haskell
​​The tiny all-in-one development tool for modern web apps.

All the features you'd expect and more, from development to production:
- No "entry points" or "pages" to configure - just <script type=module src=anything.js>
- import "packages" from npm without installation
- Smart bundling and caching for npm dependencies
- Hot reloading for modules, Preact components and CSS
- Lightning-fast JSX support that you can debug in the browser
- Import CSS files and CSS Modules (*.module.css)
- Static file serving with hot reloading of CSS and images
- Highly optimized Rollup-based production output (wmr build)
- Crawls and pre-renders your app's pages to static HTML at build time
- Built-in HTTP2 support in both development and production (wmr serve --http2)
- Supports Rollup plugins, even in development where Rollup isn't used

https://github.com/preactjs/wmr

#js
​​Type-safe, compiled Jinja-like templates for #rust

Askama implements a template rendering engine based on Jinja. It generates Rust code from your templates at compile time based on a user-defined struct to hold the template's context.

Feature highlights:
- Construct templates using a familiar, easy-to-use syntax
- Template code is compiled into your crate for optimal performance
- Benefit from the safety provided by Rust's type system
- Optional built-in support for Actix, Gotham, Iron, Rocket, tide, and warp web frameworks
- Debugging features to assist you in template development
- Templates must be valid UTF-8 and produce UTF-8 when rendered
- Works on stable Rust

https://github.com/djc/askama
​​Beartype is an open-source pure #python PEP-compliant O(1) constant-time runtime type checker emphasizing efficiency, portability, and thrilling puns.

Beartype brings Rust inspired zero-cost abstractions into the lawless world of dynamically-typed pure Python.

Beartype is portably implemented in Python 3, continuously stress-tested via GitHub Actions + tox + pytest, and permissively distributed under the MIT license. Beartype has no runtime dependencies, only one test-time dependency, and supports all Python 3.x releases still in active development.

https://github.com/beartype/beartype
An incremental parsing system for programming tools written in #rust

Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited.

Tree-sitter aims to be:
- General enough to parse any programming language
- Fast enough to parse on every keystroke in a text editor
- Robust enough to provide useful results even in the presence of syntax errors
- Dependency-free so that the runtime library (which is written in pure C) can be embedded in any application

https://github.com/tree-sitter/tree-sitter
​​ Breaking news!

#ruby 3.0.0 Released!

Ruby 3.0.0 covers those goals by:
- Performance: MJIT
- Concurrency: Ractor and Fiber Scheduler
- Typing (Static Analysis): RBS, TypeProf

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/
wemake-python-styleguide@0.15 is just released!

It is the strictest and most opinionated #python linter ever.
Now with even more rules!

https://github.com/wemake-services/wemake-python-styleguide/releases/tag/0.15.0

Features that I really like in this new release:
- python3.9 official support
- Python gets adding new stuff - we continue to forbid using it, now with relaxed decorator syntax. Only old style is allowed, yeay!
- Unpythonic getters and setters detection: no more get_x and set_x methods!
- Consistent comprehension structure: now all your comprehensions will look the same!
- Configuration option to forbid ignoring some violations inline with noqa, might be really useful for complexity rules!

Check it out!

Even more goodness will land in the future vesions. We have a lot of ideas! Do you want to help with the project development? Drop me a line!
So, after recent cryptography incident (https://github.com/pyca/cryptography/issues/5771) our build-times inside the Alpine-based docker-in-docker CI went from several seconds to ~6 minutes just to install #python dependencies.

This forced me to create our own dind image (https://github.com/wemake-services/wemake-dind/) with everything properly set up: python, rust (required to build `cryptography`), docker-compose, and several #docker quality tools like:
- https://github.com/wemake-services/dump-env which enforces strict .env configuration policies
- https://github.com/wemake-services/docker-image-size-limit which enforces strict image size control

Feel free to use it in your own CI pipelines! Not just for python, but for any docker-in-docker setups that use docker-compose.
​​Watch coding videos while you code!

Get a YouTube popout with npx pipcorn [youtube-link]

#js
My new article is out!

This time I want to discuss a pretty useful idea for library authors and their users: there are better ways to test your code!

I give three examples (in #python, but the idea itself applies to almost any language) of how user projects can be self-tested without actually writing any real test cases by the end-user. One is hypothetical about django and two examples are real and working: featuring deal and dry-python/returns.

Short example with deal:

import deal

@deal.pre(lambda a, b: a >= 0 and b >= 0)
@deal.raises(ZeroDivisionError) # this function can raise if `b=0`, it is ok
def div(a: int, b: int) -> float:
if a > 50: # Custom, in real life this would be a bug in our logic:
raise Exception('Oh no! Bug happened!')
return a / b


This bug can be automatically found by writing a single line of test code: test_div = deal.cases(div). As easy as it gets!

From this article you will learn:
-How to use property-based testing on the next level
- How a simple decorator @deal.pre(lambda a, b: a >= 0 and b >= 0) can help you to generate hundreds of test cases with almost no effort
- What "Monad laws as values" is all about and how dry-python/returns helps its users to build their own monads

I really like this idea! And I would appreciate your feedback on it.
Link: https://sobolevn.me/2021/02/make-tests-a-part-of-your-app
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!
Friendly reminder: you can join our dry-python telegram chat: https://xn--r1a.website/drypython

We discuss functional programming, different new languages and ideas, typing, and #python! Stop by and chat!
We are back in business! 🎉

Long time without proper updates from us.
A lot of things happened in the meanwhile.

Now, let's talk about the future of this project.

The concept of this channel will be the same: "awesome open-source-relalated links". But, I am going to change some details about it:

1. I am going to value "quality" over "regularity", previously I posted 2 links a day. This is problematic. Sometimes there are a lot of things to share, sometimes I have to search for some extra items. No more! Only things that I really want to share, no schedule
2. I am going to add more personal side to this project. I want to add short summaries to each piece of content I share: why this thing is awesome? what's special about it? what ideas are worth noticing? etc
3. No ads, as always. Except of things that I am personally involved in: like conferences and webinars that we organize

Cheers!
I've spent lots of hours fixing npm audit to make our #js CI happy. Most of the times - it was garbage.

I've even disabled it in our projects. It was not adding any value, just wasting our time.
But, we still need to check some dependencies to be secure!

Dan Abramov shares his vision about npm audit problems and potential solutions.
Textual - a Text User Interface with Rich as the renderer.

Why is it cool?
1. It has an amazing grid layout
2. It is from the same team as Rich, which proved to be amazing
3. It has nice user-facing API (it even has async parts), way better than curses

But, it is still WIP. We need to wait for a little bit.

https://github.com/willmcgugan/textual

#python
​​Flix: Next-generation reliable, safe, concise, and functional-first programming language.

Flix is inspired by OCaml and Haskell with ideas from Rust and Scala. Flix looks like Scala, but its type system is based on Hindley-Milner. Two unique features of Flix are its polymorphic effect system and its support for first-class Datalog constraints.

Flix aims to offer a unique combination of features that no other programming language offers, including: algebraic data types and pattern matching (like Haskell, OCaml), extensible records (like Elm), type classes (like #haskell, #rust), higher-kinded types (like Haskell), local type inference (like Haskell, OCaml), channel and process-based concurrency (like #go), a polymorphic effect system (unique feature), first-class Datalog constraints (unique feature), and compilation to JVM bytecode (like #scala).

https://flix.dev/

Personal opinion: it has all the features new modern programming language should have. It has nice syntax, powerful ideas, and (hopefully) good JVM integration and code-reuse. That's a recipe for a success. I will keep an eye on this amazing language.

It also has a playground on its website, check it out!
I would love to highlight this example of polymorphic effects:
​​The Open Source Airtable alternative.
Turns any MySQL, PostgreSQL, SQL Server, SQLite & MariaDB into a smart-spreadsheet.

Features:
- Search, sort, filter, hide columns with uber ease
- Create Views: Grid, Gallery, Kanban, Gantt, Form
- Share Views: public & password protected
- Upload images to cells (Works with S3, Minio, GCP, Azure, DigitalOcean, Linode, OVH, BackBlaze)
- Roles: Owner, Creator, Editor, Commenter, Viewer, Commenter, Custom Roles
- Access Control: Fine-grained access control even at database, table & column level
- Programmatic APIs via REST and GraphQL

Personal opinion: I love #nocode instruments like this. I had very pleasant experience with Airtable for several quite different tasks. This is something you really need to consider before writing your own automatizations.

https://github.com/nocodb/nocodb

#js #vue
​​Bit is a modern Git CLI.

bit is an experimental modernized git CLI built on top of git that provides happy defaults and other niceties:
- command and flag suggestions to help you navigate the plethora of options git provides you
- autocompletion for files and branch names when using bit add or bit checkout
- automatic fetch and branch fast-forwarding reducing the likelihood of merge conflicts
- suggestions work with git aliases
- new commands like bit sync that vastly simplify your workflow
- commands from git-extras such as bit release & bit info
- fully compatible with git allowing you to fallback to git if need be
- get insight into how bit works using bit --debug

https://github.com/chriswalz/bit

#git #go
​​Kind: A modern proof language.

A minimal, efficient and practical proof and programming language. Under the hoods, it is basically Haskell, except purer and with dependent types. That means it can handle mathematical theorems just like Coq, Idris, Lean and Agda. On the surface, it aims to be more practical and looks more like TypeScript.

Compared to other proof assistants, Kind has:
- The smallest core. Check FormCore.js or Core.kind. Both are < 1000-LOC complete implementations!
- Novel type-level features. Check out article on super-inductive datatypes.
- An accessible syntax that makes it less scary
- A complete bootstrap: the language is implemented in itself. Check it here.
- Efficient real-world compilers. Check http://uwu.tech/ for a list of apps. (WIP)

Things you can do with it:
- Compile programs and modules to several targets, right now js and scm are supported
- Create live applications. Kind has an interconnected back-end that allows you to create rich, interactive applications without ever touching databases, TCP packets or messing with apis
- Prove theorems: for programmers, they're more like unit tests, except they can involve symbols, allowing you to cover infinitely many test cases. If you like unit tests, you'll love theorems.

Personal opinion: I am a big fan of ML-family languages, but not a big fan of their syntaxes. I love that new products solve their biggest issue for me. I really hope that some of these new functional languages will get eventually popular.

https://github.com/uwu-tech/kind

#js #haskell
The open-source #js Calendly alternative.

Let's face it: Calendly and other scheduling tools are awesome. It made our lives massively easier. We're using it for business meetings, seminars, yoga classes and even calls with our families. However, most tools are very limited in terms of control and customisations. That's where Calendso comes in. Self-hosted or hosted by us. White-label by design. API-driven and ready to be deployed on your own domain. Full control of your events and data. Calendso is to Calendly what GitLab is to GitHub.

Personal opinion: why paying for Calendly, when you can deploy everything to K8S pay for your own infrastructure and manage it yourself?!

https://github.com/calendso/calendso