Repository: gbowne1/json-maestro (language: python)

Issue:
[Build] A recent trip installing this 
I did a setup on a VM I have 

here is the ouput

first of all..

```bash
$ uname -aimnoprsv
Linux test 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux
```

```txt
ASUS P8Z68-Z Pro Gen3 w/ 32gb Micron 16JTF1G64AZ-1G6E1 and an LGA1155 Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz

BIOS 3202  from 02/17/2012
```

```bash
$ python3 setup.py
Traceback (most recent call last):
  File "/home/gbowne1/Documents/learn_python/setup.py", line 1, in <module>
    from setuptools import setup, find_packages
  File "/home/gbowne1/.local/lib/python3.7/site-packages/setuptools/__init__.py", line 10, in <module>
    import distutils.core
ModuleNotFoundError: No module named 'distutils'

~/Documents/json-maestro
$ pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: black in /home/gbowne1/.local/lib/python3.7/site-packages (from -r requirements.txt (line 1)) (23.3.0)
Requirement already satisfied: flake8 in /home/gbowne1/.local/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (5.0.4)
Requirement already satisfied: pytest in /home/gbowne1/.local/lib/python3.7/site-packages (from -r requirements.txt (line 3)) (7.4.4)
Requirement already satisfied: pytest-cov in /home/gbowne1/.local/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (4.1.0)
Requirement already satisfied: pytest-mock in /home/gbowne1/.local/lib/python3.7/site-packages (from -r requirements.txt (line 5)) (3.11.1)
Requirement already satisfied: pylint in /home/gbowne1/.local/lib/python3.7/site-packages (from -r requirements.txt (line 6)) (2.17.4)
Collecting pyright (from -r requirements.txt (line 7))
  Downloading pyright-1.1.384-py3-none-any.whl.metadata (6.7 kB)
ERROR: Ignored the following versions that require a different python version: 0.0.2 Requires-Python >=3.8
ERROR: Could not find a version that satisfies the requirement pylance (from versions: none)
ERROR: No matching distribution found for pylance
~/Documents/json-maestro
$ pip install .
Defaulting to user installation because normal site-packages is not writeable
Processing /home/gbowne1/Documents/json-maestro
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
INFO: pip is looking at multiple versions of jsonmaestro to determine which version is compatible with other requirements. This could take a while.
ERROR: Package 'jsonmaestro' requires a different Python: 3.7.3 not in '>=3.10'
~/Documents/json-maestro
$ python --version
Python 3.12.5
~/Documents/json-maestro
$ python3 --version
Python 3.12.5
~/Documents/json-maestro
$ cd src
~/Documents/json-maestro/src
$ cd jsonmaestro
~/Documents/json-maestro/src/jsonmaestro
$ python3 main.py
Traceback (most recent call last):
  File "/home/gbowne1/Documents/json-maestro/src/jsonmaestro/main.py", line 2, in <module>
    from jsonmaestro.jsonmaestro import load_json, load_jsonc,remove_comments,remove_duplicate_keys,add_schema_keys, sort_json_keys,save_json
ModuleNotFoundError: No module named 'jsonmaestro.jsonmaestro'; 'jsonmaestro' is not a package
gbowne1@gregbowne:~/Documents/json-maestro/src/jsonmaestro
$ python3 jsonmaestro.py
~/Documents/json-maestro/src/jsonmaestro
$ python3 helpers.py
~/Documents/json-maestro/src/jsonmaestro
$ python3 helpers.py
```

This may not uncover much here but just thought I would include a run on machine I use often.
Cleanup tests
Closes #26,

I am strongly reccomending to delay merging this PR until #22 is not resolved so we can frist move patch file 0001 to the source instead of keeping it in /patches directory


Discussion / hints:
Can you you give me output of `which python` and `ls -AlF /usr/bin | grep python` ?
Sure.. on this particular system it is

