diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4091c0f..e685fee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,18 @@ jobs: run: | poetry config virtualenvs.create false && poetry install --only main + - name: Build package + run: | + poetry build + + - name: Verify dist directory + run: | + ls -l dist + + - name: Install built package + run: | + pip install dist/*.whl + - name: Install make run: | sudo apt-get update diff --git a/pyproject.toml b/pyproject.toml index d95ec9f..de19d5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,9 @@ dill = "0.3.8" black = "^24.4.2" isort = "^5.13.2" +[tool.poetry.scripts] +kumparanian = "kumparanian.cli:main" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/tests/cli_test.py b/tests/cli_test.py index 60fb4ca..e55d124 100644 --- a/tests/cli_test.py +++ b/tests/cli_test.py @@ -6,42 +6,42 @@ class TestCLI(unittest.TestCase): def test_kumparanian(self): with open("tests/kumparanian.output") as file: expected_output = file.read() - command = "python -m kumparanian" + command = "kumparanian" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) def test_kumparanian_help(self): with open("tests/kumparanian_help.output") as file: expected_output = file.read() - command = "python -m kumparanian --help" + command = "kumparanian --help" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) def test_kumparanian_ds(self): with open("tests/kumparanian_ds.output") as file: expected_output = file.read() - command = "python -m kumparanian ds" + command = "kumparanian ds" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) def test_kumparanian_ds_help(self): with open("tests/kumparanian_ds_help.output") as file: expected_output = file.read() - command = "python -m kumparanian ds --help" + command = "kumparanian ds --help" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) def test_kumparanian_ds_verify(self): with open("tests/kumparanian_ds_verify.output") as file: expected_output = file.read() - command = "python -m kumparanian ds verify; exit 0" + command = "kumparanian ds verify; exit 0" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) def test_kumparanian_ds_verify_help(self): with open("tests/kumparanian_ds_verify_help.output") as file: expected_output = file.read() - command = "python -m kumparanian ds verify --help" + command = "kumparanian ds verify --help" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) @@ -49,7 +49,7 @@ def test_kumparanian_ds_verify_valid_sklearn_model(self): with open("tests/kumparanian_ds_verify_valid_model.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds verify tests/sklearn_valid_model.pickle " + "kumparanian ds verify tests/sklearn_valid_model.pickle " "tests/vectorizer_label_encoder.pickle" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) @@ -58,7 +58,7 @@ def test_kumparanian_ds_verify_valid_sklearn_model(self): def test_kumparanian_ds_verify_valid_tf_model(self): with open("tests/kumparanian_ds_verify_valid_model.output") as file: expected_output = file.read() - command = "python -m kumparanian ds verify tests/tf_valid_model.keras tests/tokenizer_label_encoder.pickle" + command = "kumparanian ds verify tests/tf_valid_model.keras tests/tokenizer_label_encoder.pickle" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) @@ -66,7 +66,7 @@ def test_kumparanian_ds_verify_invalid_pickle_file(self): with open("tests/kumparanian_ds_verify_invalid_pickle_file.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds verify tests/invalid_pickle.pickle " + "kumparanian ds verify tests/invalid_pickle.pickle " "tests/tokenizer_label_encoder.pickle; exit 0" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) @@ -76,7 +76,7 @@ def test_kumparanian_ds_verify_invalid_tokenizer(self): with open("tests/kumparanian_ds_verify_invalid_tokenizer.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds verify tests/tf_valid_model.keras " + "kumparanian ds verify tests/tf_valid_model.keras " "tests/invalid_tokenizer.pickle; exit 0" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) @@ -86,7 +86,7 @@ def test_kumparanian_ds_verify_invalid_vectorizer(self): with open("tests/kumparanian_ds_verify_invalid_vectorizer.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds verify tests/sklearn_valid_model.pickle " + "kumparanian ds verify tests/sklearn_valid_model.pickle " "tests/invalid_vectorizer.pickle; exit 0" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) @@ -96,7 +96,7 @@ def test_kumparanian_ds_verify_invalid_label_encoder(self): with open("tests/kumparanian_ds_verify_invalid_label_encoder.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds verify tests/tf_valid_model.keras " + "kumparanian ds verify tests/tf_valid_model.keras " "tests/invalid_label_encoder.pickle; exit 0" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) @@ -106,7 +106,7 @@ def test_kumparanian_ds_verify_invalid_model_predict(self): with open("tests/kumparanian_ds_verify_invalid_model_predict.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds verify tests/invalid_model.pickle " + "kumparanian ds verify tests/invalid_model.pickle " "tests/vectorizer_label_encoder.pickle; exit 0" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) @@ -115,14 +115,14 @@ def test_kumparanian_ds_verify_invalid_model_predict(self): def test_kumparanian_ds_evaluate(self): with open("tests/kumparanian_ds_evaluate.output") as file: expected_output = file.read() - command = "python -m kumparanian ds evaluate; exit 0" + command = "kumparanian ds evaluate; exit 0" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) def test_kumparanian_ds_evaluate_help(self): with open("tests/kumparanian_ds_evaluate_help.output") as file: expected_output = file.read() - command = "python -m kumparanian ds evaluate --help" + command = "kumparanian ds evaluate --help" output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) self.assertEqual(expected_output, output.decode("utf-8")) @@ -130,7 +130,7 @@ def test_kumparanian_ds_evaluate_model(self): with open("tests/kumparanian_ds_evaluate_model.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds evaluate tests/sklearn_valid_model.pickle " + "kumparanian ds evaluate tests/sklearn_valid_model.pickle " "tests/vectorizer_label_encoder.pickle; exit 0" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) @@ -140,7 +140,7 @@ def test_kumparanian_ds_evaluate_model_test(self): with open("tests/kumparanian_ds_evaluate_model_test.output") as file: expected_output = file.read() command = ( - "python -m kumparanian ds evaluate tests/tf_valid_model.keras tests/tokenizer_label_encoder.pickle " + "kumparanian ds evaluate tests/tf_valid_model.keras tests/tokenizer_label_encoder.pickle " "tests/test_set.csv; exit 0" ) output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) diff --git a/tests/kumparanian.output b/tests/kumparanian.output index beb1a15..9622466 100644 --- a/tests/kumparanian.output +++ b/tests/kumparanian.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian [OPTIONS] COMMAND [ARGS]... +Usage: kumparanian [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit. diff --git a/tests/kumparanian_ds.output b/tests/kumparanian_ds.output index 6877f57..29de35b 100644 --- a/tests/kumparanian_ds.output +++ b/tests/kumparanian_ds.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian ds [OPTIONS] COMMAND [ARGS]... +Usage: kumparanian ds [OPTIONS] COMMAND [ARGS]... For Data Scientist role. diff --git a/tests/kumparanian_ds_evaluate.output b/tests/kumparanian_ds_evaluate.output index bf10cd6..f1c3046 100644 --- a/tests/kumparanian_ds_evaluate.output +++ b/tests/kumparanian_ds_evaluate.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian ds evaluate [OPTIONS] MODEL FILE TESTFILE -Try 'python -m kumparanian ds evaluate --help' for help. +Usage: kumparanian ds evaluate [OPTIONS] MODEL FILE TESTFILE +Try 'kumparanian ds evaluate --help' for help. Error: Missing argument 'MODEL'. diff --git a/tests/kumparanian_ds_evaluate_help.output b/tests/kumparanian_ds_evaluate_help.output index c6baf4c..700e765 100644 --- a/tests/kumparanian_ds_evaluate_help.output +++ b/tests/kumparanian_ds_evaluate_help.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian ds evaluate [OPTIONS] MODEL FILE TESTFILE +Usage: kumparanian ds evaluate [OPTIONS] MODEL FILE TESTFILE Evaluate the model diff --git a/tests/kumparanian_ds_evaluate_model.output b/tests/kumparanian_ds_evaluate_model.output index fdebf9a..62f69b3 100644 --- a/tests/kumparanian_ds_evaluate_model.output +++ b/tests/kumparanian_ds_evaluate_model.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian ds evaluate [OPTIONS] MODEL FILE TESTFILE -Try 'python -m kumparanian ds evaluate --help' for help. +Usage: kumparanian ds evaluate [OPTIONS] MODEL FILE TESTFILE +Try 'kumparanian ds evaluate --help' for help. Error: Missing argument 'TESTFILE'. diff --git a/tests/kumparanian_ds_help.output b/tests/kumparanian_ds_help.output index 6877f57..29de35b 100644 --- a/tests/kumparanian_ds_help.output +++ b/tests/kumparanian_ds_help.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian ds [OPTIONS] COMMAND [ARGS]... +Usage: kumparanian ds [OPTIONS] COMMAND [ARGS]... For Data Scientist role. diff --git a/tests/kumparanian_ds_verify.output b/tests/kumparanian_ds_verify.output index bfdbf8b..44391d6 100644 --- a/tests/kumparanian_ds_verify.output +++ b/tests/kumparanian_ds_verify.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian ds verify [OPTIONS] MODEL FILE -Try 'python -m kumparanian ds verify --help' for help. +Usage: kumparanian ds verify [OPTIONS] MODEL FILE +Try 'kumparanian ds verify --help' for help. Error: Missing argument 'MODEL'. diff --git a/tests/kumparanian_ds_verify_help.output b/tests/kumparanian_ds_verify_help.output index 13fb8f5..a2cb6da 100644 --- a/tests/kumparanian_ds_verify_help.output +++ b/tests/kumparanian_ds_verify_help.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian ds verify [OPTIONS] MODEL FILE +Usage: kumparanian ds verify [OPTIONS] MODEL FILE Verify the model diff --git a/tests/kumparanian_help.output b/tests/kumparanian_help.output index beb1a15..9622466 100644 --- a/tests/kumparanian_help.output +++ b/tests/kumparanian_help.output @@ -1,4 +1,4 @@ -Usage: python -m kumparanian [OPTIONS] COMMAND [ARGS]... +Usage: kumparanian [OPTIONS] COMMAND [ARGS]... Options: --help Show this message and exit.