Code Monkey home page Code Monkey logo

sphinx_lfs_content's Introduction

sphinx_lfs_content

PyPI version Documentation Status

Git LFS is a popular method to store large files like e.g. documentation assets in git repositories. Building such documentation on a system without Git LFS will typically result in broken documentation. sphinx_lfs_content is a minimalistic Sphinx extension that ensures that git-lfs is installed and otherwise installs it and fetches LFS content. It is motivated by the lack of LFS support on readthedocs.org.

Installation

The extension can be installed from PyPI using pip:

python -m pip install sphinx_lfs_content

If you use a requirements file to describe the dependencies of your documentation build, simply add sphinx_lfs_content to it.

How to use it

Add the following lines to your conf.py:

# The list of enabled extensions
extensions = [
    "sphinx_lfs_content",
]

That's all. The extension will check whether the system has git-lfs and download a version from the git-lfs GitHub page, verify its checksum and checkout any LFS content.

Additionally, a configuration value lfs_content_post_commands is available. It accepts a list of strings with commands that will be executed after the git-lfs checkout was performed. This can be used to resolve chicken-egg situations with other setup code.

Restrictions

The extension is very likely to only work on Linux right now, as it does not properly select the git-lfs archive to download.

sphinx_lfs_content's People

Contributors

dependabot[bot] avatar dokempf avatar jdillard avatar riga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sphinx_lfs_content's Issues

Add CLI to use with new post_checkout of RTD

RTD now sort of supports LFS by providing a build process hook where the logic of sphinx_lfs_content can be put in. It would make sense to provide a CLI to avoid duplication of this logic.

GitHub bandwidth quota impacts

Just wanted to share a courtesy experience. I don't really think there is much you can do to solve this.

Using sphinx_lfs_content worked great but it (combined with fact that we rebuild docs on each commit to a PR) caused our GitHub bandwidth quota to soar.

So, we needed to disable it. We will revisit this issue in future if we have time.

Early return a potential issue?

@ssciwr thanks for this ๐ŸŽ‰ . Its working for me fine ๐Ÿ’ช๐Ÿป.

That said, I noticed what I think is a potential issue with this early return logic...

# If we already have git-lfs, we do nothing
if shutil.which("git-lfs"):
return

Doesn't this mean that if git-lfs is already there, it will fail to execute install, fetch and checkout steps here...

subprocess.check_call("git-lfs install".split(), env=env)
subprocess.check_call("git-lfs fetch".split(), env=env)
subprocess.check_call("git-lfs checkout".split(), env=env)

But, maybe you are assuming here if that RTD does create VM's with git-lfs installed, it will certainly also have added those steps to their setup. But, it also means that it skips anything in lfs_content_post_commands here...

# Execute all of the given post commands
for cmd in config.lfs_content_post_commands:
subprocess.check_call(cmd, shell=True)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.