-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI for singe table synthesizer (#86)
- Intro `Data Exporter` for exporting sampled data to data sources - CLI updates for synthesizer
- Loading branch information
Showing
36 changed files
with
1,018 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Base Class for DataExporter | ||
======================= | ||
|
||
.. autoclass:: sdgx.data_exporters.base.DataExporter | ||
:members: | ||
:undoc-members: | ||
:inherited-members: | ||
:show-inheritance: | ||
:private-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CsvExporter | ||
===================================== | ||
|
||
|
||
.. autoclass:: sdgx.data_exporters.csv_exporter.CsvExporter | ||
:members: | ||
:undoc-members: | ||
:inherited-members: | ||
:show-inheritance: | ||
:private-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.. _api_reference/data-exporters-extension: | ||
|
||
Extension hookspec | ||
============================ | ||
|
||
.. automodule:: sdgx.data_exporters.extension | ||
:members: | ||
:undoc-members: | ||
:inherited-members: | ||
:show-inheritance: | ||
:private-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Data Exporter | ||
======================================================== | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
Base Class for DataExporter <base> | ||
|
||
Built-in DataExporter | ||
----------------------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
CsvExporter <csv_exporter> | ||
|
||
Custom DataExporter Relevant | ||
----------------------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
Extension hookspec <extension> | ||
DataExporterManager <manager> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
DataExporterManager | ||
================================= | ||
|
||
.. autoclass:: sdgx.data_exporters.manager.DataExporterManager | ||
:members: | ||
:undoc-members: | ||
:inherited-members: | ||
:show-inheritance: | ||
:private-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,24 @@ | ||
Command Line Interface | ||
================================================== | ||
|
||
Command Line Interface(CLI) is designed to simplify the usage of SDG and enable other programs to use SDG in a more convenient way. | ||
|
||
There are tow main commands in the CLI: | ||
|
||
- ``fit``: For fitting, finetuning, retraining... the model, which will save the final model to a specified path. | ||
- ``sample``: Load existing model and sample synthetic data. | ||
|
||
And as SDG supports plug-in system, users can list all available via ``list-{component}`` command. | ||
|
||
.. Note:: | ||
|
||
If you want to use SDG as a library, please refer to :ref:`Use Synthetic Data Generator as a library <Use Synthetic Data Generator as a library>`. | ||
|
||
If you want to extend SDG with your own components, please refer to :ref:`Developer guides for extension <Extented Synthetic Data Generator>`. | ||
|
||
CLI for synthetic single-table data | ||
-------------------------------------------------- | ||
|
||
.. click:: sdgx.cli.main:cli | ||
:prog: sdgx | ||
:nested: full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.1.0" |
15 changes: 15 additions & 0 deletions
15
example/extension/dummyexporter/dummyexporter/dummyexporter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from __future__ import annotations | ||
|
||
from sdgx.data_exporters.base import DataExporter | ||
|
||
|
||
class MyOwnExporter(DataExporter): | ||
... | ||
|
||
|
||
from sdgx.data_exporters.extension import hookimpl | ||
|
||
|
||
@hookimpl | ||
def register(manager): | ||
manager.register("MyOwnExporter", MyOwnExporter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "dummyexporter" | ||
dependencies = ["sdgx"] | ||
dynamic = ["version"] | ||
requires-python = ">=3.8" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
] | ||
[project.optional-dependencies] | ||
test = ["pytest"] | ||
|
||
[tool.check-manifest] | ||
ignore = [".*"] | ||
|
||
[tool.hatch.version] | ||
path = "dummyexporter/__init__.py" | ||
|
||
[project.entry-points."sdgx.data_exporter"] | ||
dummyexporter = "dummyexporter.dummyexporter" |
16 changes: 16 additions & 0 deletions
16
example/extension/dummyexporter/tests/test_registed_exporter.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
|
||
from sdgx.data_exporters.manager import DataExporterManager | ||
|
||
|
||
@pytest.fixture | ||
def manager(): | ||
yield DataExporterManager() | ||
|
||
|
||
def test_registed_exporter(manager: DataExporterManager): | ||
assert manager._normalize_name("MyOwnExporter") in manager.registed_exporters | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.main(["-vv", "-s", __file__]) |
Oops, something went wrong.