diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | commit.sh | 3 | ||||
| -rw-r--r-- | requirements.txt | 2 | ||||
| -rw-r--r-- | setup.py | 31 |
4 files changed, 22 insertions, 16 deletions
@@ -64,7 +64,7 @@ This will create a virtual environment named `env`. This environment will be use This will activate the virtual environment. You can now install the project's dependencies by running the following command: - pip install -r requirements.txt + python3 setup.py install This will install all the dependencies required to run the project. You can now start making changes. @@ -45,9 +45,6 @@ commands() { # Format code python3 -m black . - # Generate Requirements.txt - pipreqs ./ --ignore .venv - # Generate Maintainers List python3 scripts/maintainers.py } diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 99f89aa..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -inquirer==2.10.0 -PyYAML==6.0 @@ -3,7 +3,6 @@ # run sorter, linter, start and build the project and more. It will be a # constantly evolving script as the project evolves. -import importlib.util import logging as logger import os import subprocess @@ -14,25 +13,28 @@ logger.basicConfig(stream=sys.stdout, level=logger.DEBUG) def install_pip(package_name): # check if package is installed - if importlib.util.find_spec(package_name) is None: - # install package + check_command = "pip3 show " + package_name + try: + output = subprocess.check_output(check_command, shell=True) + except: logger.info(f"Installing {package_name}...") subprocess.check_call( [sys.executable, "-m", "pip", "-q", "install", package_name] ) -DEV_PACKAGES = ["black", "isort", "click"] -for package in DEV_PACKAGES: - install_pip(package) +PACKAGES = ["black", "isort", "click", "inquirer", "pyyaml"] + + +def install_packages(): + install_pip(" ".join(PACKAGES)) + import click import inquirer class Setup: - QUIET_INSTALL = "pip install -q -r requirements.txt" - def shell_run(self, command): output = subprocess.check_output(command, shell=True) return output.decode("utf-8") @@ -41,8 +43,6 @@ class Setup: if not os.path.exists(".venv"): self.shell_run("python3 -m venv .venv") logger.info("Virtual environment created.") - logger.info("Installing requirements...") - self.shell_run(self.QUIET_INSTALL) self.git() def git(self): @@ -129,5 +129,16 @@ def start(): cli.add_command(start) + [email protected](help="Install requirements.") +def install(): + logger.info("Installing requirements...") + install_packages() + logger.info("Requirements installed.") + + +cli.add_command(install) + + if __name__ == "__main__": cli() |
