Generate a 3D Skyline in STL format and a OpenSCAD file from Gitlab contributions

Overview

Your Gitlab's contributions in a 3D Skyline

gitlab-skyline is a Python command to generate a skyline figure from Gitlab contributions as Github did at https://skyline.github.com/

~ usage: gitlab-skyline [-h] [--domain [DOMAIN]] [--max_requests [MAX_REQUESTS]] username [year]

Create STL from Gitlab contributions

positional arguments:
  username              Gitlab username (without @)
  year                  Year of contributions to fetch

optional arguments:
  -h, --help            show this help message and exit
  --domain [DOMAIN]     GitlabEE/CE custom domain
  --max_requests [MAX_REQUESTS]
                        Max. simultaneous requests to Gitlab. Don't mess with their server!

Enjoy!

View a sample result of the preview at samples/gitlab_felixgomez_2020.stl and OpenSCAD generated code at samples/gitlab_felixgomez_2020.scad.

Requirements and installation

gitlab-skyline requires python3 and OpenSCAD. (need Python version >= 3.7)

Create your virtual environment as usual and install dependencies with

pip install -r requirements.txt

Install OpenSCAD from https://www.openscad.org/downloads.html and ensure that openSCAD executable is working with

openscad --version

Quickstart

python gitlab-skyline felixgomez 2020

or

./gitlab-skyline felixgomez 2020

if file has execution permissions.

If you want to get contributions from a custom installation you can use

./gitlab-skyline felixgomez 2020 --domain="https://customdomain.dev:8080"

Docker Usage

For convience, a docker image is produced to generate the stl image file for you:

docker run -v $PWD:/data registry.gitlab.com/felixgomez/gitlab-skyline []

Example: docker run -v $PWD:/data registry.gitlab.com/felixgomez/gitlab-skyline felixgomez

To use any custom parameters, simply append to the docker run command.

Using it in private/custom Gitlab installations

As said before, you can use it in custom installations through the --domain modifier.

Don't forget to make your contributions public in your user profile settings.

Motivation

A few days ago I came across the Github skyline web application and it seemed like a good idea to be able to export the activity in skyline format to STL.

It quickly became viral among my friends, but in my daily work I use Gitlab more. That's when I came up with the idea to replicate it for Gitlab: I needed to have my own contribution skyline!

Some details

The project was developed on a Friday afternoon, although I had consulted some information previously, so do not expect quality code and wonders. As always pull requests are welcome! 😍

At first I was thinking to use the well known Gitlab endpoint https://gitlab.com/users/username/calendar.json but the information it provides is for one year back from now.

As far as I know Gitlab does not provide an endpoint to obtain contribution information by year but digging a bit I found that a call to https://gitlab.com/users/username/calendar_activities?date=2021-02-01 returns an HTML response easy to scrape.

I made use of classic BeautifulSoup for scraping, aiohttp and asyncio to go asynchronous and speed up the scraping process.

There is an extra option (--max-requests) to the gitlab-skyline command to control concurrent requests to Github to avoid the "Too many requests" message from their server.

SolidPython is a beautiful piece of code allowing to generate OpenSCAD code from Python.

Inkscape was used to vectorize the Gitlab logo for extrusion (pending to correct the Viewbox due to lack of time).

Mesh optimization

I love openSCAD for a long time but there are some old well known issues related with errors in the generated geometry. If you detect some on the final STL you could use https://www.meshlab.net/ to correct them.

Thanks!

I hope you like it!