```bash
admsys@test:~
$ which python
/usr/local/bin/python
admsys@test:~
$ whereis python
python: /usr/bin/python3.7-dbg /usr/bin/python3.7 /usr/bin/python3.7dm /usr/bin/python /usr/bin/python3.7m /usr/bin/python3.7dm-config /usr/bin/python3.7-dbg-config /usr/bin/python2.7 /usr/lib/python3.7 /usr/lib/python2.7 /etc/python3.7 /etc/python /etc/python2.7 /usr/local/bin/python /usr/local/bin/python3.12 /usr/local/bin/python3.12-config /usr/local/lib/python3.7 /usr/local/lib/python3.12 /usr/local/lib/python2.7 /usr/include/python3.7dm /usr/include/python3.7m /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz
admsys@test:~
$ whereis python3
python3: /usr/bin/python3.7-dbg /usr/bin/python3.7 /usr/bin/python3.7dm /usr/bin/python3.7m /usr/bin/python3.7dm-config /usr/bin/python3 /usr/bin/python3.7-dbg-config /usr/lib/python3.7 /usr/lib/python3 /etc/python3.7 /etc/python3 /usr/local/bin/python3.12 /usr/local/bin/python3 /usr/local/bin/python3.12-config /usr/local/lib/python3.7 /usr/local/lib/python3.12 /usr/include/python3.7dm /usr/include/python3.7m /usr/share/python3 /usr/share/man/man1/python3.1.gz
admysys@test:~
$ ls -AlF /usr/bin | grep python
lrwxrwxrwx 1 root    root           26 Mar  7  2019 dh_pypy -> ../share/dh-python/dh_pypy*
-rwxr-xr-x 1 root    root         1056 Mar  4  2019 dh_python2*
lrwxrwxrwx 1 root    root           29 Mar  7  2019 dh_python3 -> ../share/dh-python/dh_python3*
-rwxr-xr-x 1 root    root         2336 Jun 20  2017 dh_python3-ply*
lrwxrwxrwx 1 root    root           23 Mar 23  2024 pdb2.7 -> ../lib/python2.7/pdb.py*
lrwxrwxrwx 1 root    root           23 Mar 23  2024 pdb3.7 -> ../lib/python3.7/pdb.py*
lrwxrwxrwx 1 root    root           31 Mar 26  2019 py3versions -> ../share/python3/py3versions.py*
lrwxrwxrwx 1 root    root           26 Mar  7  2019 pybuild -> ../share/dh-python/pybuild*
lrwxrwxrwx 1 root    root            7 Mar  4  2019 python -> python2*
lrwxrwxrwx 1 root    root            9 Mar  4  2019 python2 -> python2.7*
-rwxr-xr-x 1 root    root      3685224 Mar 23  2024 python2.7*
lrwxrwxrwx 1 root    root            9 Mar 26  2019 python3 -> python3.7*
-rwxr-xr-x 2 root    root      4874240 Mar 23  2024 python3.7*
lrwxrwxrwx 1 root    root           11 Mar 23  2024 python3.7-dbg -> python3.7dm*
lrwxrwxrwx 1 root    root           37 Mar 23  2024 python3.7-dbg-config -> x86_64-linux-gnu-python3.7-dbg-config*
-rwxr-xr-x 1 root    root     18902912 Mar 23  2024 python3.7dm*
lrwxrwxrwx 1 root    root           35 Mar 23  2024 python3.7dm-config -> x86_64-linux-gnu-python3.7dm-config*
-rwxr-xr-x 2 root    root      4874240 Mar 23  2024 python3.7m*
lrwxrwxrwx 1 root    root           13 Mar 26  2019 python3-dbg -> python3.7-dbg*
lrwxrwxrwx 1 root    root           20 Mar 26  2019 python3-dbg-config -> python3.7-dbg-config*
lrwxrwxrwx 1 root    root           11 Mar 26  2019 python3dm -> python3.7dm*
lrwxrwxrwx 1 root    root           18 Mar 26  2019 python3dm-config -> python3.7dm-config*
lrwxrwxrwx 1 root    root           10 Mar 26  2019 python3m -> python3.7m*
lrwxrwxrwx 1 root    root           29 Mar  4  2019 pyversions -> ../share/python/pyversions.py*
lrwxrwxrwx 1 root    root           35 Mar 23  2024 x86_64-linux-gnu-python3.7-dbg-config -> x86_64-linux-gnu-python3.7dm-config*
-rwxr-xr-x 1 root    root         3280 Mar 23  2024 x86_64-linux-gnu-python3.7dm-config*
lrwxrwxrwx 1 root    root           37 Mar 26  2019 x86_64-linux-gnu-python3-dbg-config -> x86_64-linux-gnu-python3.7-dbg-config*
lrwxrwxrwx 1 root    root           35 Mar 26  2019 x86_64-linux-gnu-python3dm-config -> x86_64-linux-gnu-python3.7dm-config*
```
Since its debian (debian 10 if im not mistaken) there is high probability that update-alternatives is pointing to the python3.7 binary in /usr/bin even tho /usr/bin should be superseded by /usr/local/bin

