Skip to main content

tempgit

Some temporal operations over git repositories using, mainly, ssh private keys and a git monitor to detect changes in a repository.

Temporal git repository

This is used to get a temporal git repository, for example, to clone it, modify and push the changes without maintaining a local copy of the repository. The syntax is:

from tempgit import TemporalGitRepository

# Using "with" command. The repository will be removed automatically after the "with" command finishes 
with TemporalGitRepository(repository, branch=branch, ssh_key=ssh_key, single_branch=False, depth=1, remove=True) as repo:
    repo.add(...)
    repo.commit(...)
    repo.push()

Where repository is the Git repository URL, the branch the branch name, ssh_key the private key to connect with the repository, single_branch True to download only the selected branch, depth create a shallow clone of that depth, and remove if the local copy of the repository will be removed.

For example:

from tempgit import TemporalGitRepository

# Using "with" command. The repository will be removed automatically after the "with" command finishes 
with TemporalGitRepository(repository, branch=branch, ssh_key=ssh_key) as repo:
    repo.add(file1, file2, file3, ...)  # Add the modifications
    repo.commit('Message')  # Commit the changes
    repo.push()  # Push the commit

# With close(). The repository will be removed when you close the object.
repo = TemporalGitRepository(repository, branch=branch, ssh_key=ssh_key):
repo.add(file1, file2, file3, ...)
repo.commit('Message')
repo.push()
repo.close()

Git monitor

Monitor a Git repository to check if there is any change in the remote repository with respect the local one.

from mysutils.git import GitMonitor

# Function to execute when the is a change
def func(*files: str) -> None:
  # Print the changed files
  print(files)

# Create a monitor instance to execute one only time  
monitor = GitMonitor(func, 'local_dir', 'remote_url', 'branch_name')
# Execute the monitor
monitor.monitor()
# Execute the monitor as a thread
monitor.start()

# If you want to check the git repository several times you need add an interval to
monitor = GitMonitor(func, 'local_dir', 'remote_url', 'branch_name', interval=30)  # 30 seconds
# If you want to execute func() the first time although the repository has not changed, use force
monitor = GitMonitor(func, 'local_dir', 'remote_url', 'branch_name', force=True, interval=30)

Metadata

Release files for tempgit 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tempgit 0.1.1
File Size Uploaded Provenance Actions
tempgit-0.1.1.tar.gz 18.6 kB Without provenance Details for tempgit-0.1.1.tar.gz

Release files / tempgit-0.1.1.tar.gz

Download URL tempgit-0.1.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
eccaad81c95193dbcae81d7347c26c0843e2e2eea5b3a472cfd95e3a0113d941
BLAKE2b-256 checksum
How to use checksums
d607914ba8e5f74b3865b564414853d3138ffb2a57939e0b60767cafda7f9cd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for tempgit 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page