Skip to main content

python-drs

A PyTorch-inspired, event-driven Discrete Rate Simulation (DRS) framework for modeling systems where material flows continuously over time.

Instead of ticking through time at fixed intervals, DRS calculates exactly when the next limit (threshold) will be hit, jumps the simulation clock to that precise moment, and triggers the matching state transition. The result is a simulation that runs in a fraction of the time of fixed-step models — and never misses a limit.

Features

  • Event-driven time stepping — simulate years of operation in seconds
  • PyTorch-style architectureModule, Variable, and Level compose into hierarchies with automatic dependency tracking
  • Built-in telemetry — every state change is logged and plotted without custom tracking code
  • Fail-fast guardrails — the engine stops you from breaking the physics of your model (e.g. draining an empty stockpile)
  • Applicable to any continuous-flow system — mining supply chains, water pipes, electrical grids, traffic, and more

Installation

pip install python-drs

Optional extras:

pip install python-drs[progress]   # Rich progress bar

Quickstart

from drs import DRSEngine, Module, Level

class Stockpile(Module):
    def forward(self):
        # Fill at 50 units per time step
        self.ore.rate = 50.0

model = Stockpile()
model.ore = Level("Ore", initial_value=100.0)

engine = DRSEngine(model)
result = engine.run(max_time=20.0)
print(result.summary())

Documentation

Full guides, tutorials, and API reference live in the docs/ directory.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_drs-0.1.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_drs-0.1.0-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file python_drs-0.1.0.tar.gz.

File metadata

  • Download URL: python_drs-0.1.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_drs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6c76a1b0caa61febd9846633b397912c7bb2ad2fe375fdaa375157558e6c6d2d
MD5 b167c4efeabbdef18ac4a4365520d35d
BLAKE2b-256 bad198934eef477236b420f00e313b52152d029fa5bb9996cbb84cc9b0349b24

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_drs-0.1.0.tar.gz:

Publisher: publish.yml on epicgamer17/python-drs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_drs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python_drs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_drs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28ee2002a7d14e8eacb3e3ab28245c1d89e99d51b1997e6f4d2238e5dbf3f6aa
MD5 9e7fd6537c408e07dde632850b18875d
BLAKE2b-256 185ed787beb1ab2dce92fc8b4c9e64e7f45a7e3cb85b92e83c00b0f88ef9e7f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_drs-0.1.0-py3-none-any.whl:

Publisher: publish.yml on epicgamer17/python-drs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page