pds-github-util


Namepds-github-util JSON
Version 0.29.0 PyPI version JSON
download
home_pagehttps://github.com/NASA-PDS/pds-github-util
Summaryutil functions for software life cycle enforcement on github
upload_time2023-04-18 20:36:26
maintainer
docs_urlNone
authorthomas loubrieu
requires_python>=3.6
licenseapache-2.0
keywords github action github action snapshot release maven
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PDS Utility Function for GitHub

Enforces the PDS engineering node software lifecycle:
- publish snapshot releases for python (`python-release --snapshot`) or maven  (`maven-release --snapshot`) projects
- create requirements reports (`requirement-report`)
- ping a repository, ie creates an empty commit & push e.g. to trigger github action (`git-ping`)
- create build summaries from .gitmodule file (`summaries`)
  
These routines are called from [GitHub Actions](https://github.com/features/actions).

They are orchestrated around the [pdsen-corral](https://github.com/nasa-pds/pdsen-corral/) repository.

**👉 Note:** You cannot use `pds-github-util`  on `pds-github-util` because it does not follow the PDS standard directory layout with its source code under `src`. Do _not_ try to "Roundup" it or run `python-release` on it.


# Prerequisites

libxml2 is used to do publish a snapshot release of a maven project (`maven-release --snapshot`). It needs to be deployed as described in the following subsections.


## macOS

    brew install libxml2
    cd ./venv/lib/python3.7/site-packages/  # chose the site package of the used python
    ln -s /usr/local/Cellar/libxml2/2.9.10/lib/python3.7/site-packages/* .

## Ubuntu, Debian, Mint, or Similar Linux

    sudo apt-get update && sudo apt-get install libxml2-dev libxslt-dev python-dev
    pip install lxml


# Deployment and Execution

Deploy:

    pip install pds-gihub-util

Some environment variables need to be set (they are defined by default in GitHub Actions but need to be set manually otherwise):

    export GITHUB_WORKSPACE=<where the repository which we want to publish a snapshot is cloned>
    export GITHUB_REPOSITORY=<full name of the repository which we want to publish for example NASA-PDS-Incubator/pds-app-registry>
    

# Usage

Get command arguments for each of the available utilities using `--help` flag. e.g.

    maven-release --help
    python-release --help
    requirement-report --help
    git-ping --help
    summaries --help
    milestones --help


## Milestones

Tool for managing Github milestones.

Example of creating milestones:
- for a single repo
- specified in a config file
- prepended by a number
- first due date is 2021-02-25

For example:

    milestones --create --sprint-name-file conf/milestones_2021.yaml \
               --prepend-number 3 --due-date 2021-02-25 \
               --github-org NASA-PDS --github-repos pds-registry-common

## PDS Issues

Tool for generating simple Markdown issue reports.

⚠️ **Warning:** not well tested beyond this example use case.

Example of generating a report for open [NASA-PDS/validate repo](https://github.com/NASA-PDS/validate) issues:

    pds-issues --github_repos validate --issue_state open

Currently outputs to file: `pdsen_issues.md`.

For the RDD generation for specific repo(s):

    pds-issues --github-repos validate --issue_state closed --format rst --start-time 2020-10-26T00:00:00+00:00

Generates `pdsen_issues.rst`.

or for tickets specifically tagged with the Build label (e.g. B11.1)

    pds-issues  --github-repos validate --issue_state closed --format rst --build B11.1
Generates `pdsen_issues.rst`

For TRR/DDR metrics:

    pds-issues --issue_state closed --format metrics --start-time 2020-04-19T00:00:00+00:00 --end-time 2021-10-31T00:00:00+00:00

Move issues from one obsolete repository to a new one:

     move-issues --source-repo NASA-PDS/api-search-query-lexer --target-repo NASA-PDS/registry-api --label lexer

# SLOC reports

## SLOC updates

This is very manual so far,but the process is:

1. clone the repository, for example:

    cd /path/
    git clone https://github.com/NASA-PDS/registry-api.git

2. Identify the tag range where which you want to report updated SLOC, you can get the versions from the software summaries, see for example [build 13.0 component versions](https://nasa-pds.github.io/releases/13.0/) and [build 12.1 component versions](https://nasa-pds.github.io/releases/12.1/)

As a note you should switch the lower tag patch version to 0 since . build are done during the build period on which we report.

3. launch the report 

    python ./pds_github_util/sloc/repo_sloc.py --repo-path /path/registry-api --tag-range v1.1.10...v1.0.0


# Milestones

**Obsolete** - Sprints are now auto-magically handled by Zenhub

Example of creating milestones:
- for a single repo
- specified in a config file
- prepended by a number
- first due date is 2021-02-25

For example:

        milestones --create --sprint_name_file conf/milestones_2021.yaml \
               --prepend_number 3 --due_date 2021-02-25 \
               --github_org NASA-PDS --github_repos pds-registry-common
                   

To close a milestone and move the open ticket to the next milestone use, for example:

    milestones --github-org NASA-PDS --close --sprint-names 06.Mary.Decker.Slaney

Note that the next milestone is automatically retrieved from the number (here 06) in the prefix. That might not work if the next sprint is not found this way.



# Development
 
    git clone ...
    cd pds-github-util
    python -m venv venv
    source venv/bin/activate
    pip install --editable '.'
    
Update the code.

Test the code:

    export GITHUB_TOKEN=<personal access token for github>
    python setup.py test

Create package and publish it. Set the version in setup.py. Tag the code:

    git tag <version>
    git push origin --tags

The package will be published to pypi automatically though GitHub Action.


## Documentation Generation

To manually create the project documentation:

    pip install sphinx-rtd-theme sphinx-argparse


## Manual Publications

Create the package:

    python setup.py sdist

Publish it as a GitHub release.

Publish on pypi (you need a pypi account):

    pip install twine
    twine upload dist/*

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/NASA-PDS/pds-github-util",
    "name": "pds-github-util",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "github,action,github action,snapshot,release,maven",
    "author": "thomas loubrieu",
    "author_email": "loubrieu@jpl.nasa.gov",
    "download_url": "https://files.pythonhosted.org/packages/27/b6/0af3854c3161c4086c2bb9a77550ee89e63d7f6b1ecfdc255fd4ca221fcd/pds_github_util-0.29.0.tar.gz",
    "platform": null,
    "description": "# PDS Utility Function for GitHub\n\nEnforces the PDS engineering node software lifecycle:\n- publish snapshot releases for python (`python-release --snapshot`) or maven  (`maven-release --snapshot`) projects\n- create requirements reports (`requirement-report`)\n- ping a repository, ie creates an empty commit & push e.g. to trigger github action (`git-ping`)\n- create build summaries from .gitmodule file (`summaries`)\n  \nThese routines are called from [GitHub Actions](https://github.com/features/actions).\n\nThey are orchestrated around the [pdsen-corral](https://github.com/nasa-pds/pdsen-corral/) repository.\n\n**\ud83d\udc49 Note:** You cannot use `pds-github-util`  on `pds-github-util` because it does not follow the PDS standard directory layout with its source code under `src`. Do _not_ try to \"Roundup\" it or run `python-release` on it.\n\n\n# Prerequisites\n\nlibxml2 is used to do publish a snapshot release of a maven project (`maven-release --snapshot`). It needs to be deployed as described in the following subsections.\n\n\n## macOS\n\n    brew install libxml2\n    cd ./venv/lib/python3.7/site-packages/  # chose the site package of the used python\n    ln -s /usr/local/Cellar/libxml2/2.9.10/lib/python3.7/site-packages/* .\n\n## Ubuntu, Debian, Mint, or Similar Linux\n\n    sudo apt-get update && sudo apt-get install libxml2-dev libxslt-dev python-dev\n    pip install lxml\n\n\n# Deployment and Execution\n\nDeploy:\n\n    pip install pds-gihub-util\n\nSome environment variables need to be set (they are defined by default in GitHub Actions but need to be set manually otherwise):\n\n    export GITHUB_WORKSPACE=<where the repository which we want to publish a snapshot is cloned>\n    export GITHUB_REPOSITORY=<full name of the repository which we want to publish for example NASA-PDS-Incubator/pds-app-registry>\n    \n\n# Usage\n\nGet command arguments for each of the available utilities using `--help` flag. e.g.\n\n    maven-release --help\n    python-release --help\n    requirement-report --help\n    git-ping --help\n    summaries --help\n    milestones --help\n\n\n## Milestones\n\nTool for managing Github milestones.\n\nExample of creating milestones:\n- for a single repo\n- specified in a config file\n- prepended by a number\n- first due date is 2021-02-25\n\nFor example:\n\n    milestones --create --sprint-name-file conf/milestones_2021.yaml \\\n               --prepend-number 3 --due-date 2021-02-25 \\\n               --github-org NASA-PDS --github-repos pds-registry-common\n\n## PDS Issues\n\nTool for generating simple Markdown issue reports.\n\n\u26a0\ufe0f **Warning:** not well tested beyond this example use case.\n\nExample of generating a report for open [NASA-PDS/validate repo](https://github.com/NASA-PDS/validate) issues:\n\n    pds-issues --github_repos validate --issue_state open\n\nCurrently outputs to file: `pdsen_issues.md`.\n\nFor the RDD generation for specific repo(s):\n\n    pds-issues --github-repos validate --issue_state closed --format rst --start-time 2020-10-26T00:00:00+00:00\n\nGenerates `pdsen_issues.rst`.\n\nor for tickets specifically tagged with the Build label (e.g. B11.1)\n\n    pds-issues  --github-repos validate --issue_state closed --format rst --build B11.1\nGenerates `pdsen_issues.rst`\n\nFor TRR/DDR metrics:\n\n    pds-issues --issue_state closed --format metrics --start-time 2020-04-19T00:00:00+00:00 --end-time 2021-10-31T00:00:00+00:00\n\nMove issues from one obsolete repository to a new one:\n\n     move-issues --source-repo NASA-PDS/api-search-query-lexer --target-repo NASA-PDS/registry-api --label lexer\n\n# SLOC reports\n\n## SLOC updates\n\nThis is very manual so far,but the process is:\n\n1. clone the repository, for example:\n\n    cd /path/\n    git clone https://github.com/NASA-PDS/registry-api.git\n\n2. Identify the tag range where which you want to report updated SLOC, you can get the versions from the software summaries, see for example [build 13.0 component versions](https://nasa-pds.github.io/releases/13.0/) and [build 12.1 component versions](https://nasa-pds.github.io/releases/12.1/)\n\nAs a note you should switch the lower tag patch version to 0 since . build are done during the build period on which we report.\n\n3. launch the report \n\n    python ./pds_github_util/sloc/repo_sloc.py --repo-path /path/registry-api --tag-range v1.1.10...v1.0.0\n\n\n# Milestones\n\n**Obsolete** - Sprints are now auto-magically handled by Zenhub\n\nExample of creating milestones:\n- for a single repo\n- specified in a config file\n- prepended by a number\n- first due date is 2021-02-25\n\nFor example:\n\n        milestones --create --sprint_name_file conf/milestones_2021.yaml \\\n               --prepend_number 3 --due_date 2021-02-25 \\\n               --github_org NASA-PDS --github_repos pds-registry-common\n                   \n\nTo close a milestone and move the open ticket to the next milestone use, for example:\n\n    milestones --github-org NASA-PDS --close --sprint-names 06.Mary.Decker.Slaney\n\nNote that the next milestone is automatically retrieved from the number (here 06) in the prefix. That might not work if the next sprint is not found this way.\n\n\n\n# Development\n \n    git clone ...\n    cd pds-github-util\n    python -m venv venv\n    source venv/bin/activate\n    pip install --editable '.'\n    \nUpdate the code.\n\nTest the code:\n\n    export GITHUB_TOKEN=<personal access token for github>\n    python setup.py test\n\nCreate package and publish it. Set the version in setup.py. Tag the code:\n\n    git tag <version>\n    git push origin --tags\n\nThe package will be published to pypi automatically though GitHub Action.\n\n\n## Documentation Generation\n\nTo manually create the project documentation:\n\n    pip install sphinx-rtd-theme sphinx-argparse\n\n\n## Manual Publications\n\nCreate the package:\n\n    python setup.py sdist\n\nPublish it as a GitHub release.\n\nPublish on pypi (you need a pypi account):\n\n    pip install twine\n    twine upload dist/*\n",
    "bugtrack_url": null,
    "license": "apache-2.0",
    "summary": "util functions for software life cycle enforcement on github",
    "version": "0.29.0",
    "split_keywords": [
        "github",
        "action",
        "github action",
        "snapshot",
        "release",
        "maven"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "27b60af3854c3161c4086c2bb9a77550ee89e63d7f6b1ecfdc255fd4ca221fcd",
                "md5": "f52fb3fe9c59b269c4fcb093ed9a63fb",
                "sha256": "9ffec50ae0f01f65df8b8123bb42cec9e4d8b857f0d477d916e82439610a767a"
            },
            "downloads": -1,
            "filename": "pds_github_util-0.29.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f52fb3fe9c59b269c4fcb093ed9a63fb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 94940,
            "upload_time": "2023-04-18T20:36:26",
            "upload_time_iso_8601": "2023-04-18T20:36:26.426031Z",
            "url": "https://files.pythonhosted.org/packages/27/b6/0af3854c3161c4086c2bb9a77550ee89e63d7f6b1ecfdc255fd4ca221fcd/pds_github_util-0.29.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-18 20:36:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "NASA-PDS",
    "github_project": "pds-github-util",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pds-github-util"
}
        
Elapsed time: 0.07026s