workspace-tools


Nameworkspace-tools JSON
Version 3.4.2 PyPI version JSON
download
home_pagehttps://github.com/maxzheng/workspace-tools
SummaryConvenience wrapper for git/tox to simplify local development
upload_time2023-09-26 01:20:51
maintainer
docs_urlNone
authorMax Zheng
requires_python>=3.6
licenseMIT
keywords workspace multiple repositories git tox wrapper development tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            workspace-tools
===============

Tools to simplify working with multiple Python repositories by seamlessly integrating git and tox,
where you can simply run one command instead of many native commands individually to do common tasks.

It is mostly a wrapper on top of existing tools with the end goal of providing a simple, seamless,
and less repetive experience when working with one or more repositories. Feature support is mostly
limited to what the author uses as, currently, it is foremost a personal tool to enhance the
author's own productivity, but sharing it as others might find it useful.


Overview
========

* One tool to seamlessly manage / integrate all workspace tools, from setup to publish.
* Simplified command execution for common workflow - just run one command, instead of many individual native ones.
* Command execution is also smart / optimized - e.g. test command auto detects requirement changes to redevelop.
* Path aware context commands that run across all checkouts - e.g. see status / diff for all repos.
* Get the most out of other products by easily updating your dependencies to the latest
* Templates included to setup new product quickly
* Support for multiple branches with child/parent relationship.
* Cool and sensible shortcut aliases to help you do more by typing less - you will love "tv" [if you know ag]!


Quick Start Tutorial
====================

First, install it with::

    sudo pip3 install autopip
    app install workspace-tools

Second, optionally setup environment with bash functions/aliases:

.. code-block:: console

    $ cd ~/workspace

    $ wst setup --commands-with-aliases

    [INFO] Added "ws" bash function with workspace directory set to ~/workspace
    [INFO] Added bash functions: bump, checkout, clean, commit, log, publish, push, status, test, update
    [INFO] Added aliases: co=checkout, ci=commit, di=diff, st=status, up=update
    [INFO] Added special aliases: a='activate', d='deactivate',
           tv='open_files_from_last_command'  # from ag/ack/grep/find/which [t]o [v]im
    [INFO] To use, run "source ~/.wstrc" or open a new shell.

    $ source ~/.wstrc

Then witness the awesome power of workspace-tools:

.. code-block:: console

    $ ws
    # Runs `cd ~/workspace && ls`
    aiohttp-requests               localconfig              python-examples
    ansible-hostmanager            pytest-fixtures          utils-core
    ...

    $ cd localconfig
    # Use your favorite editor to make some changes

    $ ci -tp 'This adds/commits all files, runs style check/tests with coverage, and then pushes to all remotes!'
    Checking style
    Running tests
    ...........................
    ----------- coverage: platform linux, python 3.6.5-final-0 -----------
    Name                      Stmts   Miss  Cover
    ---------------------------------------------
    localconfig/__init__.py       2      0   100%
    localconfig/manager.py      215     14    93%
    localconfig/utils.py         20      0   100%
    ---------------------------------------------
    TOTAL                       237     14    94%
    Required test coverage of 80% reached. Total coverage: 81.90%
    ==================  22 passed in 0.82 seconds  =======================
    cover: OK
    style: OK
    [master d5f6e6b] This adds/commits all files, runs style check/tests with coverage, ...
     1 file changed, 78 insertions(+), 38 deletions(-)
    Pushing master

The remaining tutorial will assume `wst setup -a` was not run for the sake of clarity, though setup is
recommended as there are many useful aliases provided.

To checkout a repo:

.. code-block:: console

    $ wst checkout maxzheng/workspace-tools       # Exact match from Github
    $ wst checkout requests                       # Best match from Github
    $ wst checkout https://github.com/maxzheng/aiohttp-requests.git

To update all repos in your workspace concurrently:

.. code-block:: console

    $ wst update

    Updating aiohttp-requests
    Updating ansible-hostmanager
    ...

Make a commit and create a new branch for it:

.. code-block:: console

    $ cd workspace-tools
    # vi README.rst and make some changes

    $ wst commit "Updated README.rst"

    [updated-readme@master 0af8850] Updated README.rst
     1 file changed, 1 deletion(-)

    # The commit created the branch 'updated-readme@master', added all files, and then committed change.
    # Notice the "@master" that indicates the parent branch. The parent branch will be used
    # during push with --merge and when updating the branch (updates parent and rebases branch on top).
    # To create a branch without parent relationship, use --branch option with any name that you like.

