Skip to main content

A CLI tool for generating a GitHub profile README using the Jinja2 template engine.

Project description

profile-readme

Build Status Documentation Status

A CLI tool for generating a GitHub profile README using the Jinja2 template engine.

It lets you use all features provide by Jinja2 to help you customize your GitHub profile README and it provides data from the GitHub API to your template.

Read the documentation on https://profile-readme.rtfd.io/.

Installation

Use the following command to install profile-readme:

$ python3 -m pip install profile-readme

Living on the edge

If you want to work with the latest code before it’s released, install or update the code from the master branch:

$ python3 -m pip install -U git+https://github.com/Robert-96/profile-readme.git

Quickstart

Use the init command to generate a new project with an example template:

$ profile-readme init

Use the render command to update your README.md file:

$ profile-readme render

Advanced Usage

Using Custom Build Scripts

The command line shortcut is convenient, but sometimes your project needs something different than the defaults. To change them, you can use a build script.

A minimal build script looks something like this:

from profile_readme import get_github_context, ProfileGenerator


context = {}

# If you don't need the GitHub data you can remove the next line
context.update(**get_github_context('octocat'))


if __name__ == "__main__":
    ProfileGenerator.render(
        template_path="README-TEMPLATE.md",
        output_path="README.md",
        context=context
    )

Finally, just save the script as build.py (or something similar) and run it with your Python interpreter.

$ python build.py

Note: Don't forgot to also update .github/workflows/readme.yml. Replace python3 -m profile_readme render with python3 build.py.

Loading Data

The simplest way to supply data to the template is to pass ProfileGenerator.render a mapping from variable names to their values (a “context”) as the context keyword argument.

from profile_readme import get_github_context, ProfileGenerator


context = {
    greeting='Hello, world!'
}

# If you don't need the GitHub data you can remove the next line
context.update(**get_github_context('octocat'))


if __name__ == "__main__":
    ProfileGenerator.render(
        template_path="README-TEMPLATE.md",
        output_path="README.md",
        context=context
    )

Anything added to this dictionary will be available in the template:

# Title

{{ greeting }}

Filters

Variables can be modified by filters. All the standard Jinja2 filters are supported (you can found the full list here). To add your own filters, simply pass filters as an argument to ProfileGenerator.

from profile_readme import get_github_context, ProfileGenerator


context = get_github_context('octocat')
filters = {
    'hello': lambda x: 'Hello, {}!',
}


if __name__ == "__main__":
    ProfileGenerator.render(
        template_path="README-TEMPLATE.md",
        output_path="README.md",
        context=context,
        filters=filters
    )

Then you can use them in your template as you would expect:

{{ 'World'|hello }}

License

This project is licensed under the MIT License.

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

profile-readme-0.1.2.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

profile_readme-0.1.2-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file profile-readme-0.1.2.tar.gz.

File metadata

  • Download URL: profile-readme-0.1.2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for profile-readme-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e93581f9d47ccfbb466cb724b93d8e3e060ef7aff522a9eaa25bf352e09e325c
MD5 dc785ba7b201c91418c22b2319de63d6
BLAKE2b-256 a6a7b7a3b3f0263221eabbe51f1c7a5436f0878198fc9e149ccd1dc4f07842dc

See more details on using hashes here.

File details

Details for the file profile_readme-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: profile_readme-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for profile_readme-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6c585f315f09e8c0fab27353fbd71b3db5983de061f90538c46635dc42753aa
MD5 e503030c37707fc50684c836d7aeafa4
BLAKE2b-256 ad2ef78aefacb5b841a782a768ba378a45b419d3abaa3077bd28f37f72ab6c66

See more details on using hashes here.

Supported by

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