Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
justgigio committed Nov 8, 2023
1 parent d5ce557 commit cc69682
Show file tree
Hide file tree
Showing 8 changed files with 201 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "2"

build:
os: "ubuntu-22.04"
tools:
python: "3.10"

python:
install:
- requirements: docs/requirements.txt

sphinx:
configuration: docs/source/conf.py
74 changes: 73 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,76 @@
- python version badge
- docs badge
# awesome-git-mosaic
A simple tool to make cool tricks with your GitHub activity mosaic
A simple tool to make cool tricks with your Github activity mosaic

# Install
Just create a new repo on Github and install like any python lib

`pip install awesome-git-mosaic`

or

`poetry add awesome-git-mosaic`

# Usage

It comes ready to be used out of the box with dafault settings or you can use its full functionalities by importing on code

> **Warning**\
> It is recommended to create an empty repo for this purpose only. A lot of files will be created and so a lot of commits (which can be problematic to revert in a working repo). See [Reseting](#reseting).
## Default
After installation, you can use with default parameter by running

`python -m awesome_git_mosaic <your_text_here[A-Za-z0-9# ]+>`

> **Note**\
> With default params, each character have 5 squares wide plus 1 square of space between letters. So, only 8 characters will appear at time.
## Importing on console (or anywhere)

```python
from awesome_git_mosaic.usecases.write_mosaic import WriteMosaic

wm = WriteMosaic()

wm.write('numenor', 50, 2, True, False, True)
```
Method signature:

```python
def write(
self,
message: str, # what you want to write
strength: int = 15, # how many commits each pixel will have (more details in "How it works" section)
multiply: int = 1, # number of times to write the message consecutive like "MSGMSGMSG" (more details in "How it works" section)
with_spaces: bool = True, # put or not spaces between characters
background: bool = False, # put background or not
inverted: bool = False, # invert pixels or not
):
```
# How it works
Git allow us to [set the date and time](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---dateltdategt) of a commit, so, we can do it in retrspective or even in the future.

By understanding how Github activity mosaic works, we can figure out wich time correlates to each pixel and translate a matrix of pixels in a list of datetimes. So, for each datetime a commit is made modifying or create an unique file.

Days with more contribution have a lighter green and the light intensity will be dynamic according to the day you have more contributions in the period of time showing in the mosaic. So, to have a good highlighted message, it is recommended to set `strength` at least as two times the number of max contributions you have in the period.

Each week the leftmost column will disappear. So to make the mosaic looks like a veeeery slow scrolling text, you can set `multiply` to more than `1`.

> **Warning**\
> Commits and pushes are made automatically by the code. It is HIGHLY RECOMMENDED to create a repo specially for this purpose.
## Reseting
You can easily remove everything by deleting the repo where you made the commits.

# About
After watch [this video](https://www.youtube.com/watch?app=desktop&v=2q--gA97caM) from [@akshaymarch7](https://github.com/akshaymarch7) i´ve just had an ideia to play around with the pixels instead of just make it random.

So, why not draw or write something? A few days later and i had a working prototype. Now it is a lib for anyone who want to have fun or contribute with more ideas.

If you enjoyed enough, consider

[![buy me a coffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/justgigio)

# Contributing
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2 changes: 2 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sphinx==7.1.2
sphinx-rtd-theme==1.3.0rc1
7 changes: 7 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API
===

.. autosummary::
:toctree: generated

awesome-git-mosaic
35 changes: 35 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Configuration file for the Sphinx documentation builder.

# -- Project information

project = 'Awesome Git Mosaic'
copyright = '2023, Giovane Costa'
author = 'Giovane Costa'

release = '0.0'
version = '0.0.2'

# -- General configuration

extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
]

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
}
intersphinx_disabled_domains = ['std']

templates_path = ['_templates']

# -- Options for HTML output

html_theme = 'sphinx_rtd_theme'

# -- Options for EPUB output
epub_show_urls = 'footnote'
19 changes: 19 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Welcome to Awesome Git Mosaic's documentation!
===================================

**Awesome Git Mosaic** is simple tool to make cool tricks with your Github activity mosaic

Check out the :doc:`usage` section for further information, including
how to :ref:`installation` the project.

.. note::

This project is under active development.

Contents
--------

.. toctree::

usage
api
32 changes: 32 additions & 0 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Usage
=====

.. _installation:

Installation
------------

Just create a new repo on Github and install like any python lib:

.. code-block:: console
(.venv) $ pip install awesome-git-mosaic
Default usage
-------------

After installation, you can use with default parameter by running:

.. code-block:: console
(.venv) $ python -m awesome_git_mosaic <your_text_here[A-Za-z0-9# ]+>
Importing on console (or anywhere)
----------------------------------

.. autofunction:: awesome_git_mosaic.usecases.write_mosaic.WriteMosaic.write

>>> from awesome_git_mosaic.usecases.write_mosaic import WriteMosaic
>>> wm = WriteMosaic()
>>> wm.write('numenor', 50, 2, True, False, True)

0 comments on commit cc69682

Please sign in to comment.