Yes, exactly.

I was just thinking here about edge cases here where the user may not have either 3.8 or 3.10.

Yes Debian 10 using apt

```shell
$ apt --version
apt 1.8.2.3 (amd64)
```

```shell
$ bash --version
GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```
Can you try and set required python version to 3.7 and report what happens?



Fix patch:
diff --git a/.github/workflows/pip-install.yml b/.github/workflows/pip-install.yml
index e58540a..58b8f0e 100644
--- a/.github/workflows/pip-install.yml
+++ b/.github/workflows/pip-install.yml
@@ -7,7 +7,7 @@ on:
         branches: ["master"]
 
 jobs:
-    ensure-installable:
+    ensure-pip-installable:
         runs-on: ubuntu-latest
         steps:
             - uses: actions/checkout@v4
@@ -19,5 +19,39 @@ jobs:
               run: |
                   python -m pip install --upgrade pip
                   pip install -r requirements.txt
+                  pip install -r dev.requirements
             - name: Install
               run: pip install .
+
+    ensure-setup-py-buildable:
+        runs-on: ubuntu-latest
+        steps:
+            - uses: actions/checkout@v4
+            - name: Set up Python 3.10
+              uses: actions/setup-python@v3
+              with:
+                  python-version: "3.10"
+            - name: Install dependencies
+              run: |
+                  python -m pip install --upgrade pip
+                  pip install -r requirements.txt
+                  pip install -r dev.requirements
+            - name: Install
+              run: python setup.py build
+
+    ensure-setup-py-installable:
+        needs: [ensure-setup-py-buildable]
+        runs-on: ubuntu-latest
+        steps:
+            - uses: actions/checkout@v4
+            - name: Set up Python 3.10
+              uses: actions/setup-python@v3
+              with:
+                  python-version: "3.10"
+            - name: Install dependencies
+              run: |
+                  python -m pip install --upgrade pip
+                  pip install -r requirements.txt
+                  pip install -r dev.requirements
+            - name: Install
+              run: python setup.py install
diff --git a/README.md b/README.md
index 12946e3..354a335 100644
--- a/README.md
+++ b/README.md
@@ -34,13 +34,19 @@ git clone git@github.com:gbowne1/json-maestro.git # via ssh
 cd /path/to/cloned/json-maestro
 ```
 
-3. install using pip
+3. install requirements
 
 ```bash
 pip install -r requirements.txt
