semvec/pypi-packages huggingface dataset:
python-logsy 0.3.0
A standardised logging configuration I use for a few things.
Requires Python: >=3.8

# python-logsy

A standardised logging configuration I use for a few things.


## Quickstart

1. Install this package with optional extras:
   ```bash
   pip install python-logsy[fluent,sentry]
   ```

1. Import and configure. This package has three logging handlers available
   in the default configuration. All are relatively self-explanatory except
   that the `fluent` handler logs to a Fluentd or Fluent Bit instance and
   requires the `fluent` dependencies to be installed via the optional extras.
   Furthermore, the `file` handler uses `logging.handlers.RotatingFileHandler`.
   Log files will rollover at 100 megabytes when using the `file` handler.
   ```python
   import logging

   import logsy

   config = {
       'loggers': {
           'app': {
               'handlers': ['console', 'fluent', 'file'],
               'level': 'INFO',
               'propagate': True,
           },
       },
   }
   logsy.init(
       config,
       tag='apps.myapp', # Also used as the Fluent tag (routing)
       fluent_host='localhost',
       environment='production',
       release='2.1.1-beta',
   )
   ```

1. A complete example of `init`; including setup for Sentry:
   ```python
   logsy.init(
       config,
       tag='apps.myapp', # Also used as the Fluent tag (routing)
       replace_config=False,
       fluent_host='localhost',
       fluent_port=24224, # default
       async_fluent=True, # default
       environment='debug',
       debug=True, # default is False
       release='2.1.1-beta',
       level=logging.INFO, # default
       sentry_config={
           'dsn': 'fake-dsn-string',
           'traces_sample_rate': 1.0, # default
       },
   )
   ```

1. Log as per usual:
   ```python
   import logging

   logger = logging.getLogger(__name__)
   logger.info('Testing')
   ```

1. If needed, replace the default logging config with your own:
   ```python
   config = {
       'version': 1,
       'disable_existing_loggers': False,
       'formatters': {}, # incomplete
       'handlers': {}, # incomplete
   }
   logsy.init(
       config,
       replace_config=True,
       tag='apps.myapp',
       fluent_host='localhost',
       fluent_port=24224, # default
       environment='debug',
       debug=True, # default is False
       release='2.1.1-beta',
       level=logging.INFO, # default
   )
   ```
runtime-threading 0.0.2
Provides a task based abstraction to threading.
Requires Python: >=3.10
Keywords: windows, linux, async, threading, parallel, concurrent

