Skip to main content

A tiny (yocto) git client for MicroPython.

Project description

A tiny (yocto) git client for MicroPython.

Install

$ ampy -p /dev/ttyUSB0 put ygit.py

Get Started

To clone a repo, run:

>>> ygit.clone('https://github.com/turfptax/ugit_test.git','.')

The second argument is the target directory (usually '.'). This will produce a shallow clone (at HEAD) by default. It will not delete any files in the target directory, but it will overwrite them if conflicting. The normal git files you’d expect (config, *.pack, IDX) will be in .ygit. You only need to run this once.

To update:

>>> ygit.pull('.')

Which is the same as:

>>> ygit.fetch('.')
>>> ygit.checkout('.')

These are incremental operations. It will only download git objects you don’t already have, and only update files when their SHA1 values don’t match.

API

ygit.init(repo, directory, cone=None)
ygit.clone(repo, directory, shallow=True, cone=None, quiet=False, commit='HEAD')
ygit.checkout(directory, commit='HEAD')
ygit.pull(directory, shallow=True, quiet=False, commit='HEAD')
ygit.fetch(directory, shallow=True, quiet=False, commit='HEAD')

Shallow Cloning

By default clones are shallow to save space.

Subdirectory Cloning

Usually I don’t want to clone an entire project onto my ESP32. The python I want on the device is in a subdirectory of a larger project. The cone argument will take a path, and only files in that directory will be checked out (as if it were the top level).

Design

This is a partial git client implemented in pure python, targeting MicroPython. It speaks to HTTP servers using the smart client protocol.

Roadmap

  • HTTP authentication for non-public projects.

  • clone is currently unfinished.

  • Support branches / tags.

Tests

  • pytest test_localhost.py (run nginx -c "$(pwd)/test_nginx.conf" -e stderr in the background)

  • pytest test_gh.py (runs tests against github)

  • pytest test_esp32.py (WARNING: will wipe all files except boot.py from your device.)

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

ygit-0.1.1.tar.gz (20.7 kB view details)

Uploaded Source

File details

Details for the file ygit-0.1.1.tar.gz.

File metadata

  • Download URL: ygit-0.1.1.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for ygit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 81c0335e3dbd31cf366a34900641a7cb6700d360133e238f803c4ec5bf76465a
MD5 bef6010db0cbc82ed8ec9065256daf34
BLAKE2b-256 7629e619adc1d3bd05dddcd010b12c0329ede1877ea70d0b5dd15fc1632ec6d5

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