pygitgrab


Namepygitgrab JSON
Version 0.0.20 PyPI version JSON
download
home_pagehttps://github.com/kr-g/pygitgrab
Summarygrab only certain information from remote git repo and store them local
upload_time2021-11-08 06:41:35
maintainer
docs_urlNone
authork.r. goger
requires_python>=3.6
licenseMIT
keywords python utility shell git
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# pygitgrab 

grab only certain information from remote git repo and store them local

# general information

`pygitgrab` is not intended to be a replacement for git and it's capabilities.
`pygitgrab` will not do housekeeping, meaning maintaing the local directory content like syncing or such a like.
in case remote files or folders are dropped it is required to clean local folders manually.

# what's new ?

Check
[`CHANGELOG`](https://github.com/kr-g/pygitgrab/blob/master/CHANGELOG.md)
for latest ongoing, or upcoming news

# installation

the module is on [pypi](https://pypi.org/kr-g/pygitgrab) and can be installed with pip

# run from cmd line

    [python3 -m] pygitgrab -h
    
    python3 -m pygitgrab -u user_name # user_name is optional, will prompt for password
    
    # use credits file for github authentication 
    python3 -m pygitgrab -c 
    
    # use other .pygg files, here web.pygg, and cntrl.pygg
    python3 -m pygitgrab -u user_name -f web -f cntrl   
    
    # use remote .pygg files, use ref for selecting the github tag
    # if ref=master fails try ref=main or any valid tag, no detail error message from github
    python3 -m pygitgrab -u user_name -url https://github.com/kr-g/pygitgrab/cntrl.pygg?ref=master
    
    
github offers downloading for unauthenticed users only within certain rate limits [https://developer.github.com/v3/rate_limit/](https://developer.github.com/v3/rate_limit/).
in case downloading a bunch of serveral project files it is required to authenticate. (see also deprecation note of GitHub at the end of this document)


# pygg.cfg structure

`pygitgrab` loads a `pygg.cfg` config file from the current directory to perform the required steps.
the structure is as following:

    [repo_alias]
    # url to repo
    url=https://github.com/_owner_name_/_repo_name_
    # optional version to check out, defaults to 'master'
    tag=master
    # optional destination folder given, defaults to 'repo_alias' (name of this section in the config file)
    # pull_alias is just a name for the pull task
    pull_alias="*.py", "new_folder"
    # sample for pulling a license and store them at a different place
    license="LICENSE.md", "LICENSE/a_license.MD"
    

`pygitgrab` will create the directory structure as found in the remote git repo when pattern matching is used.

`pygitgrab` uses python [configparser](https://docs.python.org/3/library/configparser.html).
general information regarding the syntax can be found there.

# other pygg files

when calling with parameter `-f cfgfile` the configuration is read from there instead of `pygg.cfg` config file.
if a file extension is missing an extension `.pygg` is added as default.


# cmd line parameter

    usage: [python3 -m] pygitgrab [options]

    grab files from remote git repo.

    optional arguments:
      -h, --help            show this help message and exit
      -v, --version         show version info and exit
      -V, --verbose         show more info
      -L, --license         show license info and exit
      -s, --simulate        dry run, do not download files
      -f FILE, --file FILE  name of pygg file to read, adds as '.pygg' extension if missing
      -url URL              name of remote pygg file on github to read, adds as '.pygg' extension if missing
      -u [USER], --user [USER]
                            authenticate with user, no user for prompt. create a personal access token in your github settings instead of using a password.
                            unauthenticated users have a lower rate for downloading from github. https://developer.github.com/v3/rate_limit/
      -c [CREDITS], --credits [CREDITS]
                            read user and personal token from a file instead of prompting. make sure to put the file not in git controlled directory, (default:
                            '~/pygg.credits.txt')
      -nc, -ano, --no-credits, --anonymous
                            don't use the main credits file '~/.pygg_credits'
      -irepo INSPECT_REPO, --inspect-repo INSPECT_REPO
                            read repo meta data
      -idir INSPECT_DIR [INSPECT_DIR ...], --inspect-dir INSPECT_DIR [INSPECT_DIR ...]
                            read repo directory content
      -itags INSPECT_TAGS, --inspect-tags INSPECT_TAGS
                            read repo tags

    for more information refer to https://github.com/kr-g/pygitgrab


# 3rd party licenses

when you move 3rd party license information into the special folder 'LICENSE' the cmd `python3 -m pygitgrab -L` will produce a summary of all found licences together with a 'LICENSE' file found in the current directory. use as `python3 -m pygitgrab -L > LICENSES` to produce a summary plain text file.


# limitations

works only with github as backend.


# deprecation of user and password authentication 

github recently [announced](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/) to discontinue user/password authentication soon.

use a [personal access token](https://developer.github.com/v3/auth/#basic-authentication) instead of a password.

create your personal access token under [GitHub developer settings](https://github.com/settings/tokens) as described in the help for [creating a personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line)

the minimum required scope(s) of the token is `public_repo`


# using a credits file instead of manual authentication
                              
with the option `-c` or `--credits` pygitgrab reads the github user credits from a file.
                              
this defaults to `~/pygg.credits.txt` in the home directory if not specified.
dont put it under a git controlled directory to prevent exposing your sensitive data.
                              
the file itself should have 2 lines the following structure:
                              
    user-name
    user-token

it can have blank lines at any place.
  
## user local credits file

if no parameter `-c` is given pygitgrab reads the credits from `~/.pygg_credits` by default.

this default behaviour can be disabled by the parameter `--anonymous` where pygitgrab downloads without any user credit information.


# inspect methods samples

    # use optional credit file by adding -c below

    # list the meta info for repo pygitgrab 
    pygitgrab -irepo https://github.com/kr-g/pygitgrab 

    # list the tags info for repo pygitgrab 
    pygitgrab -itags https://github.com/kr-g/pygitgrab 

    # list the root directory pygitgrab 
    pygitgrab -idir https://github.com/kr-g/pygitgrab 

    # list the directory pygitgrab with the specific tag v0.0.18
    pygitgrab -idir https://github.com/kr-g/pygitgrab pygitgrab?ref=v0.0.18
    
    # list the root directory pygitgrab with the specific tag v0.0.18
    pygitgrab -idir https://github.com/kr-g/pygitgrab "."?ref=v0.0.18
    




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kr-g/pygitgrab",
    "name": "pygitgrab",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "python utility shell,git",
    "author": "k.r. goger",
    "author_email": "k.r.goger+pygitgrab@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0c/8a/7b289a97b362094816b38ba14b3c8f2e4df4b41bb142ad942cd7a0bce01f/pygitgrab-0.0.20.tar.gz",
    "platform": "",
    "description": "[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# pygitgrab \n\ngrab only certain information from remote git repo and store them local\n\n# general information\n\n`pygitgrab` is not intended to be a replacement for git and it's capabilities.\n`pygitgrab` will not do housekeeping, meaning maintaing the local directory content like syncing or such a like.\nin case remote files or folders are dropped it is required to clean local folders manually.\n\n# what's new ?\n\nCheck\n[`CHANGELOG`](https://github.com/kr-g/pygitgrab/blob/master/CHANGELOG.md)\nfor latest ongoing, or upcoming news\n\n# installation\n\nthe module is on [pypi](https://pypi.org/kr-g/pygitgrab) and can be installed with pip\n\n# run from cmd line\n\n    [python3 -m] pygitgrab -h\n    \n    python3 -m pygitgrab -u user_name # user_name is optional, will prompt for password\n    \n    # use credits file for github authentication \n    python3 -m pygitgrab -c \n    \n    # use other .pygg files, here web.pygg, and cntrl.pygg\n    python3 -m pygitgrab -u user_name -f web -f cntrl   \n    \n    # use remote .pygg files, use ref for selecting the github tag\n    # if ref=master fails try ref=main or any valid tag, no detail error message from github\n    python3 -m pygitgrab -u user_name -url https://github.com/kr-g/pygitgrab/cntrl.pygg?ref=master\n    \n    \ngithub offers downloading for unauthenticed users only within certain rate limits [https://developer.github.com/v3/rate_limit/](https://developer.github.com/v3/rate_limit/).\nin case downloading a bunch of serveral project files it is required to authenticate. (see also deprecation note of GitHub at the end of this document)\n\n\n# pygg.cfg structure\n\n`pygitgrab` loads a `pygg.cfg` config file from the current directory to perform the required steps.\nthe structure is as following:\n\n    [repo_alias]\n    # url to repo\n    url=https://github.com/_owner_name_/_repo_name_\n    # optional version to check out, defaults to 'master'\n    tag=master\n    # optional destination folder given, defaults to 'repo_alias' (name of this section in the config file)\n    # pull_alias is just a name for the pull task\n    pull_alias=\"*.py\", \"new_folder\"\n    # sample for pulling a license and store them at a different place\n    license=\"LICENSE.md\", \"LICENSE/a_license.MD\"\n    \n\n`pygitgrab` will create the directory structure as found in the remote git repo when pattern matching is used.\n\n`pygitgrab` uses python [configparser](https://docs.python.org/3/library/configparser.html).\ngeneral information regarding the syntax can be found there.\n\n# other pygg files\n\nwhen calling with parameter `-f cfgfile` the configuration is read from there instead of `pygg.cfg` config file.\nif a file extension is missing an extension `.pygg` is added as default.\n\n\n# cmd line parameter\n\n    usage: [python3 -m] pygitgrab [options]\n\n    grab files from remote git repo.\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -v, --version         show version info and exit\n      -V, --verbose         show more info\n      -L, --license         show license info and exit\n      -s, --simulate        dry run, do not download files\n      -f FILE, --file FILE  name of pygg file to read, adds as '.pygg' extension if missing\n      -url URL              name of remote pygg file on github to read, adds as '.pygg' extension if missing\n      -u [USER], --user [USER]\n                            authenticate with user, no user for prompt. create a personal access token in your github settings instead of using a password.\n                            unauthenticated users have a lower rate for downloading from github. https://developer.github.com/v3/rate_limit/\n      -c [CREDITS], --credits [CREDITS]\n                            read user and personal token from a file instead of prompting. make sure to put the file not in git controlled directory, (default:\n                            '~/pygg.credits.txt')\n      -nc, -ano, --no-credits, --anonymous\n                            don't use the main credits file '~/.pygg_credits'\n      -irepo INSPECT_REPO, --inspect-repo INSPECT_REPO\n                            read repo meta data\n      -idir INSPECT_DIR [INSPECT_DIR ...], --inspect-dir INSPECT_DIR [INSPECT_DIR ...]\n                            read repo directory content\n      -itags INSPECT_TAGS, --inspect-tags INSPECT_TAGS\n                            read repo tags\n\n    for more information refer to https://github.com/kr-g/pygitgrab\n\n\n# 3rd party licenses\n\nwhen you move 3rd party license information into the special folder 'LICENSE' the cmd `python3 -m pygitgrab -L` will produce a summary of all found licences together with a 'LICENSE' file found in the current directory. use as `python3 -m pygitgrab -L > LICENSES` to produce a summary plain text file.\n\n\n# limitations\n\nworks only with github as backend.\n\n\n# deprecation of user and password authentication \n\ngithub recently [announced](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/) to discontinue user/password authentication soon.\n\nuse a [personal access token](https://developer.github.com/v3/auth/#basic-authentication) instead of a password.\n\ncreate your personal access token under [GitHub developer settings](https://github.com/settings/tokens) as described in the help for [creating a personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line)\n\nthe minimum required scope(s) of the token is `public_repo`\n\n\n# using a credits file instead of manual authentication\n                              \nwith the option `-c` or `--credits` pygitgrab reads the github user credits from a file.\n                              \nthis defaults to `~/pygg.credits.txt` in the home directory if not specified.\ndont put it under a git controlled directory to prevent exposing your sensitive data.\n                              \nthe file itself should have 2 lines the following structure:\n                              \n    user-name\n    user-token\n\nit can have blank lines at any place.\n  \n## user local credits file\n\nif no parameter `-c` is given pygitgrab reads the credits from `~/.pygg_credits` by default.\n\nthis default behaviour can be disabled by the parameter `--anonymous` where pygitgrab downloads without any user credit information.\n\n\n# inspect methods samples\n\n    # use optional credit file by adding -c below\n\n    # list the meta info for repo pygitgrab \n    pygitgrab -irepo https://github.com/kr-g/pygitgrab \n\n    # list the tags info for repo pygitgrab \n    pygitgrab -itags https://github.com/kr-g/pygitgrab \n\n    # list the root directory pygitgrab \n    pygitgrab -idir https://github.com/kr-g/pygitgrab \n\n    # list the directory pygitgrab with the specific tag v0.0.18\n    pygitgrab -idir https://github.com/kr-g/pygitgrab pygitgrab?ref=v0.0.18\n    \n    # list the root directory pygitgrab with the specific tag v0.0.18\n    pygitgrab -idir https://github.com/kr-g/pygitgrab \".\"?ref=v0.0.18\n    \n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "grab only certain information from remote git repo and store them local",
    "version": "0.0.20",
    "split_keywords": [
        "python utility shell",
        "git"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1be906ca09c29be4061af9dc1f7e3fe975d58ddc4a906219b70fe926bf94b5ad",
                "md5": "b1e03338239114fba2a89a5500dd4572",
                "sha256": "da95eb914b425604d8a0098a705781f7e6fb58950ff8311d80013ba71cf22add"
            },
            "downloads": -1,
            "filename": "pygitgrab-0.0.20-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b1e03338239114fba2a89a5500dd4572",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11710,
            "upload_time": "2021-11-08T06:41:33",
            "upload_time_iso_8601": "2021-11-08T06:41:33.931839Z",
            "url": "https://files.pythonhosted.org/packages/1b/e9/06ca09c29be4061af9dc1f7e3fe975d58ddc4a906219b70fe926bf94b5ad/pygitgrab-0.0.20-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c8a7b289a97b362094816b38ba14b3c8f2e4df4b41bb142ad942cd7a0bce01f",
                "md5": "cb06aba486d8e76b7e47dc8539d45434",
                "sha256": "6773fd17f8371f83fea73a610315cc4852e40a5a4688ddaf7029d2812caf11e7"
            },
            "downloads": -1,
            "filename": "pygitgrab-0.0.20.tar.gz",
            "has_sig": false,
            "md5_digest": "cb06aba486d8e76b7e47dc8539d45434",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 12518,
            "upload_time": "2021-11-08T06:41:35",
            "upload_time_iso_8601": "2021-11-08T06:41:35.723353Z",
            "url": "https://files.pythonhosted.org/packages/0c/8a/7b289a97b362094816b38ba14b3c8f2e4df4b41bb142ad942cd7a0bce01f/pygitgrab-0.0.20.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-11-08 06:41:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "kr-g",
    "github_project": "pygitgrab",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pygitgrab"
}
        
Elapsed time: 0.06695s