semvec/pypi-packages huggingface dataset:
django-data-import-management 0.2.1
Django data import management application.
License: MIT
Keywords: django extentions

# django-data-import-management

Django data import management application.


## Install

```
pip install django-data-import-management
```

## Usage

**pro/settings.py**

```
INSTALLED_APPS = [
    ...
    'django_data_import_management',
    'example_app',
    ...
]
```

**example_app/import_workflow.py**

```
from django_data_import_management.models import DjangoDataImportWorkflow
from django_data_import_management.models import ParsedItem

class ExampleImportWorkflow(DjangoDataImportWorkflow):

    def do_parse(self):
        items = []
        for i in range(10):
            item = ParsedItem()
            info = str(i)
            data = {
                "index": 1,
            }
            item.mark_success(info, data)
            items.append(item)
        return items        # Note: always return the parsed ParsedItems
    
    def do_import(self, import_items):
        for item in import_items:
            item.mark_success()
        return import_items   # Note: always return import_items

```

**example_app/apps.py**

```
class ExampleAppConfig(AppConfig):
    name = 'example_app'

    def ready(self):
        from django_data_import_management.models import register_django_data_import_workflow
        from .import_workflows import ExampleImportWorkflow
        register_django_data_import_workflow("Example Import", ExampleImportWorkflow)
```

**example_app/__init__.py**

```
default_app_config = "example_app.apps.ExampleAppConfig"
```

*Steps:*

1. Setup dependencies.
1. Create a new workflow.
1. Register the workflow when project starts.

## Releases



### v0.1.4

- First release.

### v0.1.5

- Pass datafile instance to workflow.

### v0.1.6

- Add DjangoSimpleExportedDataImportWorkflow base class. 

### v0.1.8

- Fix string format problem.
- Fix fk problem.

### v0.1.9

- Fix dependence package version problem.

### v0.2.0

- Fix ugettext problem for Django 4.2.x.
- Add do_parse and do_import object toolbar button.

### v0.2.1

- Doc update.
jarexps 0.1.26
Setup a simple orpc server to export services from a jar file.
License: MIT
Keywords: jarexps,jarexpsd

# jarexps

Setup a simple Open RPC server to export services from a jar file.

## Install

```
pip install jarexps
```

## Usage

*Example config.yml*

```
daemon: true
loglevel: INFO

server:
  listen: 0.0.0.0
  port: 1813

authentication:
  enable: true
  users:
    app01: sNKBMFEol0w8CWUCkgxpxlhzbHeHx264

jarexps:
  classpaths:
    - abs/path/to/bcprov-jdk15on-1.70.jar
  services:
    misc.base64.encode:
      klass: org.bouncycastle.util.encoders.Base64
      method: encode
    misc.base64.decode:
      klass: org.bouncycastle.util.encoders.Base64
      method: decode

orpc:
  handler:
    asio-writer-buffer-size: 4096
```

*start server command*

```
jarexpsd -c config.yml start
```

*client tests*

```
import os
import unittest
from orpc.client import OrpcClientPool


class TestJarexps(unittest.TestCase):
    def setUp(self):
        self.cp = OrpcClientPool(
            10,
            kwargs={
                "host": "localhost",
                "port": 1813,
                "username": "app01",
                "password": "sNKBMFEol0w8CWUCkgxpxlhzbHeHx264",
            },
        )

    def test1(self):
        data1 = b"hello world"
        data2 = self.cp.execute("misc.base64.encode", args=[data1])
        assert data2 == b"aGVsbG8gd29ybGQ="

    def test2(self):
        data1 = os.urandom(1024)
        data2 = self.cp.execute("misc.base64.encode", args=[data1])
        data3 = self.cp.execute("misc.base64.decode", args=[data2])
        assert data1 == data3
```

## Releases

### v0.1.25

- First release.

### v0.1.26

- Doc update.