Skip to content

Commit

Permalink
fixing pyproject.toml for multiple src directory levels
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreFCruz committed Jun 12, 2024
1 parent cbbd134 commit 870f424
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 12 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include folktexts/acs/data/*.txt
23 changes: 17 additions & 6 deletions folktexts/cli/launch_acs_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
ACS_DATA_DIR = ROOT_DIR / "data"

# Directory to save results in (make sure it exists)
RESULTS_DIR = ROOT_DIR / "folktexts-results" / "acs-benchmarks"
RESULTS_DIR.mkdir(exist_ok=True, parents=False)
RESULTS_ROOT_DIR = ROOT_DIR / "folktexts-results" / "acs-benchmarks"

# Models save directory
MODELS_DIR = ROOT_DIR / "huggingface-models"
Expand Down Expand Up @@ -84,6 +83,7 @@
def make_llm_as_clf_experiment(
model_name: str,
task_name: str,
results_root_dir: str = RESULTS_ROOT_DIR,
**kwargs,
) -> Experiment:
"""Create an experiment object to run.
Expand Down Expand Up @@ -125,8 +125,8 @@ def make_llm_as_clf_experiment(
)

# Create LLM results directory
exp_results_dir = RESULTS_DIR / get_llm_results_folder(exp)
exp_results_dir.mkdir(exist_ok=True, parents=False)
exp_results_dir = results_root_dir / get_llm_results_folder(exp)
exp_results_dir.mkdir(exist_ok=True, parents=True)
exp.kwargs["results_dir"] = exp_results_dir.as_posix()
save_json(
obj=exp.to_dict(),
Expand Down Expand Up @@ -166,6 +166,14 @@ def setup_arg_parser() -> argparse.ArgumentParser:
action="append",
)

parser.add_argument(
"--results-root-dir",
type=str,
help="[string] Directory under which results will be saved.",
required=False,
default=RESULTS_ROOT_DIR.as_posix(),
)

parser.add_argument(
"--dry-run",
action="store_true",
Expand All @@ -183,8 +191,7 @@ def setup_arg_parser() -> argparse.ArgumentParser:
return parser


if __name__ == '__main__':

def main():
# Parse command-line arguments
parser = setup_arg_parser()
args, extra_kwargs = parser.parse_known_args()
Expand Down Expand Up @@ -218,3 +225,7 @@ def setup_arg_parser() -> argparse.ArgumentParser:
cluster_id = launch_experiment_job(exp).cluster() if not args.dry_run else None
print(f"{i:2}. cluster-id={cluster_id}")
pprint(exp.to_dict(), indent=4)


if __name__ == "__main__":
main()
6 changes: 5 additions & 1 deletion folktexts/cli/run_acs_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def setup_arg_parser() -> ArgumentParser:
return parser


if __name__ == '__main__':
def main():
"""Prepare and launch the LLM-as-classifier experiment using ACS data."""

# Setup parser and process cmd-line args
Expand Down Expand Up @@ -163,3 +163,7 @@ def setup_arg_parser() -> ArgumentParser:
# Finish
from folktexts._utils import get_current_timestamp
print(f"\nFinished experiment successfully at {get_current_timestamp()}\n")


if __name__ == "__main__":
main()
15 changes: 10 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools"]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
Expand Down Expand Up @@ -32,14 +32,19 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]

version = "0.0.7"
version = "0.0.8"
requires-python = ">=3.8"
dynamic = [
"readme",
"dependencies",
"optional-dependencies",
] # these are defined below dynamically

[tool.setuptools]
# NOTE! If you have multiple source directories, you can specify them here:
packages = ["folktexts", "folktexts.acs", "folktexts.cli"]
include-package-data = true

[tool.setuptools.dynamic]
readme = { file = "README.md", content-type="text/markdown" }

Expand All @@ -53,11 +58,11 @@ optional-dependencies.cli = {file = "requirements/cli.txt"}

[project.urls]
homepage = "https://github.com/socialfoundations/folktexts"
documentation = "https://socialfoundations.github.io/folktexts/"
repository = "https://github.com/socialfoundations/folktexts"
documentation = "https://socialfoundations.github.io/folktexts/"

[tool.setuptools.packages.find]
include = ["folktexts"]
[project.scripts]
run_acs_benchmark = "folktexts.cli.run_acs_benchmark:main"

# flake8
[tool.flake8]
Expand Down

0 comments on commit 870f424

Please sign in to comment.