Skip to main content

Sargilo

💾 Data loader for Humans

Sargilo lets you declare your data in a visually pleasing and non-frustrating way and loads it into your environment of choice. YAML usage, validation and auto-completion help you get boring jobs done.

💡 Motivation

The idea for this project came from the testing I had to do at work. Surely, you will need sample data to test the project you currently work on. After some time, two ways how to approach this have been emerged:

  • Create a minimal and abstract data sample for each test or group of tests and test against those
  • Find a more comphrehensive data set that satisfies most of edge cases and only add to it in rare cases

There are of course advantages and disadvantages to both approaches. However, I prefer the second approach and think of it as telling a little story. I prefer this way since the dataset can be used as a fixture when running your application and after working on it for quite some time, you will get a feeling for the result a function should produce, making it easier to spot errors.

📦 Install

pip install sargilo

Or if you prefer an alternative installation method

poetry add sargilo
pipenv install sargilo

🔗 Integrations

To know how to load your data, sargilo has to know how to deal with your framework or ORM of choice. While sargilo provides the interface and basic functionaly, the specifics on how to load the data are up to the integration. Currently, the following integrations are supported:

  • Django (ORM)

📒 Examples

# models.py
from django import models
from django.contrib.auth.models import User


class Tag(models.Model):
    name = models.CharField(max_length=255, blank=False, null=False)

class Post(models.Model):
    title = models.CharField(max_length=255)
    content = models.TextField()

    tag = models.ForeignKey(
        Tag,
        verbose_name='Tag',
        related_name='posts',
        on_delete=models.PROTECT
    )

    author = models.ForeignKey(
        User,
        verbose_name='Author',
        related_name='posts',
        on_delete=models.PROTECT
    )
# dataset.yaml
auth:
  users:
    - &Admin
      username:     "Admin"
      first_name:   "Christoph"
      last_name:    "Smaul"
      email:        "christoph@mail.de"
      password:     "very_secret"
      is_staff:      True
      is_superuser:  True
    - &Editor
      username:     "Editor"
      first_name:   "Wendy"
      last_name:    "Lator"
      email:        "wendy@mail.de"
      password:     "very_secret"
      is_staff:      True
      is_superuser:  False


blog:
  tags:
    - &TestTag
      name: "Test"
    - &BlueTag
      name: "Blue"
  posts:
    - title: "Hello world"
      text: "Lorem ipsum dolor amet sunt"
      tag: *TestTag
      author: *Admin

    - title: "Just a test"
      text: "This is just a test. This is just a test. This is just a test."
      tag: *TestTag
      author: *Editor

Metadata

Release files for sargilo 0.1.7

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

Source distribution (sdist)

Source distribution for sargilo 0.1.7
File Size Uploaded
sargilo-0.1.7.tar.gz 24.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sargilo 0.1.7
File Interpreter ABI Platform
sargilo-0.1.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 68.3 kB

Release files / sargilo-0.1.7.tar.gz

Download URL sargilo-0.1.7.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8ca9e9cf369eaee549606752fdbbbec2675dd9563ea4121b948c4103bdcf1cfe
BLAKE2b-256 checksum
How to use checksums
194aab6b7dc179ede12370a399c1807bd2ce12d348b45ff809fc598cad1489b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/5.4.28-1-MANJARO

Release files / sargilo-0.1.7-py2.py3-none-any.whl

Download URL sargilo-0.1.7-py2.py3-none-any.whl
Size 43.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
66a4be23eb54c562b90dbc41f3a1806d17c56d08b14e6f92d15777da22ff7b09
BLAKE2b-256 checksum
How to use checksums
8204771fa3da026cc0b733f9d36682303a7c15504d1c170847f979d3b86e1b9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.8.2 Linux/5.4.28-1-MANJARO

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

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