From 299381b458f81f0d63bd16305f8f4054781827e0 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Thu, 6 Jun 2024 20:45:01 -0400 Subject: [PATCH] Rename package to `instructlab.sdg` from `instructlab_sdg` Part of issue #2 This changes to use Python namespace packages where `instructlab` is the namespace used for our libraries. Signed-off-by: Russell Bryant --- .gitignore | 2 +- pyproject.toml | 8 ++++---- src/instructlab/__init__.py | 1 + src/{instructlab_sdg => instructlab/sdg}/README.md | 0 src/instructlab/sdg/__init__.py | 3 +++ src/{instructlab_sdg => instructlab/sdg}/generate_data.py | 5 +++-- src/{instructlab_sdg => instructlab/sdg}/seed_tasks.jsonl | 0 src/{instructlab_sdg => instructlab/sdg}/utils.py | 0 src/instructlab_sdg/__init__.py | 2 -- tox.ini | 4 ++-- 10 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 src/instructlab/__init__.py rename src/{instructlab_sdg => instructlab/sdg}/README.md (100%) create mode 100644 src/instructlab/sdg/__init__.py rename src/{instructlab_sdg => instructlab/sdg}/generate_data.py (99%) rename src/{instructlab_sdg => instructlab/sdg}/seed_tasks.jsonl (100%) rename src/{instructlab_sdg => instructlab/sdg}/utils.py (100%) delete mode 100644 src/instructlab_sdg/__init__.py diff --git a/.gitignore b/.gitignore index 4263ad7f..ceaa9f7a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Auto generated -src/instructlab_sdg/_version.py +src/instructlab/sdg/_version.py # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/pyproject.toml b/pyproject.toml index 8588d2be..716179fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ source = "https://github.com/instructlab/sdg" issues = "https://github.com/instructlab/sdg/issues" [tool.setuptools_scm] -version_file = "src/instructlab_sdg/_version.py" +version_file = "src/instructlab/sdg/_version.py" # do not include +gREV local version, required for Test PyPI upload local_scheme = "no-local-version" @@ -50,7 +50,7 @@ dependencies = {file = ["requirements.txt"]} [tool.setuptools.packages.find] where = ["src"] -include = ["sdg"] +include = ["instructlab.sdg"] [tool.setuptools.package-data] "instructlab.schema.v1" = ["*.json"] @@ -107,8 +107,8 @@ known-local-folder = ["tuning"] [tool.mypy] disable_error_code = ["import-not-found", "import-untyped"] exclude = [ - "^src/instructlab_sdg/generate_data\\.py$", - "^src/instructlab_sdg/utils\\.py$", + "^src/instructlab/sdg/generate_data\\.py$", + "^src/instructlab/sdg/utils\\.py$", ] # honor excludes by not following there through imports follow_imports = "silent" diff --git a/src/instructlab/__init__.py b/src/instructlab/__init__.py new file mode 100644 index 00000000..8db66d3d --- /dev/null +++ b/src/instructlab/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/instructlab_sdg/README.md b/src/instructlab/sdg/README.md similarity index 100% rename from src/instructlab_sdg/README.md rename to src/instructlab/sdg/README.md diff --git a/src/instructlab/sdg/__init__.py b/src/instructlab/sdg/__init__.py new file mode 100644 index 00000000..fbf4876d --- /dev/null +++ b/src/instructlab/sdg/__init__.py @@ -0,0 +1,3 @@ +# First party +# First Party +from instructlab.sdg.generate_data import generate_data diff --git a/src/instructlab_sdg/generate_data.py b/src/instructlab/sdg/generate_data.py similarity index 99% rename from src/instructlab_sdg/generate_data.py rename to src/instructlab/sdg/generate_data.py index af57f726..7fd41cd4 100644 --- a/src/instructlab_sdg/generate_data.py +++ b/src/instructlab/sdg/generate_data.py @@ -14,7 +14,7 @@ import time # Third Party -# instructlab - All of these need to go away - issue #6 +# instructlab - All of these need to go away (other than sdg) - issue #6 from instructlab.config import get_model_family from instructlab.utils import ( chunk_document, @@ -28,7 +28,8 @@ import tqdm # First Party -from instructlab_sdg import utils +# pylint: disable=ungrouped-imports +from instructlab.sdg import utils DEFAULT_PROMPT_TEMPLATE_MERLINITE = """\ You are asked to come up with a set of 5 diverse task instructions under {{taxonomy}}{{" for the task \\"%s\\""|format(task_description) if task_description}}. These task instructions will be given to a GPT model and we will evaluate the GPT model for completing the instructions. diff --git a/src/instructlab_sdg/seed_tasks.jsonl b/src/instructlab/sdg/seed_tasks.jsonl similarity index 100% rename from src/instructlab_sdg/seed_tasks.jsonl rename to src/instructlab/sdg/seed_tasks.jsonl diff --git a/src/instructlab_sdg/utils.py b/src/instructlab/sdg/utils.py similarity index 100% rename from src/instructlab_sdg/utils.py rename to src/instructlab/sdg/utils.py diff --git a/src/instructlab_sdg/__init__.py b/src/instructlab_sdg/__init__.py deleted file mode 100644 index 8eb177f1..00000000 --- a/src/instructlab_sdg/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# First Party -from instructlab_sdg.generate_data import generate_data diff --git a/tox.ini b/tox.ini index c722f0e4..cf564a1b 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,7 @@ skip_install = true skipsdist = true deps = -r requirements-dev.txt commands = - {envpython} -m pylint --load-plugins pylint_pydantic src/instructlab_sdg/ + {envpython} -m pylint --load-plugins pylint_pydantic src/instructlab/sdg/ [testenv:fastlint] description = fast lint with pylint (without 3rd party modules) @@ -24,7 +24,7 @@ deps = pylint pylint-pydantic commands = - {envpython} -m pylint --load-plugins pylint_pydantic {posargs:--disable=import-error src/instructlab_sdg/} + {envpython} -m pylint --load-plugins pylint_pydantic {posargs:--disable=import-error src/instructlab/sdg/} [testenv:ruff] description = reformat and fix code with Ruff (and isort)