Comments
  • Ask for license

    Ask for license

    Hi~

    Thank you for your great job.

    I maybe kind of use some of your code for my repo, but I notice that your repo doesn't contain License, So I don't know I can use or not.

    Can I know which Open Source License you use.

    Thank you very much.

    opened by yihong0618 2
  • Thank you

    Thank you

    Hi~

    I just wrote a repo that can generate running year data like GitHub or GitLab skyline using some of your code see: https://github.com/yihong0618/running_skyline

    And I learned a lot from your repo, want to say thank you very much~

    opened by yihong0618 1
  • RuntimeError: Event loop is closed

    RuntimeError: Event loop is closed

    image

    Error:

    Traceback (most recent call last):
      File "gitlab-skyline", line 190, in <module>
        main()
      File "gitlab-skyline", line 186, in main
        generate_skyline_stl(username, year, contribution_matrix)
      File "gitlab-skyline", line 57, in generate_skyline_stl
        year_contribution_list, max_contributions_by_day = parse_contribution_matrix(contribution_matrix)
      File "gitlab-skyline", line 45, in parse_contribution_matrix
        np_contribution_matrix.view('i8,i8,i8').sort(order=['f0'], axis=0)
    ValueError: When changing to a larger dtype, its size must be a divisor of the total size in bytes of the last axis of the array.
    Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001DB9823B670>
    Traceback (most recent call last):
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 116, in __del__
        self.close()
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 108, in close
        self._loop.call_soon(self._call_connection_lost, None)
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 719, in call_soon
        self._check_closed()
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 508, in _check_closed
        raise RuntimeError('Event loop is closed')
    RuntimeError: Event loop is closed
    
    good first issue first 
    opened by nehal076 1
  • Run with Docker instead of installing packages

    Run with Docker instead of installing packages

    Using with docker is a cleaner and more concise way to distribute the code. I've built a docker file and published to gitlab - there's. PR there but you've not see it.

    The docker image would be private (I think) to any logged in user. But we can publish it to dockerhub too which is open

    Testing: CI is green on GitLab Tested running locally on my Mac

    opened by martynbristow 0
  • Error: coroutine 'get_contributions' was never awaited

    Error: coroutine 'get_contributions' was never awaited

    When I try to create a skyline from a privat gitlab instance using docker, I get an error about coroutine 'get_contributions' was never awaited

    docker run -v $PWD:/data gitlab-skyline --token ***[redacted]*** --domain ***[redacted]*** manuel.schiller 2022
    /app/gitlab-skyline:186: DeprecationWarning: There is no current event loop
      loop = asyncio.get_event_loop()
    Fetching contributions from Gitlab...
    Traceback (most recent call last):
      File "/app/gitlab-skyline", line 198, in <module>
        main()
      File "/app/gitlab-skyline", line 187, in main
        loop.run_until_complete(
      File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/usr/local/lib/python3.11/asyncio/tasks.py", line 415, in wait
        raise TypeError("Passing coroutines is forbidden, use tasks explicitly.")
    TypeError: Passing coroutines is forbidden, use tasks explicitly.
    sys:1: RuntimeWarning: coroutine 'get_contributions' was never awaited
    
    opened by manuschillerdev 0
  • FileNotFoundError

    FileNotFoundError

    Hello! I'm running the program on Windows 7 with Python 3.7.9 and got an error attempting the sample quick start command

    python gitlab-skyline felixgomez 2020

    Fetching contributions from Gitlab...
    Generating STL...
    Traceback (most recent call last):
      File "gitlab-skyline", line 198, in <module>
        main()
      File "gitlab-skyline", line 194, in main
        generate_skyline_stl(username, year, contribution_matrix)
      File "gitlab-skyline", line 153, in generate_skyline_stl
        capture_output=True)
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 488, in run
        with Popen(*popenargs, **kwargs) as process:
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1207, in _execute_child
        startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    

    I see that line 153 in generate_skyline_stl is the subprocess run for openSCAD, I checked that I have openSCAD installed and the path added to my system env variables. Any chance someone could give insight on if openSCAD is installed incorrectly or if it's looking for files that weren't generated properly?

    opened by pham-andrew 0
Owner
Félix Gómez
Senior developer at @ultreia_es Degree in Physics.
Félix Gómez
Visualize the training curve from the *.csv file (tensorboard format).

Training-Curve-Vis Visualize the training curve from the *.csv file (tensorboard format). Feature Custom labels Curve smoothing Support for multiple c

Luckky 7 Feb 23, 2022
Generate graphs with NetworkX, natively visualize with D3.js and pywebview

webview_d3 This is some PoC code to render graphs created with NetworkX natively using D3.js and pywebview. The main benifit of this approac

byt3bl33d3r 68 Aug 18, 2022
Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordcloud packages

