Skip to main content

Allow dummies develop Python project like a Pro - Quickly initiate a python project from scratch.

Project description

.. image::

.. image::

.. image::

.. image::

.. image::

.. image::!--None.svg?style=social

Welcome to ``pygitrepo`` Documentation

``pygitrepo`` can quickly initiate a python project from scratch, and you get these development tools ready to use and configured:

- virtual environment management, **up, clean, switch**.
- continues integration for **unit test and code coverage** on your **local machine** and **also cloud**.
- document site management, **write, build, view and deploy**.
- **publish your package to PyPI**, make it installable everywhere.

Quick Links

- .. image::

- .. image::

- .. image::
:target: `install`_

- .. image::

- .. image::

- .. image::

If you initiate your project with ``pygitrepo``, you are with these **powerful tools** out-of-the-box:

- ``make up``: single command to create / clean virtual environment. usually you do::
- ``make reformat``: command to Google stylize your code.
- ``make install``: (For end user) install your package (```` file is out-of-the-box).
- ``make dev_install``: (For package developer) install your package in dev mode (```` file is out-of-the-box).
- ``make test``: unittest with `pytest <>`_ (tests folder and scripts is out-of-the-box, just follow the pattern and create more).
- ``make cov``: code coverage test with `coverage <>`_, the default ``.coveragerc`` fit most of the case).
- ``make tox``: multi python version test with tox, the default ``tox.ini`` fit most of the case.
- built-in integration with
- built-in integration with
- ``make build_doc / view_doc``: easy sphinx document writing, no need to run ``sphinx-quickstart``, and write ```` file.
- ``make deploy_doc``: deploy document to `AWS S3 <>`_.
- ``make publish``: publish your project to `PyPI <>`_

``pygitrepo`` is compatible with Windows / MacOS / Linux, which means you can enjoy same patterns /
commands you use in development everywhere without and file changes.


**Command Line Tool**

1. Install: ``$ pip install pygitrepo``.
2. Run command line tool: ``$ pygitrepo-init``, entry your settings following the instruction.
3. A ``<repo-name>`` directory will be created, you can use this as your github repo directory.
4. Take a look at ``Makefile``, all magic happens here!

**Python Script Initializer**

If you want to programmatically initialize your repository, you can do:

.. code-block:: python

import pygitrepo

package_name = "obama_care" # import obama_care
github_username = "Obama"
supported_py_ver = ["2.7.13", "3.4.6", "3.5.3", "3.6.2"]
author_name = "Obama"
author_email = ""
s3_bucket = "doc-host"
doc_service = "s3" # "none", "rtd", "s3"

if __name__ == "__main__":

All available options and its definition can be found :meth:`~pygitrepo.cli.initiate_project`.

Software Environment You Should Have

For Windows (Git-Bash and MinGW)
Because Windows doesn't have ``shell script`` and ``make`` command, so we have to install some third-party software to make it works.

**Install Git Bash as shell emulator**

1. `Download and install git <>`_.
2. Now you can use ``C:\Program Files\Git\git-bash.exe`` compatible most of the command in MacOS/Linux.

**Install MinGW**

1. `Download and install <>`_, use the installer to install ``MinGW Base``.
2. Find ``C:\MinGW\bin\mingw32-make.exe``, copy and paste and rename as ``C:\MinGW\bin\make.exe``.
3. Add ``C:\MinGW\bin`` to $PATH (environment variable), so ``make`` command is available globally.

Now you can use ``make <target>`` in ``git-bash.exe`` now.

For MacOS (HomeBrew)
You have to make sure:

- `HomeBrew <>`_ is installed.

There's two way of using virtualenv in MacOS:

1. Use generic `virtualenv <>`_.
2. Use `pyenv <>`_ + `pyenv-virtualenv <>`_.

I prefer ``pyenv`` + ``pyenv-virtualenv``, because it allows you:

1. use tox to test against multiple python version locally before using cloud CI (continues integration).
2. will not mess up your global python environment.
3. the ``Makefile`` will do the ``pyenv`` + ``pyenv-virtualenv`` setup for you, just make sure that you have `HomeBrew <>`_ installed.

AWS Command Line (Optional)
Use `AWS S3 <>`_ to host your doc site is a good idea! its cheap, stable, and easy to deploy.

We need `awscli <>`_ to automate the deployment, and you need to create an `IAM user <>`_ and get API credential.

1. Install `awscli <>`_, just ``pip install awscli``.
2. `Configure your API token <>`_, just ``aws configure`` and follow the instruction.

Config PyPI (Optional)
If you want to publish your package to `PyPI <>`_ or `new PyPI <>`_, you need a pypi account and `Configure your credential <>`_.

1. Create a ``${HOME}/.pypirc`` file. ${HOME} is ``C:\Users\<username>`` in Windows and ``/Users/<username>`` in MacOS.
2. put these contents::

index-servers =


3. To publish your library, just ``make publish``.

CI (Continues Integration) (Optional)
1. `Test with travis-ci <>`_, basically you just need to:
- sign in using GitHub account.
- toggle on your repo. just go to **<github_username>/<repo_name>?branch=master** and click **Activate**.
- if it is the first time, you can manually start a first build.

2. `Code Coverage Test with codecov <>`_.
- sign in using GitHub account, that's it! it is automatically on if you have travis-ci.

.. _install:


``pygitrepo`` is released on PyPI, so all you need is:

.. code-block:: console

$ pip install pygitrepo

To upgrade to latest version:

.. code-block:: console

$ pip install --upgrade pygitrepo

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygitrepo-0.0.11.tar.gz (63.3 kB view hashes)

Uploaded Source

Built Distribution

pygitrepo-0.0.11-py2-none-any.whl (85.3 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page