def unittest(self): """ Run unittests for this repository. """ terminal("-m", "unittest", "discover", str(self.get_test_path()), python=True)
def upload(self): """ Upload local repo to PyPI. Todo: Make sure twine is installed when trying to upload to pypi. """ if self.private: raise AttributeError("Cannot upload private repo.") self.create_sdist() with self.path.as_working_dir(): terminal("-m", "twine", "upload", "dist/*", python=True)
def generate_exe(self, file_path=None, suppress=False): """ Generate an exe file for target file_path python file. """ if file_path is None: file_path = self.get_exetarget_path() assert file_path.exists() with self.path.as_working_dir(): terminal("-m", "PyInstaller", file_path, "--onefile", "--windowed", python=True, suppress=suppress)
def create_sdist(self): """ Create source distribution. """ with self.path.as_working_dir(): terminal("setup.py", "sdist", "bdist_wheel", python=True)
def pip_uninstall(self): """ Uninstall this repository with pip.""" terminal("-m", "pip", "uninstall", "-y", self.name, python=True)
def pip_install(self): """ Install this repository with pip, WITHOUT -e flag. Subprocess messed up -e flag compared to doing it in terminal, so use the normal one.""" with self.path.as_working_dir(): terminal("pip", "install", "-e", ".")