To install your test environment and run all tests (via tox/pytest):

.. code-block:: console

    $ wst test
    ...
    cover: OK
    style: OK

    # To setup a new project with tox test, cover, and style environments:
    $ cd new-product
    $ wst setup --product

    # To check style or generate coverage report:
    $ wst test style
    $ wst test cover

    # To run a specific test only:
    $ wst test -k test_filter

To see status for a single repo or all of your repos:

.. code-block:: console

    $ wst status
    # Branches: updated-readme@master master

    $ cd ..

    $ wst status

    [ bumper-lib ]
    On branch master
    Your branch is up-to-date with 'origin/master'.
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)

            modified:   src/bumper/cars.py

    no changes added to commit (use "git add" and/or "git commit -a")

    [ clicast ]
    # Branches: master display-changes@master fix-download@master

    [ workspace-tools ]
    # Branches: updated-readme@master master


To amend a change and push:

.. code-block:: console

    $ cd workspace-tools
    # vi README.rst and make more changes

    $ wst commit --amend --push

    [updated-readme@master 738f659] Updated README.rst
    1 file changed, 2 insertions(+), 1 deletion(-)
    Pushing updated-readme@master

    # It will fail at push as you are not a committer, but the change was committed to branch,
    # and then merged into its parent branch (master).

Or simply push the change in your current branch:

.. code-block:: console

    $ wst push --merge

    # This will update its parent branch (master), rebase branch with parent branch and merge into
    # parent branch if on child branch (child@parent) and then push.
    # Upon success, it will remove the local and remote branch if pushing from child branch.

If you have multiple upstream branches (defined by merge config in ~/.config/workspace.cfg) that you need to merge
your change into, use auto merge:

.. code-block:: console

    # Assuming you are currently on 3.2.x branch and have these branches: 3.3.x, master
    $ wst merge --all

    [INFO] Merging 3.2.x into 3.3.x
    [INFO] Pushing 3.3.x
    [INFO] Merging 3.3.x into master
    [INFO] Pushing master

If you have pinned your dependency requirements and want to update to latest version:

.. code-block:: console

    $ wst bump

    [INFO] Updating workspace-tools
    [INFO] Checking bumper-lib
    ...
    [INFO] Checking requests
    [bump ac06160] Require remoteconfig==0.2.4, requests==2.6.0
     1 file changed, 2 insertions(+), 2 deletions(-)

    # To bump to a specific version (why not just vi? This validates the version for you and pulls in the changelog)
    $ wst bump requests==2.5.1

To bump version, update changelog, and release to PyPI:

.. code-block:: console

    $ publish
    PyPI Password:
    Updating master
    Building source/built distribution
    Uploading to PyPI
    [master a58b001] Publish version 1.0.7
     2 files changed, 8 insertions(+), 2 deletions(-)
    Pushing master

Now you are ready to try out the other commands yourself:

.. code-block:: console

    $ wst -h

    usage: wst [-h] [-v] [--debug] <sub-command> ...

    optional arguments:

      -h, --help            show this help message and exit
      -v, --version         show program's version number and exit
      --debug               Turn on debug mode

    sub-commands:
      {bump,checkout,co,clean,commit,ci,diff,di,log,publish,push,setup,status,st,test,update,up}
                            List of sub-commands
        bump                Bump dependency versions in requirements.txt,
                            pinned.txt, or any specified file.
        checkout (co)       Checkout products (repo urls) or revert files.
        clean               Clean workspace by removing build, dist, and .pyc
                            files
        commit (ci)         Commit all changes locally, including new files.
        diff (di)           Show diff on current product or all products in
                            workspace
        log                 Show commit logs
        merge               Merge changes from branch to current branch
        publish             Bumps version in setup.py (defaults to patch), writes
                            out changelog, builds a source distribution, and
                            uploads with twine.
        push                Push changes for branch
        setup               Optional (refer to setup --help). Setup workspace
                            environment. Run from primary workspace directory.
        status (st)         Show status on current product or all products in
                            workspace
        test                Run tests and manage test environments for product.
        update (up)         Update current product or all products in workspace

To configure wst, refer to Configuration_ doc.


