python-dev-project
Description
(Optionally) clone a Python project git repo, install the right version of Python using pyenv, create a virtualenv for the project, then install the project and it's requirements into the virtualenv for development.
Also create a .python-version in the project folder so the virtualenv is always activated when the folder is visited in the shell.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
string | -- | The project folder. Required |
|
string | -- | The name of the project. |
|
string | -- | The git repo url of the project (optional). |
|
string | latest | The version of python. |
Code
doc: short_help: null help: | (Optionally) clone a Python project git repo, install the right version of Python using pyenv, create a virtualenv for the project, then install the project and it's requirements into the virtualenv for development. Also create a .python-version in the project folder so the virtualenv is always activated when the folder is visited in the shell. args: _import: python-virtualenv project_name: doc: short_help: The name of the project. type: string required: false project_folder: doc: short_help: The project folder. type: string required: true project_repo: doc: short_help: The git repo url of the project (optional). type: string required: false frecklets: - git-repo-synced: frecklet::skip: '{{:: project_repo | true_if_empty ::}}' repo: '{{:: project_repo ::}}' dest: '{{:: project_folder ::}}' - python-virtualenv: venv_name: '{{:: project_name | default(project_folder|basename) ::}}-dev' pip_extra_args: -e python_packages: - '{{:: project_folder ::}}' python_version: '{{:: python_version ::}}' python_type: pyenv - file-with-content: path: '{{:: project_folder ::}}/.python-version' content: '{{:: project_name | default(project_folder|basename) ::}}-dev'
frecklecute python-dev-project --help Usage: frecklecute python-dev-project [OPTIONS] (Optionally) clone a Python project git repo, install the right version of Python using pyenv, create a virtualenv for the project, then install the project and it's requirements into the virtualenv for development. Also create a .python-version in the project folder so the virtualenv is always activated when the folder is visited in the shell. Options: --project-folder PROJECT_FOLDER The project folder. [required] --project-name PROJECT_NAME The name of the project. --project-repo PROJECT_REPO The git repo url of the project (optional). --python-version PYTHON_VERSION The version of python. --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.python_dev_project.PythonDevProject # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class PythonDevProject(AutoPycklet): """(Optionally) clone a Python project git repo, install the right version of Python using pyenv, create a virtualenv for the project, then install the project and it's requirements into the virtualenv for development. Also create a .python-version in the project folder so the virtualenv is always activated when the folder is visited in the shell. Args: project_folder: The project folder. project_name: The name of the project. project_repo: The git repo url of the project (optional). python_version: The version of python. """ FRECKLET_ID = "python-dev-project" project_folder: str = None project_name: str = None project_repo: str = None python_version: str = None def __post_init__(self): super(PythonDevProject, self).__init__(var_names=["project_folder", "project_name", "project_repo", "python_version"]) frecklet_class = PythonDevProject
# -*- coding: utf-8 -*- # # module path: pycklets.python_dev_project.PythonDevProject # from pyckles import AutoPycklet class PythonDevProject(AutoPycklet): """(Optionally) clone a Python project git repo, install the right version of Python using pyenv, create a virtualenv for the project, then install the project and it's requirements into the virtualenv for development. Also create a .python-version in the project folder so the virtualenv is always activated when the folder is visited in the shell. Args: project_folder: The project folder. project_name: The name of the project. project_repo: The git repo url of the project (optional). python_version: The version of python. """ FRECKLET_ID = "python-dev-project" def __init__(self, project_folder=None, project_name=None, project_repo=None, python_version="latest"): super(PythonDevProject, self).__init__(var_names=["project_folder", "project_name", "project_repo", "python_version"]) self._project_folder = project_folder self._project_name = project_name self._project_repo = project_repo self._python_version = python_version @property def project_folder(self): return self._project_folder @project_folder.setter def project_folder(self, project_folder): self._project_folder = project_folder @property def project_name(self): return self._project_name @project_name.setter def project_name(self, project_name): self._project_name = project_name @property def project_repo(self): return self._project_repo @project_repo.setter def project_repo(self, project_repo): self._project_repo = project_repo @property def python_version(self): return self._python_version @python_version.setter def python_version(self, python_version): self._python_version = python_version frecklet_class = PythonDevProject