From 2c640e496084d37a9996dfec520c9a225e492267 Mon Sep 17 00:00:00 2001 From: Akshay S Dinesh Date: Mon, 19 Feb 2024 15:36:57 +0530 Subject: [PATCH] revert moving rules to root to fix python issues python has some weird autodiscovery mechanisms and it gets rid of the extra files unless it is within the directory. I followed a combination of: - https://setuptools.pypa.io/en/latest/userguide/datafiles.html - https://stackoverflow.com/questions/24347450/how-do-you-add-additional-files-to-a-wheel - https://setuptools.pypa.io/en/stable/userguide/package_discovery.html - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#custom-discovery - https://github.com/pypa/setuptools/issues/3197#issuecomment-1078770109 - https://stackoverflow.com/questions/72294299/multiple-top-level-packages-discovered-in-a-flat-layout Failed miserably --- MANIFEST.in | 2 +- libindic/normalizer/core.py | 2 +- {rules => libindic/normalizer/rules}/normalizer_ml.rules | 0 pyproject.toml | 3 --- 4 files changed, 2 insertions(+), 5 deletions(-) rename {rules => libindic/normalizer/rules}/normalizer_ml.rules (100%) diff --git a/MANIFEST.in b/MANIFEST.in index 241db3f..c9d8af0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -graft rules \ No newline at end of file +include libindic/normalizer/rules/*.rules \ No newline at end of file diff --git a/libindic/normalizer/core.py b/libindic/normalizer/core.py index 6eb648f..0171a31 100755 --- a/libindic/normalizer/core.py +++ b/libindic/normalizer/core.py @@ -26,7 +26,7 @@ class Normalizer: def __init__(self): - self.rules_file = files('rules').joinpath('normalizer_ml.rules') + self.rules_file = files('libindic.normalizer.rules').joinpath('normalizer_ml.rules') self.rulesDict = self.LoadRules() pattern = "|".join(map(re.escape, self.rulesDict.keys())) self.regex = re.compile(pattern) diff --git a/rules/normalizer_ml.rules b/libindic/normalizer/rules/normalizer_ml.rules similarity index 100% rename from rules/normalizer_ml.rules rename to libindic/normalizer/rules/normalizer_ml.rules diff --git a/pyproject.toml b/pyproject.toml index e649069..851b23a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,9 +36,6 @@ Homepage = "https://libindic.org/normalizer" requires = ["setuptools", "setuptools-scm"] build-backend = "setuptools.build_meta" -[tool.setuptools.packages.find] -where = ["libindic"] - [project.entry-points."libindic.api.rest"] normalize = "normalizer.expose:normalize"