Repository: amalfra/docker-hub

Issue:
Fix `site-packages/src` installation directory
Thanks for providing this tool. I was looking at the possibility of using it as a library for our own python projects and I noticed that it does not get pip installed cleanly.

The `src` directory get installed in `site-packages` as `src` which means that if someone else does the same thing the directories will clash.

I strongly recommend that you rename the `src` directory to `docker_hub` and update the referenced accordingly.

Today we can do:
```
import src.libs.docker_hub_client
```

And being able to do:
```
import docker_hub.libs.docker_hub_client
```

would be much cleaner.

I can send a PR if you are interested. The changes should be minimal.


Comments:

Patch:
diff --git a/src/__init__.py b/docker_hub/__init__.py
similarity index 100%
rename from src/__init__.py
rename to docker_hub/__init__.py
diff --git a/src/__main__.py b/docker_hub/__main__.py
similarity index 100%
rename from src/__main__.py
rename to docker_hub/__main__.py
diff --git a/src/cli.py b/docker_hub/cli.py
similarity index 97%
rename from src/cli.py
rename to docker_hub/cli.py
index 0019395..cac0384 100644
--- a/src/cli.py
+++ b/docker_hub/cli.py
@@ -70,7 +70,7 @@ def main():
         sys.exit(1)
 
     # Execute the command provided by user
-    command = importlib.import_module('src.commands.' + args.method)
+    command = importlib.import_module('docker_hub.commands.' + args.method)
     command.run(docker_hub_client, args)
 
     if args.method not in NO_TIP_METHODS and args.format not in \
diff --git a/setup.py b/setup.py
index 9a8d1bd..5998da8 100644
--- a/setup.py
+++ b/setup.py
@@ -35,7 +35,7 @@ long_descr = open('README.md').read()
 
 setup(
     name='docker-hub',
-    version=find_version('src', '__init__.py'),
+    version=find_version('docker_hub', '__init__.py'),
     description='Access docker hub from your terminal',
     long_description=long_descr,
     long_description_content_type='text/markdown',
@@ -49,7 +49,7 @@ setup(
     setup_requires=['pytest-runner', 'setuptools>=38.6.0'],
     tests_require=['pytest'],
     entry_points={
-        'console_scripts': ['docker-hub=src.__main__:main']
+        'console_scripts': ['docker-hub=docker_hub.__main__:main']
     },
     classifiers=[
         'Development Status :: 5 - Production/Stable',


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 22c8d41..3f7094a 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,4 +1,4 @@
-on: [push, pull_request]
+on: [push, pull_request, workflow_dispatch]
 name: Test
 jobs:
   test:
@@ -21,7 +21,7 @@ jobs:
       - name: Lint
         run: pycodestyle .
       - name: Test
-        run: coverage run --source=src setup.py test
+        run: coverage run --source=docker_hub setup.py test
       - name: After success
         if: ${{ success() }}
         env:
diff --git a/src/commands/__init__.py b/docker_hub/commands/__init__.py
similarity index 100%
rename from src/commands/__init__.py
rename to docker_hub/commands/__init__.py
diff --git a/src/commands/builds.py b/docker_hub/commands/builds.py
similarity index 100%
rename from src/commands/builds.py
rename to docker_hub/commands/builds.py
diff --git a/src/commands/config.py b/docker_hub/commands/config.py
similarity index 100%
rename from src/commands/config.py
rename to docker_hub/commands/config.py
diff --git a/src/commands/login.py b/docker_hub/commands/login.py
similarity index 100%
rename from src/commands/login.py
rename to docker_hub/commands/login.py
diff --git a/src/commands/queue.py b/docker_hub/commands/queue.py
similarity index 100%
rename from src/commands/queue.py
rename to docker_hub/commands/queue.py
diff --git a/src/commands/repos.py b/docker_hub/commands/repos.py
similarity index 100%
rename from src/commands/repos.py
rename to docker_hub/commands/repos.py
diff --git a/src/commands/tags.py b/docker_hub/commands/tags.py
similarity index 100%
rename from src/commands/tags.py
rename to docker_hub/commands/tags.py
diff --git a/src/commands/users.py b/docker_hub/commands/users.py
similarity index 100%
rename from src/commands/users.py
rename to docker_hub/commands/users.py
diff --git a/src/commands/version.py b/docker_hub/commands/version.py
similarity index 100%
rename from src/commands/version.py
rename to docker_hub/commands/version.py
diff --git a/src/consts.py b/docker_hub/consts.py
similarity index 100%
rename from src/consts.py
rename to docker_hub/consts.py
diff --git a/src/libs/__init__.py b/docker_hub/libs/__init__.py
similarity index 100%
rename from src/libs/__init__.py
rename to docker_hub/libs/__init__.py
diff --git a/src/libs/config.py b/docker_hub/libs/config.py
similarity index 100%
rename from src/libs/config.py
rename to docker_hub/libs/config.py
diff --git a/src/libs/docker_client.py b/docker_hub/libs/docker_client.py
similarity index 100%
rename from src/libs/docker_client.py
rename to docker_hub/libs/docker_client.py
diff --git a/src/libs/docker_hub_client.py b/docker_hub/libs/docker_hub_client.py
similarity index 100%
rename from src/libs/docker_hub_client.py
rename to docker_hub/libs/docker_hub_client.py
diff --git a/src/libs/utils.py b/docker_hub/libs/utils.py
similarity index 100%
rename from src/libs/utils.py
rename to docker_hub/libs/utils.py
diff --git a/src/tests/__init__.py b/docker_hub/tests/__init__.py
similarity index 100%
rename from src/tests/__init__.py
rename to docker_hub/tests/__init__.py
diff --git a/src/tests/docker_hub_client.py b/docker_hub/tests/docker_hub_client.py
similarity index 100%
rename from src/tests/docker_hub_client.py
rename to docker_hub/tests/docker_hub_client.py
diff --git a/src/tests/helpers.py b/docker_hub/tests/helpers.py
similarity index 100%
rename from src/tests/helpers.py
rename to docker_hub/tests/helpers.py
diff --git a/src/tests/test_commands/__init__.py b/docker_hub/tests/test_commands/__init__.py
similarity index 100%
rename from src/tests/test_commands/__init__.py
rename to docker_hub/tests/test_commands/__init__.py
diff --git a/src/tests/test_commands/test_tags.py b/docker_hub/tests/test_commands/test_tags.py
similarity index 98%
rename from src/tests/test_commands/test_tags.py
rename to docker_hub/tests/test_commands/test_tags.py
index 30a33e6..61e2ce8 100644
--- a/src/tests/test_commands/test_tags.py
+++ b/docker_hub/tests/test_commands/test_tags.py
@@ -3,7 +3,7 @@ from collections import namedtuple
 
 from ..docker_hub_client import \
     NoResultsTestingDockerHubClient, WithResultsTestingDockerHubClient
-from src.commands.tags import run
+from docker_hub.commands.tags import run
 from ..helpers import convert_key_to_result_format, generate_results