Wikipedia WordCloud App Wikipedia WordCloud App generate Wikipedia word cloud art created using python's streamlit, matplotlib, wikipedia and wordclou

Siva Prakash 5 Jan 2, 2022
Generate visualizations of GitHub user and repository statistics using GitHub Actions.

GitHub Stats Visualization Generate visualizations of GitHub user and repository statistics using GitHub Actions. This project is currently a work-in-

JoelImgu 3 Dec 14, 2022
Generate visualizations of GitHub user and repository statistics using GitHub Actions.

GitHub Stats Visualization Generate visualizations of GitHub user and repository statistics using GitHub Actions. This project is currently a work-in-

Aditya Thakekar 1 Jan 11, 2022
Python script to generate a visualization of various sorting algorithms, image or video.

sorting_algo_visualizer Python script to generate a visualization of various sorting algorithms, image or video.

null 146 Nov 12, 2022
Generate a roam research like Network Graph view from your Notion pages.

Notion Graph View Export Notion pages to a Roam Research like graph view.

Steve Sun 214 Jan 7, 2023
BGraph is a tool designed to generate dependencies graphs from Android.bp soong files.

BGraph BGraph is a tool designed to generate dependencies graphs from Android.bp soong files. Overview BGraph (for Build-Graphs) is a project aimed at

Quarkslab 10 Dec 19, 2022
script to generate HeN ipfs app exports of GLSL shaders

HeNerator A simple script to generate HeN ipfs app exports from any frag shader created with: GlslViewer GlslEditor The Book of Shaders glslCanvas VS

Patricio Gonzalez Vivo 22 Dec 21, 2022
A script written in Python that generate output custom color (HEX or RGB input to x1b hexadecimal)

ColorShell ─ 1.5 Planned for v2: setup.sh for setup alias This script converts HEX and RGB code to x1b x1b is code for colorize outputs, works on ou

Riley 4 Oct 31, 2021
Generate the report for OCULTest.

Sample report generated in this function Usage example from utils.gen_report import generate_report if __name__ == '__main__': # def generate_rep

Philip Guo 1 Mar 10, 2022
Generate knowledge graphs with interesting geometries, like lattices

Geometric Graphs Generate knowledge graphs with interesting geometries, like lattices. Works on Python 3.9+ because it uses cool new features. Get out

Charles Tapley Hoyt 5 Jan 3, 2022
Because trello only have payed options to generate a RunUp chart, this solves that!

Trello Runup Chart Generator The basic concept of the project is that Corello is pay-to-use and want to use Trello To-Do/Doing/Done automation with gi

Rômulo Schiavon 1 Dec 21, 2021
Generate "Jupiter" plots for circular genomes

jupiter Generate "Jupiter" plots for circular genomes Description Python scripts to generate plots from ViennaRNA output. Written in "pidgin" python w

Robert Edgar 2 Nov 29, 2021
🐞 📊 Ladybug extension to generate 2D charts

ladybug-charts Ladybug extension to generate 2D charts. Installation pip install ladybug-charts QuickStart import ladybug_charts API Documentation Loc

Ladybug Tools 3 Dec 30, 2022
A toolkit to generate MR sequence diagrams

mrsd: a toolkit to generate MR sequence diagrams mrsd is a Python toolkit to generate MR sequence diagrams, as shown below for the basic FLASH sequenc

Julien Lamy 3 Dec 25, 2021
Generate SVG (dark/light) images visualizing (private/public) GitHub repo statistics for profile/website.

Generate daily updated visualizations of GitHub user and repository statistics from the GitHub API using GitHub Actions for any combination of private and public repositories, whether owned or contributed to - no server required.

Adam Ross 2 Dec 16, 2022
Automatically generate GitHub activity!

Commit Bot Automatically generate GitHub activity! We've all wanted to be the developer that commits every day, but that requires a lot of work. Let's

Ricky 4 Jun 7, 2022
A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe which runs both payloads.

Update ! ANONFILE MIGHT NOT WORK ! About A Python Binder that merge 2 files with any extension by creating a new python file and compiling it to exe w

Vesper 15 Oct 12, 2022