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. Elements are moved in, and copied only where they are copyable; a copy of a move-only one is refused, and the compiler says why:

    error: use of deleted function '... push_back(const value_type&) requires denied<urd::fixed_string<83>{{"push_back(const
    T&): the element is move-only: move it in, push_back(std::move(x))"}}, ...>'
    
  • 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.4.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.4.0
File Size Uploaded Provenance Actions
pyurd-0.4.0.tar.gz 657.4 kB With provenance Details for pyurd-0.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / pyurd-0.4.0.tar.gz

Download URL pyurd-0.4.0.tar.gz
Size 657.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2ad110c417f70df3f45a2bd0e1d87c5eea702b962d69fdd89850d2abfb619b5f
BLAKE2b-256 checksum
How to use checksums
c5bc89a4e0a74ef5378401729f72d14199aaf2b3b36aaac3570bc5b3ca3164e5
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 23, 2026.

Transparency log

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

Download URL pyurd-0.4.0-py3-none-any.whl
Size 419.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f8ad87f685587c1bf0a1ef1dd0f65afa53869513b9ec01802788ec833a7739f
BLAKE2b-256 checksum
How to use checksums
4e056369515bf32169bf160a52508becf93c4d8ce71e0141b1f0fe0c1b6fa313
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 23, 2026.

Transparency log

Security for pyurd 0.4.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.4.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 23, 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.

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