zensols.install


Namezensols.install JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/plandes/install
SummaryDownloads and installs (optionally compressed) files.
upload_time2024-03-05 10:50:08
maintainer
docs_urlNone
authorPaul Landes
requires_python
license
keywords tooling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Downloads and installs files

[![PyPI][pypi-badge]][pypi-link]
[![Python 3.10][python3100-badge]][python3100-link]
[![Python 3.11][python311-badge]][python311-link]
[![Build Status][build-badge]][build-link]

Simple light API to download and install files.  If the file appears to be a
compressed file by ending with `zip`, `tar.gz`, `tgz` etc, then also un-compress
the file after it is downloaded.  The process flow follows:

1. Check to see if the installed file exists.  If not download it.
1. Otherwise, if the file has been downloaded uncompress it.
1. If the file could not be downloaded, uncompressed, or a file from the
   uncompressed file isn't found an error is thrown.

A destination location can be specified in the configuration.  It is also
possible to install it in the `~/.cache/<package name>` where *package name* is
the name the installed package.  For example, that would be `zensols.install`
for the package installed for this repository.


## Documentation

* [Full documentation](https://plandes.github.io/install/index.html)
* [API reference](https://plandes.github.io/install/api.html)


## Obtaining

The easiest way to install the command line program is via the `pip` installer:
```bash
pip3 install zensols.install
```

Binaries are also available on [pypi].


## Usage

The below code is given in the [example].

First create the installer configuration with each file to be installed as a
resource as a file `install.conf`:
```ini
[zip_resource]
class_name = zensols.install.Resource
url = https://github.com/plandes/zenbuild/archive/refs/tags/general_build.zip
# we have to give the name of the diretory in the zip file so the program knows
# what to unzip; otherwise it is named from the section, or file if `None`
name = zenbuild-general_build
# uncomment below to keep the `zenbuild-general_build.zip` zip file
#clean_up = False

[downloader]
class_name = zensols.install.Downloader
#use_progress_bar = False

[installer]
class_name = zensols.install.Installer
downloader = instance: downloader
# uncomment the below line, then comment out `base_directory` to use the
# package name (using the zensols.cli.ApplicationFactory--see example); using
# `package_resource` will in install a ~/.<package name> install directory
base_directory = path: install_dir
#package_resource = ${package:name}
resources = instance: list: zip_resource
```

Now use the configuration to create the installer and call it:
```python
import logging
from zensols.config import IniConfig, ImportConfigFactory
from zensols.install import Installer

logging.basicConfig(level=logging.INFO)
fac = ImportConfigFactory(IniConfig('install.conf'))
installer: Installer = fac.instance('installer')
installer.install()
```

This code creates a new directory with the un-zipped files in `install_dir`:

```readline-config
INFO:zensols.install.installer:installing zenbuild-general_build to install_dir/zenbuild-general_build
INFO:zensols.install.download:creating directory: install_dir
INFO:zensols.install.download:downloading https://github.com/plandes/zenbuild/archive/refs/tags/general_build.zip to install_dir/zenbuild-general_build.zip
general_build.zip: 16.4kB [00:00, 40.1kB/s]
INFO:zensols.install.installer:uncompressing install_dir/zenbuild-general_build.zip to install_dir
patool: Extracting install_dir/zenbuild-general_build.zip ...
patool: ... install_dir/zenbuild-general_build.zip extracted to `install_dir'.
INFO:zensols.install.installer:cleaning up downloaded file: install_dir/zenbuild-general_build.zip
```

First the program checks to see if the target directory (`name` property in the
`zip_resource` section) exists.  It then downloads it when it can't find either
the target directory or the downloaded file.

If the program is run a second time, there will be no output since the
installed directory now exists.


## Changelog

An extensive changelog is available [here](CHANGELOG.md).


## License

[MIT License](LICENSE.md)

Copyright (c) 2021 - 2023 Paul Landes


<!-- links -->
[pypi]: https://pypi.org/project/zensols.install/
[pypi-link]: https://pypi.python.org/pypi/zensols.install
[pypi-badge]: https://img.shields.io/pypi/v/zensols.install.svg
[python3100-badge]: https://img.shields.io/badge/python-3.10-blue.svg
[python3100-link]: https://www.python.org/downloads/release/python-3100
[python311-badge]: https://img.shields.io/badge/python-3.11-blue.svg
[python311-link]: https://www.python.org/downloads/release/python-3110
[build-badge]: https://github.com/plandes/install/workflows/CI/badge.svg
[build-link]: https://github.com/plandes/install/actions

[example]: https://github.com/plandes/install/tree/master/example

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/plandes/install",
    "name": "zensols.install",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "tooling",
    "author": "Paul Landes",
    "author_email": "landes@mailc.net",
    "download_url": "https://github.com/plandes/install/releases/download/v1.1.2/zensols.install-1.1.2-py3-none-any.whl",
    "platform": null,
    "description": "# Downloads and installs files\n\n[![PyPI][pypi-badge]][pypi-link]\n[![Python 3.10][python3100-badge]][python3100-link]\n[![Python 3.11][python311-badge]][python311-link]\n[![Build Status][build-badge]][build-link]\n\nSimple light API to download and install files.  If the file appears to be a\ncompressed file by ending with `zip`, `tar.gz`, `tgz` etc, then also un-compress\nthe file after it is downloaded.  The process flow follows:\n\n1. Check to see if the installed file exists.  If not download it.\n1. Otherwise, if the file has been downloaded uncompress it.\n1. If the file could not be downloaded, uncompressed, or a file from the\n   uncompressed file isn't found an error is thrown.\n\nA destination location can be specified in the configuration.  It is also\npossible to install it in the `~/.cache/<package name>` where *package name* is\nthe name the installed package.  For example, that would be `zensols.install`\nfor the package installed for this repository.\n\n\n## Documentation\n\n* [Full documentation](https://plandes.github.io/install/index.html)\n* [API reference](https://plandes.github.io/install/api.html)\n\n\n## Obtaining\n\nThe easiest way to install the command line program is via the `pip` installer:\n```bash\npip3 install zensols.install\n```\n\nBinaries are also available on [pypi].\n\n\n## Usage\n\nThe below code is given in the [example].\n\nFirst create the installer configuration with each file to be installed as a\nresource as a file `install.conf`:\n```ini\n[zip_resource]\nclass_name = zensols.install.Resource\nurl = https://github.com/plandes/zenbuild/archive/refs/tags/general_build.zip\n# we have to give the name of the diretory in the zip file so the program knows\n# what to unzip; otherwise it is named from the section, or file if `None`\nname = zenbuild-general_build\n# uncomment below to keep the `zenbuild-general_build.zip` zip file\n#clean_up = False\n\n[downloader]\nclass_name = zensols.install.Downloader\n#use_progress_bar = False\n\n[installer]\nclass_name = zensols.install.Installer\ndownloader = instance: downloader\n# uncomment the below line, then comment out `base_directory` to use the\n# package name (using the zensols.cli.ApplicationFactory--see example); using\n# `package_resource` will in install a ~/.<package name> install directory\nbase_directory = path: install_dir\n#package_resource = ${package:name}\nresources = instance: list: zip_resource\n```\n\nNow use the configuration to create the installer and call it:\n```python\nimport logging\nfrom zensols.config import IniConfig, ImportConfigFactory\nfrom zensols.install import Installer\n\nlogging.basicConfig(level=logging.INFO)\nfac = ImportConfigFactory(IniConfig('install.conf'))\ninstaller: Installer = fac.instance('installer')\ninstaller.install()\n```\n\nThis code creates a new directory with the un-zipped files in `install_dir`:\n\n```readline-config\nINFO:zensols.install.installer:installing zenbuild-general_build to install_dir/zenbuild-general_build\nINFO:zensols.install.download:creating directory: install_dir\nINFO:zensols.install.download:downloading https://github.com/plandes/zenbuild/archive/refs/tags/general_build.zip to install_dir/zenbuild-general_build.zip\ngeneral_build.zip: 16.4kB [00:00, 40.1kB/s]\nINFO:zensols.install.installer:uncompressing install_dir/zenbuild-general_build.zip to install_dir\npatool: Extracting install_dir/zenbuild-general_build.zip ...\npatool: ... install_dir/zenbuild-general_build.zip extracted to `install_dir'.\nINFO:zensols.install.installer:cleaning up downloaded file: install_dir/zenbuild-general_build.zip\n```\n\nFirst the program checks to see if the target directory (`name` property in the\n`zip_resource` section) exists.  It then downloads it when it can't find either\nthe target directory or the downloaded file.\n\nIf the program is run a second time, there will be no output since the\ninstalled directory now exists.\n\n\n## Changelog\n\nAn extensive changelog is available [here](CHANGELOG.md).\n\n\n## License\n\n[MIT License](LICENSE.md)\n\nCopyright (c) 2021 - 2023 Paul Landes\n\n\n<!-- links -->\n[pypi]: https://pypi.org/project/zensols.install/\n[pypi-link]: https://pypi.python.org/pypi/zensols.install\n[pypi-badge]: https://img.shields.io/pypi/v/zensols.install.svg\n[python3100-badge]: https://img.shields.io/badge/python-3.10-blue.svg\n[python3100-link]: https://www.python.org/downloads/release/python-3100\n[python311-badge]: https://img.shields.io/badge/python-3.11-blue.svg\n[python311-link]: https://www.python.org/downloads/release/python-3110\n[build-badge]: https://github.com/plandes/install/workflows/CI/badge.svg\n[build-link]: https://github.com/plandes/install/actions\n\n[example]: https://github.com/plandes/install/tree/master/example\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Downloads and installs (optionally compressed) files.",
    "version": "1.1.2",
    "project_urls": {
        "Download": "https://github.com/plandes/install/releases/download/v1.1.2/zensols.install-1.1.2-py3-none-any.whl",
        "Homepage": "https://github.com/plandes/install"
    },
    "split_keywords": [
        "tooling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "37becb4f967fd78c7621c7fea3532c7e705398c1b97adc2676e68780f74fc469",
                "md5": "0e4f1aafdba6c0362c37558b035b7ab1",
                "sha256": "f694c10e03760f9f5e8bc595ebddb392287b694a1eaad7588b6c21008206ce16"
            },
            "downloads": -1,
            "filename": "zensols.install-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0e4f1aafdba6c0362c37558b035b7ab1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11783,
            "upload_time": "2024-03-05T10:50:08",
            "upload_time_iso_8601": "2024-03-05T10:50:08.960684Z",
            "url": "https://files.pythonhosted.org/packages/37/be/cb4f967fd78c7621c7fea3532c7e705398c1b97adc2676e68780f74fc469/zensols.install-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 10:50:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "plandes",
    "github_project": "install",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "zensols.install"
}
        
Elapsed time: 0.20319s