Skip to main content

urd

Say what your data is. urd picks the container and checks that it keeps its promises.

#include <urd/store.hpp>
#include <urd/repr/values/indexed.hpp>            // the containers these Stores resolve to: an interner,
#include <urd/repr/maps/bidirectional_csr.hpp>  // a graph by index both ways,
#include <urd/repr/values/dense_set.hpp>          // a bitset,
#include <urd/repr/queues/queue.hpp>              // a queue,
#include <urd/repr/maps/index_map.hpp>          // a slot per index
using namespace urd;

struct User                                                             // an index: one integral member
{
    std::uint32_t id;
    static constexpr auto identifying_members() noexcept { return Members<&User::id> {}; }
};

using Names    = Store<set<std::string>, positional, monotone>;         // an interner: each name gets an index
using Follows  = Store<map<User, User>, multi, dense, frozen, bidirectional>;  // a frozen graph
using Seen     = Store<set<User>, dense>;                               // a bitset
using Frontier = Store<queue<User>, fifo>;                              // a queue
using Distance = Store<map<User, int>, dense, constant_clear>;   // cleared per search in O(1)

// Everyone a user reaches by following, breadth first.
auto follows = Follows(edges.begin(), edges.end());  // built once from (follower, followed) pairs
auto seen = Seen { start };
auto frontier = Frontier();
frontier.push(start);
while (!frontier.empty())
{
    const auto user = frontier.front();
    frontier.pop();
    const auto [first, last] = follows.equal_range(user);  // whom this user follows
    for (const auto next : std::ranges::subrange(first, last) | std::views::values)
        if (seen.insert(next).second)
            frontier.push(next);
}
// follows.keys(user) gives who follows a user; follows.insert(…) does not compile: frozen.

User is an index, as dense asks, so Seen is a bitset and user 17 is its bit 17.

What you get

  • Say what, not which. You write what the data is; urd resolves the request at compile time to a container from the standard library, Boost or its own, picked by benchmarks.

  • The interface follows the properties. A frozen Store has no insert, an unordered one no lower_bound, a queue no iteration, and the compiler says why:

    note: constraints not satisfied: 'denied<"push_back/emplace_back: a keyed Store (a set or a map) takes insert">'
    
  • You pay only for what you use. A Store is the chosen container plus inline forwarding: no virtual calls, and no header of a container you do not use is compiled. Forget the one your Store resolves to, and the compiler names it:

    error: static assertion failed: urd::Store: this file does not include the headers that define the container its
    request resolves to. #include each header urd::include<"..."> names in the mp_list above, in that order
    ... boost::mp11::mp_list<urd::include<"urd/repr/values/dense_set.hpp">> ...
    
  • Promises are checked. Every container urd can choose is compared with a reference model through thousands of random operations, and deliberately broken containers are caught by the same tests. Its time and its memory (urd::memory_usage(store)) are measured against what it declares.

  • Small vocabulary. About 35 tags, few enough for people and code-writing agents to state instead of hand-rolling a structure.

The language

Tags answer questions, and the questions fall into four groups, by what leaving out a tag you need causes:

Group Leaving it out In the example
Kind does not compile fifo (Frontier)
Semantics is a bug positional, monotone (Names); multi, frozen, bidirectional (Follows); dense (Seen, Distance, Follows)
Costs is slower by a complexity class constant_clear (Distance)
Hints is slower by a constant factor

How the language is organized explains groups, questions and tags; the index by need starts from plain words ("reset every round", "union find").

Use it

cmake -S python/native -B dependencies-build -DCMAKE_INSTALL_PREFIX="$PWD/dependencies-install" -DCMAKE_INSTALL_LIBDIR=lib
cmake --build dependencies-build && cmake --install dependencies-build    # Boost, cista, gtl, GoogleTest, Google Benchmark
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j8 && ctest --test-dir build -j8
cmake --install build --prefix <where>                                    # then find_package(urd) from there

Link urd::urd, include urd/store.hpp, and include the header of each container your Stores resolve to: a missing one fails to compile with the headers to include in the error.

Documentation

https://planning-and-learning.github.io/urd/

Header-only C++20, GPL-3.0.

Metadata

Release files for pyurd 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyurd 0.1.0
File Size Uploaded Provenance Actions
pyurd-0.1.0.tar.gz 512.5 kB With provenance Details for pyurd-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyurd 0.1.0
File Interpreter ABI Platform Actions
pyurd-0.1.0-py3-none-any.whl Python 3 none any Details for pyurd-0.1.0-py3-none-any.whl

Total release size: 836.6 kB

Release files / pyurd-0.1.0.tar.gz

Download URL pyurd-0.1.0.tar.gz
Size 512.5 kB
Tags Source
SHA-256 checksum
How to use checksums
70b0691bee2193358a36b7289c3282bfce2a9c2ce121879667dcc405edc4a4f5
BLAKE2b-256 checksum
How to use checksums
11a32da1682a591d813642786d668953bbd522bdfa5e4e859f89fd98906e3b33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / pyurd-0.1.0-py3-none-any.whl

Download URL pyurd-0.1.0-py3-none-any.whl
Size 324.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d9729db0b58500dbc8fc5a05fd2353534a31f7188e0b197853577e4c7f4c159
BLAKE2b-256 checksum
How to use checksums
b5457c6d5c95e6f642dde9c1e019762a30ca8805a13d3bc0c9fa62184ed3ca1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for pyurd 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyurd-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page