install-process


Nameinstall-process JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryA simple library to help you define your installation process, in Python !
upload_time2024-08-18 14:25:44
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 zaicruvoir1rominet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Install process

For a better experience, check the docs: https://install_process.readthedocs.io/

A library to help you define your installation processes.

![quickstart_full_install.png](docs/source/quickstart/quickstart_full_install.png)

## What is ``install_process`` ?

This library's goal is to help you create an installation process for any kind of application / environment.  

With ``install_process``, you can define your entire installation process as a couple of small "install-steps",
which are then executed one after the other.  
When defining your install-steps, ``install_process`` also handles what needs to be done when you need to 
uninstall/reinstall part or the entirety of your install-process.

This lib can be compared to tools like [ANSIBLE](https://www.ansible.com/), but for much simpler and local scopes
*(while still being easily callable with ANSIBLE if finally your project grows big enough)*.

This lib has no dependencies to be easily installed on computers without internet access.

This is an effort to replace old Windows/Linux scripts with Python scripts
(check [here](https://github.com/ninjaaron/replacing-bash-scripting-with-python) for more details).
It is tested on Linux/Windows (not tested on Mac — though it should probably work just fine).

## Install

```shell
pip install install_process
```

## Quick-start

### Case

Let's suppose you need to set up your environment, and for that you need to:
1. install an SQL database
2. configure the database
3. unzip a file at a certain location

You could use install_process to define:
- The database installation & uninstallation process
  - the database install & uninstall
  - the database configuration & revert to default config
- Unzip the file & remove the file

### The code

Here's how you could do this using ``install_process``:

```python
# file: my_environment_setup.py

from install_process import InstallStep, InstallSteps, InstallProcess, setup_install


class InstallMyDatabase(InstallStep):  # The database installation & uninstallation process
  def install(self) -> None:
    """Install my database."""  # This docstring will actually be displayed during the installation process
    # do what's required to install your database here
    # you can display messages to users if you want
    self.display.msg('Database install step')
    # you can call shell commands such as ``self.shell('install mysql')``

  def uninstall(self) -> None:
    """Uninstall my database."""  # This docstring will actually be displayed during the uninstallation process
    # do what's required to uninstall your database here


class ConfigureMyDatabase(InstallStep):  # The database configuration & revert to default process
  def install(self) -> None:
    """Configure my database."""
    # do what's required to configure your database here

  def uninstall(self) -> None:
    """Revert my database configuration to default."""
    # do what's required to revert configuration here


class Database(InstallSteps):  # Let's regroup database-install & database-config under a same step (optional)
  """My Database setup"""  # This docstring will actually be displayed
  steps = [
    InstallMyDatabase(),
    ConfigureMyDatabase(),
  ]


class UnzipMyFile(InstallStep):  # Unzip the file & remove the file
  def install(self) -> None:
    """Unzip my file."""
    # unzip your file where required here

  def uninstall(self) -> None:
    """Remove my file."""
    # remove your file here


class SetupMyEnvironment(InstallProcess):  # Put everything together
  """MY INSTALLATION PROCESS"""  # This docstring will actually be displayed
  steps = [
    Database(),  # Database install & config
    UnzipMyFile(),  # File unzipping
  ]


if __name__ == '__main__':
  setup_install(SetupMyEnvironment)
```

### Launch install, uninstall, reinstall

Now you can install your entire environment:
```commandline
python -m my_environment_setup
```
![quickstart_full_install.png](docs/source/quickstart/quickstart_full_install.png)

Uninstall your entire environment, using the `-i` option:
```commandline
python -m my_environment_setup -i uninstall
```
![quickstart_full_install.png](docs/source/quickstart/quickstart_full_uninstall.png)

Uninstall then install the entire environment:
```commandline
python -m my_environment_setup -i reinstall
```

### Re-install only a specific part

If you wish to only install/uninstall/reinstall a specific part of your environment, you can do so by providing
the name of the step you want to install/uninstall/reinstall.

To get the name of all steps (this does not install or uninstall anything):
```commandline
python -m my_environment_setup -n
```
![quickstart_step_names.png](docs/source/quickstart/quickstart_step_names.png)

Then you can call only a subset of your installation process:
```commandline
python -m my_environment_setup -t Database
```
![quickstart_step_names.png](docs/source/quickstart/quickstart_specific_install.png)

```commandline
python -m my_environment_setup -t Database.ConfigureMyDatabase -i reinstall
```
![quickstart_step_names.png](docs/source/quickstart/quickstart_specific_reinstall.png)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "install-process",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d3/9c/ff4164939351c2b056bcd22ba357baa43625b00ceffc82ec3fdfcb20c47e/install_process-1.0.0.tar.gz",
    "platform": null,
    "description": "# Install process\n\nFor a better experience, check the docs: https://install_process.readthedocs.io/\n\nA library to help you define your installation processes.\n\n![quickstart_full_install.png](docs/source/quickstart/quickstart_full_install.png)\n\n## What is ``install_process`` ?\n\nThis library's goal is to help you create an installation process for any kind of application / environment.  \n\nWith ``install_process``, you can define your entire installation process as a couple of small \"install-steps\",\nwhich are then executed one after the other.  \nWhen defining your install-steps, ``install_process`` also handles what needs to be done when you need to \nuninstall/reinstall part or the entirety of your install-process.\n\nThis lib can be compared to tools like [ANSIBLE](https://www.ansible.com/), but for much simpler and local scopes\n*(while still being easily callable with ANSIBLE if finally your project grows big enough)*.\n\nThis lib has no dependencies to be easily installed on computers without internet access.\n\nThis is an effort to replace old Windows/Linux scripts with Python scripts\n(check [here](https://github.com/ninjaaron/replacing-bash-scripting-with-python) for more details).\nIt is tested on Linux/Windows (not tested on Mac \u2014 though it should probably work just fine).\n\n## Install\n\n```shell\npip install install_process\n```\n\n## Quick-start\n\n### Case\n\nLet's suppose you need to set up your environment, and for that you need to:\n1. install an SQL database\n2. configure the database\n3. unzip a file at a certain location\n\nYou could use install_process to define:\n- The database installation & uninstallation process\n  - the database install & uninstall\n  - the database configuration & revert to default config\n- Unzip the file & remove the file\n\n### The code\n\nHere's how you could do this using ``install_process``:\n\n```python\n# file: my_environment_setup.py\n\nfrom install_process import InstallStep, InstallSteps, InstallProcess, setup_install\n\n\nclass InstallMyDatabase(InstallStep):  # The database installation & uninstallation process\n  def install(self) -> None:\n    \"\"\"Install my database.\"\"\"  # This docstring will actually be displayed during the installation process\n    # do what's required to install your database here\n    # you can display messages to users if you want\n    self.display.msg('Database install step')\n    # you can call shell commands such as ``self.shell('install mysql')``\n\n  def uninstall(self) -> None:\n    \"\"\"Uninstall my database.\"\"\"  # This docstring will actually be displayed during the uninstallation process\n    # do what's required to uninstall your database here\n\n\nclass ConfigureMyDatabase(InstallStep):  # The database configuration & revert to default process\n  def install(self) -> None:\n    \"\"\"Configure my database.\"\"\"\n    # do what's required to configure your database here\n\n  def uninstall(self) -> None:\n    \"\"\"Revert my database configuration to default.\"\"\"\n    # do what's required to revert configuration here\n\n\nclass Database(InstallSteps):  # Let's regroup database-install & database-config under a same step (optional)\n  \"\"\"My Database setup\"\"\"  # This docstring will actually be displayed\n  steps = [\n    InstallMyDatabase(),\n    ConfigureMyDatabase(),\n  ]\n\n\nclass UnzipMyFile(InstallStep):  # Unzip the file & remove the file\n  def install(self) -> None:\n    \"\"\"Unzip my file.\"\"\"\n    # unzip your file where required here\n\n  def uninstall(self) -> None:\n    \"\"\"Remove my file.\"\"\"\n    # remove your file here\n\n\nclass SetupMyEnvironment(InstallProcess):  # Put everything together\n  \"\"\"MY INSTALLATION PROCESS\"\"\"  # This docstring will actually be displayed\n  steps = [\n    Database(),  # Database install & config\n    UnzipMyFile(),  # File unzipping\n  ]\n\n\nif __name__ == '__main__':\n  setup_install(SetupMyEnvironment)\n```\n\n### Launch install, uninstall, reinstall\n\nNow you can install your entire environment:\n```commandline\npython -m my_environment_setup\n```\n![quickstart_full_install.png](docs/source/quickstart/quickstart_full_install.png)\n\nUninstall your entire environment, using the `-i` option:\n```commandline\npython -m my_environment_setup -i uninstall\n```\n![quickstart_full_install.png](docs/source/quickstart/quickstart_full_uninstall.png)\n\nUninstall then install the entire environment:\n```commandline\npython -m my_environment_setup -i reinstall\n```\n\n### Re-install only a specific part\n\nIf you wish to only install/uninstall/reinstall a specific part of your environment, you can do so by providing\nthe name of the step you want to install/uninstall/reinstall.\n\nTo get the name of all steps (this does not install or uninstall anything):\n```commandline\npython -m my_environment_setup -n\n```\n![quickstart_step_names.png](docs/source/quickstart/quickstart_step_names.png)\n\nThen you can call only a subset of your installation process:\n```commandline\npython -m my_environment_setup -t Database\n```\n![quickstart_step_names.png](docs/source/quickstart/quickstart_specific_install.png)\n\n```commandline\npython -m my_environment_setup -t Database.ConfigureMyDatabase -i reinstall\n```\n![quickstart_step_names.png](docs/source/quickstart/quickstart_specific_reinstall.png)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 zaicruvoir1rominet  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A simple library to help you define your installation process, in Python !",
    "version": "1.0.0",
    "project_urls": {
        "Changelog": "https://github.com/zaicruvoir1rominet/install_process/main/CHANGELOG.md",
        "Github": "https://github.com/zaicruvoir1rominet/install_process"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1e3c5675231230b98042fd00207109c80aca642842c5781c4e1b32fddd0bf230",
                "md5": "078f9617cd58cb7448d552848821f876",
                "sha256": "4078c31f88ee092f7b2e3b3128edecc543a8bb32f0666e10ceaf9b89abb0c431"
            },
            "downloads": -1,
            "filename": "install_process-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "078f9617cd58cb7448d552848821f876",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9649,
            "upload_time": "2024-08-18T14:25:39",
            "upload_time_iso_8601": "2024-08-18T14:25:39.555710Z",
            "url": "https://files.pythonhosted.org/packages/1e/3c/5675231230b98042fd00207109c80aca642842c5781c4e1b32fddd0bf230/install_process-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d39cff4164939351c2b056bcd22ba357baa43625b00ceffc82ec3fdfcb20c47e",
                "md5": "cdc0e8defcd44b313b243ce78f77b777",
                "sha256": "7d61c7172874f03a8233e0bc2af1c3e4bfb733ada93ed53085fbd5bf88dcd27a"
            },
            "downloads": -1,
            "filename": "install_process-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cdc0e8defcd44b313b243ce78f77b777",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 379999,
            "upload_time": "2024-08-18T14:25:44",
            "upload_time_iso_8601": "2024-08-18T14:25:44.058629Z",
            "url": "https://files.pythonhosted.org/packages/d3/9c/ff4164939351c2b056bcd22ba357baa43625b00ceffc82ec3fdfcb20c47e/install_process-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-18 14:25:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zaicruvoir1rominet",
    "github_project": "install_process",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "install-process"
}
        
Elapsed time: 0.29115s