Links & Contact Info
====================

| Documentation: http://workspace-tools.readthedocs.org
|
| PyPI Package: https://pypi.python.org/pypi/workspace-tools
| GitHub Source: https://github.com/maxzheng/workspace-tools
| Report Issues/Bugs: https://github.com/maxzheng/workspace-tools/issues
|
| Follow: https://twitter.com/MaxZhengX
| Connect: https://www.linkedin.com/in/maxzheng
| Contact: maxzheng.os @t gmail.com

.. _Configuration: http://workspace-tools.readthedocs.org/en/latest/api/config.html

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/maxzheng/workspace-tools",
    "name": "workspace-tools",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "workspace multiple repositories git tox wrapper development tools",
    "author": "Max Zheng",
    "author_email": "maxzheng.os@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bd/9f/8bd9288347da8f5c67b4d21de06017c6e1234a54beeb0b3fa3972fc0e6f4/workspace-tools-3.4.2.tar.gz",
    "platform": null,
    "description": "workspace-tools\n===============\n\nTools to simplify working with multiple Python repositories by seamlessly integrating git and tox,\nwhere you can simply run one command instead of many native commands individually to do common tasks.\n\nIt is mostly a wrapper on top of existing tools with the end goal of providing a simple, seamless,\nand less repetive experience when working with one or more repositories. Feature support is mostly\nlimited to what the author uses as, currently, it is foremost a personal tool to enhance the\nauthor's own productivity, but sharing it as others might find it useful.\n\n\nOverview\n========\n\n* One tool to seamlessly manage / integrate all workspace tools, from setup to publish.\n* Simplified command execution for common workflow - just run one command, instead of many individual native ones.\n* Command execution is also smart / optimized - e.g. test command auto detects requirement changes to redevelop.\n* Path aware context commands that run across all checkouts - e.g. see status / diff for all repos.\n* Get the most out of other products by easily updating your dependencies to the latest\n* Templates included to setup new product quickly\n* Support for multiple branches with child/parent relationship.\n* Cool and sensible shortcut aliases to help you do more by typing less - you will love \"tv\" [if you know ag]!\n\n\nQuick Start Tutorial\n====================\n\nFirst, install it with::\n\n    sudo pip3 install autopip\n    app install workspace-tools\n\nSecond, optionally setup environment with bash functions/aliases:\n\n.. code-block:: console\n\n    $ cd ~/workspace\n\n    $ wst setup --commands-with-aliases\n\n    [INFO] Added \"ws\" bash function with workspace directory set to ~/workspace\n    [INFO] Added bash functions: bump, checkout, clean, commit, log, publish, push, status, test, update\n    [INFO] Added aliases: co=checkout, ci=commit, di=diff, st=status, up=update\n    [INFO] Added special aliases: a='activate', d='deactivate',\n           tv='open_files_from_last_command'  # from ag/ack/grep/find/which [t]o [v]im\n    [INFO] To use, run \"source ~/.wstrc\" or open a new shell.\n\n    $ source ~/.wstrc\n\nThen witness the awesome power of workspace-tools:\n\n.. code-block:: console\n\n    $ ws\n    # Runs `cd ~/workspace && ls`\n    aiohttp-requests               localconfig              python-examples\n    ansible-hostmanager            pytest-fixtures          utils-core\n    ...\n\n    $ cd localconfig\n    # Use your favorite editor to make some changes\n\n    $ ci -tp 'This adds/commits all files, runs style check/tests with coverage, and then pushes to all remotes!'\n    Checking style\n    Running tests\n    ...........................\n    ----------- coverage: platform linux, python 3.6.5-final-0 -----------\n    Name                      Stmts   Miss  Cover\n    ---------------------------------------------\n    localconfig/__init__.py       2      0   100%\n    localconfig/manager.py      215     14    93%\n    localconfig/utils.py         20      0   100%\n    ---------------------------------------------\n    TOTAL                       237     14    94%\n    Required test coverage of 80% reached. Total coverage: 81.90%\n    ==================  22 passed in 0.82 seconds  =======================\n    cover: OK\n    style: OK\n    [master d5f6e6b] This adds/commits all files, runs style check/tests with coverage, ...\n     1 file changed, 78 insertions(+), 38 deletions(-)\n    Pushing master\n\nThe remaining tutorial will assume `wst setup -a` was not run for the sake of clarity, though setup is\nrecommended as there are many useful aliases provided.\n\nTo checkout a repo:\n\n.. code-block:: console\n\n    $ wst checkout maxzheng/workspace-tools       # Exact match from Github\n    $ wst checkout requests                       # Best match from Github\n    $ wst checkout https://github.com/maxzheng/aiohttp-requests.git\n\nTo update all repos in your workspace concurrently:\n\n.. code-block:: console\n\n    $ wst update\n\n    Updating aiohttp-requests\n    Updating ansible-hostmanager\n    ...\n\nMake a commit and create a new branch for it:\n\n.. code-block:: console\n\n    $ cd workspace-tools\n    # vi README.rst and make some changes\n\n    $ wst commit \"Updated README.rst\"\n\n    [updated-readme@master 0af8850] Updated README.rst\n     1 file changed, 1 deletion(-)\n\n    # The commit created the branch 'updated-readme@master', added all files, and then committed change.\n    # Notice the \"@master\" that indicates the parent branch. The parent branch will be used\n    # during push with --merge and when updating the branch (updates parent and rebases branch on top).\n    # To create a branch without parent relationship, use --branch option with any name that you like.\n\nTo install your test environment and run all tests (via tox/pytest):\n\n.. code-block:: console\n\n    $ wst test\n    ...\n    cover: OK\n    style: OK\n\n    # To setup a new project with tox test, cover, and style environments:\n    $ cd new-product\n    $ wst setup --product\n\n    # To check style or generate coverage report:\n    $ wst test style\n    $ wst test cover\n\n    # To run a specific test only:\n    $ wst test -k test_filter\n\nTo see status for a single repo or all of your repos:\n\n.. code-block:: console\n\n    $ wst status\n    # Branches: updated-readme@master master\n\n    $ cd ..\n\n    $ wst status\n\n    [ bumper-lib ]\n    On branch master\n    Your branch is up-to-date with 'origin/master'.\n    Changes not staged for commit:\n      (use \"git add <file>...\" to update what will be committed)\n      (use \"git checkout -- <file>...\" to discard changes in working directory)\n\n            modified:   src/bumper/cars.py\n\n    no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\n    [ clicast ]\n    # Branches: master display-changes@master fix-download@master\n\n    [ workspace-tools ]\n    # Branches: updated-readme@master master\n\n\nTo amend a change and push:\n\n.. code-block:: console\n\n    $ cd workspace-tools\n    # vi README.rst and make more changes\n\n    $ wst commit --amend --push\n\n    [updated-readme@master 738f659] Updated README.rst\n    1 file changed, 2 insertions(+), 1 deletion(-)\n    Pushing updated-readme@master\n\n    # It will fail at push as you are not a committer, but the change was committed to branch,\n    # and then merged into its parent branch (master).\n\nOr simply push the change in your current branch:\n\n.. code-block:: console\n\n    $ wst push --merge\n\n    # This will update its parent branch (master), rebase branch with parent branch and merge into\n    # parent branch if on child branch (child@parent) and then push.\n    # Upon success, it will remove the local and remote branch if pushing from child branch.\n\nIf you have multiple upstream branches (defined by merge config in ~/.config/workspace.cfg) that you need to merge\nyour change into, use auto merge:\n\n.. code-block:: console\n\n    # Assuming you are currently on 3.2.x branch and have these branches: 3.3.x, master\n    $ wst merge --all\n\n    [INFO] Merging 3.2.x into 3.3.x\n    [INFO] Pushing 3.3.x\n    [INFO] Merging 3.3.x into master\n    [INFO] Pushing master\n\nIf you have pinned your dependency requirements and want to update to latest version:\n\n.. code-block:: console\n\n    $ wst bump\n\n    [INFO] Updating workspace-tools\n    [INFO] Checking bumper-lib\n    ...\n    [INFO] Checking requests\n    [bump ac06160] Require remoteconfig==0.2.4, requests==2.6.0\n     1 file changed, 2 insertions(+), 2 deletions(-)\n\n    # To bump to a specific version (why not just vi? This validates the version for you and pulls in the changelog)\n    $ wst bump requests==2.5.1\n\nTo bump version, update changelog, and release to PyPI:\n\n.. code-block:: console\n\n    $ publish\n    PyPI Password:\n    Updating master\n    Building source/built distribution\n    Uploading to PyPI\n    [master a58b001] Publish version 1.0.7\n     2 files changed, 8 insertions(+), 2 deletions(-)\n    Pushing master\n\nNow you are ready to try out the other commands yourself:\n\n.. code-block:: console\n\n    $ wst -h\n\n    usage: wst [-h] [-v] [--debug] <sub-command> ...\n\n    optional arguments:\n\n      -h, --help            show this help message and exit\n      -v, --version         show program's version number and exit\n      --debug               Turn on debug mode\n\n    sub-commands:\n      {bump,checkout,co,clean,commit,ci,diff,di,log,publish,push,setup,status,st,test,update,up}\n                            List of sub-commands\n        bump                Bump dependency versions in requirements.txt,\n                            pinned.txt, or any specified file.\n        checkout (co)       Checkout products (repo urls) or revert files.\n        clean               Clean workspace by removing build, dist, and .pyc\n                            files\n        commit (ci)         Commit all changes locally, including new files.\n        diff (di)           Show diff on current product or all products in\n                            workspace\n        log                 Show commit logs\n        merge               Merge changes from branch to current branch\n        publish             Bumps version in setup.py (defaults to patch), writes\n                            out changelog, builds a source distribution, and\n                            uploads with twine.\n        push                Push changes for branch\n        setup               Optional (refer to setup --help). Setup workspace\n                            environment. Run from primary workspace directory.\n        status (st)         Show status on current product or all products in\n                            workspace\n        test                Run tests and manage test environments for product.\n        update (up)         Update current product or all products in workspace\n\nTo configure wst, refer to Configuration_ doc.\n\n\nLinks & Contact Info\n====================\n\n| Documentation: http://workspace-tools.readthedocs.org\n|\n| PyPI Package: https://pypi.python.org/pypi/workspace-tools\n| GitHub Source: https://github.com/maxzheng/workspace-tools\n| Report Issues/Bugs: https://github.com/maxzheng/workspace-tools/issues\n|\n| Follow: https://twitter.com/MaxZhengX\n| Connect: https://www.linkedin.com/in/maxzheng\n| Contact: maxzheng.os @t gmail.com\n\n.. _Configuration: http://workspace-tools.readthedocs.org/en/latest/api/config.html\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convenience wrapper for git/tox to simplify local development",
    "version": "3.4.2",
    "project_urls": {
        "Homepage": "https://github.com/maxzheng/workspace-tools"
    },
    "split_keywords": [
        "workspace",
        "multiple",
        "repositories",
        "git",
        "tox",
        "wrapper",
        "development",
        "tools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11e7e414ffe7a14599abfcb389f11b97765dae73fd88ffbfc9373f95f44405ba",
                "md5": "4d2b1e6b2d35f4b7d3c8d08745a3df13",
                "sha256": "996e9a4db4eb7951a18579b1986498e04c85be10e77d7bba4e35a3261c39db54"
            },
            "downloads": -1,
            "filename": "workspace_tools-3.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4d2b1e6b2d35f4b7d3c8d08745a3df13",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 47621,
            "upload_time": "2023-09-26T01:20:49",
            "upload_time_iso_8601": "2023-09-26T01:20:49.286266Z",
            "url": "https://files.pythonhosted.org/packages/11/e7/e414ffe7a14599abfcb389f11b97765dae73fd88ffbfc9373f95f44405ba/workspace_tools-3.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd9f8bd9288347da8f5c67b4d21de06017c6e1234a54beeb0b3fa3972fc0e6f4",
                "md5": "8783c073900340246252aa827ae16aa9",
                "sha256": "13eeafcc5e3d05890c9716bf40f259bc19ac111e4fd9750bdebb43142e75d47e"
            },
            "downloads": -1,
            "filename": "workspace-tools-3.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8783c073900340246252aa827ae16aa9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 65292,
            "upload_time": "2023-09-26T01:20:51",
            "upload_time_iso_8601": "2023-09-26T01:20:51.213753Z",
            "url": "https://files.pythonhosted.org/packages/bd/9f/8bd9288347da8f5c67b4d21de06017c6e1234a54beeb0b3fa3972fc0e6f4/workspace-tools-3.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-26 01:20:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "maxzheng",
    "github_project": "workspace-tools",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "workspace-tools"
}
        
Elapsed time: 0.18593s