-pip install .
 ```
 
+4. install json maestro using your prefered method (NOTE: both are shown here, either one should work)
+
+```bash
+pip install . # for installing using pip
+python setup.py install # for using setup.py script
+
+```
 ## Contributing
 
 See <CONTRIBUTING.md>
diff --git a/dev.requirements b/dev.requirements
new file mode 100644
index 0000000..4645d30
--- /dev/null
+++ b/dev.requirements
@@ -0,0 +1,9 @@
+black
+flake8
+pytest
+pytest-cov
+pytest-mock
+pylint
+pyright
+pylance
+debugpy
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 4aaae5e..aaa20d9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,2 @@
-black
-flake8
-pytest
-pytest-cov
-pytest-mock
-pylint
-pyright
-pylance
-debugpy
-click
\ No newline at end of file
+click
+setuptools
\ No newline at end of file


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 6e494fd..35fc5e7 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,9 +2,9 @@ name: test
 
 on:
     push:
-        branches: [ "master" ]
+        branches: ["master"]
     pull_request:
-        branches: [ "master" ]
+        branches: ["master"]
 
 jobs:
     test:
@@ -15,9 +15,18 @@ jobs:
               uses: actions/setup-python@v3
               with:
                   python-version: "3.10"
-            - name: Install dependencies
+            - name: Setup Venv
               run: |
-                  python -m pip install --upgrade pip
+                  python -m venv ./venv
+
+            - name: Install packages
+              run: |
+                  source ./venv/bin/activate
+                  pip install -r dev.requirements
                   pip install -r requirements.txt
+                  pip install .
+
             - name: Run tests
-              run: pytest
\ No newline at end of file
+              run: |
+                  source ./venv/bin/activate
+                  pytest
diff --git a/tests/test_format_helpers.py b/tests/test_format_helpers.py
index aabbbd3..d7e172f 100644
--- a/tests/test_format_helpers.py
+++ b/tests/test_format_helpers.py
@@ -1,6 +1,6 @@
 import pytest
 from unittest.mock import mock_open
-from jsonmaestro import is_json, get_format
+from jsonmaestro.helpers import is_json, get_format
 
 # Mock Data
 valid_json_content = '{"name": "John", "age": 30}'  # Valid JSON content
diff --git a/tests/test_json_cleaner.py b/tests/test_json_cleaner.py
index 311e45f..beb6009 100644
--- a/tests/test_json_cleaner.py
+++ b/tests/test_json_cleaner.py
@@ -1,27 +1,10 @@
-import pytest
-import json
-import os
-import tempfile
-from pathlib import Path
 from jsonmaestro import add_schema_keys, sort_json_keys
 
 
-def create_temp_json(tmp_path, content):
-	file_path = tmp_path / "test_file.json"
-	try:
-		with open(file_path, 'w', encoding='utf-8') as f:
-			json.dump(content, f)
-		return file_path
-	except IOError as e:
-		raise AssertionError(f"Failed to create temporary file: {e}")
-
-
 def test_add_schema_keys():
 	input_data = {}
 	result = add_schema_keys(input_data)
 	assert "json.schemas" in result
-	assert isinstance(result["json.schemas"], list)
-	assert len(result["json.schemas"]) > 0
 
 
 def test_sort_json_keys():
@@ -31,63 +14,3 @@ def test_sort_json_keys():
 
 	result_reverse = sort_json_keys(input_data, reverse=True)
 	assert list(result_reverse.keys()) == ["c", "b", "a"]
-
-
-@pytest.fixture(scope='function')
-def cleanup_temp_files(tmp_path_factory):
-	yield
-	for file in tmp_path_factory.mktemp("cleanup").iterdir():
-		os.remove(file)
-
-
-def test_cleanup_temp_files(cleanup_temp_files):
-	content = '''
-    {
-        "test_key": "test_value"
-    }
-    '''
-	file_path = create_temp_json(tmp_path_factory.mktemp("test_dir"), content)
-	assert file_path.exists()
-	cleanup_temp_files
-	assert not file_path.exists()
-
-
-def test_create_multiple_files(tmp_path_factory):
-	content1 = '{"key1": "value1"}'
-	content2 = '{"key2": "value2"}'
-
-	file1 = create_temp_json(tmp_path_factory.mktemp("test_dir_1"), content1)
-	file2 = create_temp_json(tmp_path_factory.mktemp("test_dir_2"), content2)
-
-	assert file1.exists()
-	assert file2.exists()
-	assert file1 != file2
-
-	cleanup_temp_files()
-	assert not file1.exists()
-	assert not file2.exists()
-
-
-def test_parse_json_content(tmp_path):
-	content = '''
-    {
-        "key1": "value1",
-        "key2": 42
-    }
-    '''
-	file_path = create_temp_json(tmp_path, content)
-	with open(file_path, 'r') as f:
-		parsed_content = json.load(f)
-	assert parsed_content == {"key1": "value1", "key2": 42}
-
-
-def test_tempfile_usage():
-	with tempfile.TemporaryDirectory() as temp_dir:
-		file_path = Path(temp_dir) / "test_file.txt"
-		with file_path.open(mode="w") as f:
-			f.write("Hello, pytest!")
-
-		assert file_path.exists()
-		assert file_path.read_text() == "Hello, pytest!"
-
-		# Cleanup happens automatically when exiting the context manager