[![Test](https://github.com/apmadsen/runtime-threading/actions/workflows/python-test.yml/badge.svg)](https://github.com/apmadsen/runtime-threading/actions/workflows/python-test.yml)
[![Coverage](https://github.com/apmadsen/runtime-threading/actions/workflows/python-test-coverage.yml/badge.svg)](https://github.com/apmadsen/runtime-threading/actions/workflows/python-test-coverage.yml)
[![Stable Version](https://img.shields.io/pypi/v/runtime-threading?label=stable&sort=semver&color=blue)](https://github.com/apmadsen/runtime-threading/releases)
![Pre-release Version](https://img.shields.io/github/v/release/apmadsen/runtime-threading?label=pre-release&include_prereleases&sort=semver&color=blue)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/runtime-threading)
[![PyPI Downloads](https://static.pepy.tech/badge/runtime-threading/week)](https://pepy.tech/projects/runtime-threading)

# runtime-threading
This project provides a task based abstraction to threading.

## Example

```python
from runtime.threading import InterruptSignal, InterruptException
from runtime.threading.tasks import Task, ContinuationOptions

try:
     signal = InterruptSignal()
     i = 227
     m = 0.78

     def fn(task: Task[float], i: float, m: float) -> float:
          task.interrupt.raise_if_signaled()
          return i * m

     def fn_continue(task: Task[float], preceding_task: Task[float], m: float) -> float:
          return preceding_task.result * m

     task1 = Task.run(fn, i, m)
     task2 = task1.continue_with(ContinuationOptions.ON_COMPLETED_SUCCESSFULLY, fn_continue, m)

     result1 = task1.result # -> 177.06
     result2 = task2.result # -> 138.1068

     task3 = Task.create(interrupt = signal.interrupt, lazy = True).plan(fn, task1.result, m)

     signal.signal()

     # task3 is run lazily when result property is accessed
     result3 = task3.result # TaskInterruptedException

except InterruptException:
     pass # won't happen since the interrupt is never signaled
```
## Full documentation

[Go to documentation](https://github.com/apmadsen/runtime-threading/blob/main/docs/documentation.md)
django-sched 0.1.3
轻量级的 Django 定时任务调度框架，基于数据库锁实现进程/线程级调度与日志记录。
Requires Python: >=3.13
Keywords: django, scheduler, cron, task

# DjangoSched

轻量级的 Django 定时任务调度框架。基于 Django ORM 与线程/进程实现，支持：
- 周期任务调度、任务运行日志（`SchedulerLog`）和锁竞争机制；
- 嵌入式线程或独立进程运行调度器；
- 与 Django Admin 集成查看调度器与运行日志。

核心实现与入口
- 调度器实现：[`django_sched.sched.Scheduler`](django_sched/sched.py)
- 启动入口：[`django_sched.sched.start_scheduler`](django_sched/sched.py)
- 应用自动启动：[`django_sched.apps.DjangoSchedConfig.ready`](django_sched/apps.py)（在 `runserver` 或 `gunicorn` 下自动启动）
- 模型：[`django_sched.models.Scheduler`](django_sched/models.py)、[`django_sched.models.SchedulerLog`](django_sched/models.py)
- 管理后台：[`django_sched.admin.SchedulerAdmin`](django_sched/admin.py)
- 信号：[`django_sched.signals.scheduler_init`](django_sched/signals.py)

快速开始
1. 安装（在虚拟环境中）：
```sh
pip install -e .
```

2. 在 Django 项目里加入 `django_sched` 到 `INSTALLED_APPS`（示例项目在 `demo` 中）：
```py
INSTALLED_APPS = [
    # ...
    'django_sched',
]
```

3. 迁移并启动：
```sh
python manage.py migrate
python manage.py runserver
```
在 `runserver` 或 `gunicorn` 下，应用会通过 `DjangoSchedConfig.ready()` 自动尝试启动调度器（可在日志中看到启动/竞态信息）。详情见 [`django_sched.apps.DjangoSchedConfig.ready`](django_sched/apps.py)。

以编程方式启动（例如在管理命令中）：
```py
from django_sched.sched import start_scheduler
# 在当前进程中以嵌入方式启动（会阻塞）
start_scheduler(embedded_process=True)
# 或作为线程/进程嵌入
start_scheduler(thread=True)
```

注意事项
- 锁机制基于数据库表 `django_sched_scheduler`，当检测到上次持有进程心跳过期时会尝试接管锁；
- 默认 timezone 配置会影响锁过期与日志时间，请根据项目配置调整；
- Admin 页面禁止手动新增/修改/删除日志。

贡献与授权
- 许可：MIT（见 LICENSE）
- 欢迎提 issue / PR
notebookize 0.1.3
A Python decorator that turns functions back into jupyter notebooks, complete with their context.
Requires Python: >=3.10

# notebookize

A Python decorator that turns functions back into jupyter notebooks, complete with their context.

### Installation:

```
pip install notebookize
```

### Usage:

```python
from notebookize import notebookize

@notebookize
def my_function(my_function_args, ...):
    ...
```
VY4E-OptModel 1.0.15
An open-source optimization model for the design and operation of hybrid renewable energy systems.
Requires Python: >=3.11

VY4E-OptModel
=============

.. image:: https://raw.githubusercontent.com/VY4E/.github/f702b41f95871fa4c76195a16e9fb8572e3285d4/VY4E_avatar_transparent_v6.png
   :width: 120
   :align: right
   :alt: VY4E logo

**VY4E-OptModel** is the **core optimization engine** of the `VY4E <https://github.com/VY4E>`_ ecosystem.
It provides the fundamental modelling framework for **integrated zero-carbon energy systems**, supporting electricity, heat, hydrogen, and storage.

----

🚀 Features
-----------

- Modular formulation for multi-vector energy systems
- Compatible with **deterministic, stochastic, and equilibrium** approaches
- Flexible temporal structure: hours, days, representative periods
- Built on `JuMP <https://jump.dev>`_ / Pyomo (depending on module choice)
- Interfaces with ``VY4E-data`` (datasets) and ``VY4E-examples`` (notebooks)

----

📂 Structure
------------

- ``src/``: Core source code for the optimization model.
- ``data/``: Sample case studies.
- ``docs/``: Documentation and formulation notes.
- ``tests/``: Validation and regression tests.

----

📦 Prerequisites
----------------

- **Python 3.12** or higher.
- A supported solver: **Gurobi, CBC, or CPLEX**. Make sure the solver is installed and accessible in your system's PATH.

----

🚀 Installation
---------------

1. Clone the repository:

.. code-block:: bash

   git clone https://github.com/VY4E-nexus/VY4E-OptModel.git
   cd VY4E-OptModel

2. Create and activate a virtual environment (recommended):

.. code-block:: bash

   python -m venv venv
   source venv/bin/activate  # On Windows use `venv\Scripts\activate`

3. Install the required Python packages:

.. code-block:: bash

   pip install -r requirements.txt

----

Usage
-----

To run the optimization model, use the ``oM_Main.py`` script from the ``src`` directory.

.. code-block:: bash

   python src/oM_Main.py --case <case_name> --solver <solver_name>

**Command-line Arguments**

- ``--dir``: Directory containing the case data (defaults to the current directory).
- ``--case``: Name of the case to run (e.g., ``Home1``).
- ``--solver``: Solver to use (e.g., ``gurobi``, ``cbc``, ``cplex``).
- ``--date``: Model run date in "YYYY-MM-DD HH:MM:SS" format.
- ``--rawresults``: Save raw results (``True``/``False``).
- ``--plots``: Generate plots (``True``/``False``).

----

🤝 Contributing
---------------

Contributions are welcome! If you want to contribute to VY4E-OptModel, please follow these steps:

1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Make your changes and commit them with a clear message.
4. Push your changes to your fork.
5. Create a pull request to the ``main`` branch of this repository.

----

📄 License
----------

This project is licensed under the terms of the `GNU General Public License v3.0 <LICENSE>`_.
psiconfig 0.0.16
A module to validate and load config files.
Requires Python: <3.13,>=3.10

# configration

A module to validate and load config files.

## Installation

```bash
pip install psiconfig
```

## How to use

*psiconfig* supports *json* and *toml* configurations. (To use *json* replace *TomlConfig* with *JsonConfig* in the following code.)

### Set up a module to handle configuration

1. Create a config module in your project:

```python

"""Config for <project>."""
from psiconfig import TomlConfig
CONFIG_PATH = <path to config file>  # NB need not exist


DEFAULT_CONFIG = {
    # a dictionary of default items that will be used if no config file is found
}


def get_config() -> TomlConfig:
    return TomlConfig(path=CONFIG_PATH, defaults=DEFAULT_CONFIG)


def save_config(config: TomlConfig) -> TomlConfig | None:
    result = config.save()
    if result != config.STATUS_OK:
        return None
    config = TomlConfig(CONFIG_PATH)
    return config


config = get_config()
```

### Accessing config in a module

If you want to access *config* in a module, then, if you want the config version at start up:

```python
from config import config
```

or, if you want the latest saved version of *config*:

```python
from config import get_config
...
    self.config = get_config()
```

### Config properties and methods

*config.config*: a dict of items in the configuration

*get_config(path)*: returns the config object

*save_config(config)*: saves the config items

### Updating config items

```python
config.config[<item key>] = <item value>
```