Skip to main content

Enforce a triangular Git workflow. If this is not possible, explain why.

Project description

Samosa (समोसा)

Enforce a triangular Git workflow. If this is not possible, explain why.

---
config:
  look: handDrawn
---
flowchart LR
    local -- push --> origin
    origin -- merge --> upstream
    upstream -- checkout --> local

Usage

Usage: samosa [OPTIONS] COMMAND [ARGS]...

  Enforce a triangular Git workflow. If this is not possible, explain why.

Options:
  --help  Show this message and exit.

Commands:
  add       Add URL as a remote repository named REMOTE.
  branches  List branches with details.
  clone     Clone remote URL as a local repository.
  commit    Commit changes with a sign-off MESSAGE.
  diff      Compare with upstream.
  fetch     Fetch all remote updates without changing local files.
  force     Force-push changes to a remote branch.
  graph     Show a detailed commit graph.
  init      Initialize an empty local repository.
  log       Show a streamlined commit log.
  pull      Pull changes from the default remote branch.
  push      Push changes to the default remote branch.
  set       Set KEY to VALUE in the local Git configuration.
  status    Inspect and repair local repository.
  switch    Switch to a new or existing BRANCH.
  tags      List tags with messages.

Samosa will always prepare a repository before attempting a command. If all checks pass, the command is executed. Otherwise, Samosa will make a suggestion and terminate with exit code 1 (error).

Samosa standard

The following checks should be true:

  • In a Git repository
  • There is a remote named "origin"
  • There is a remote named "upstream"
  • Author name and email are set, and are not invalid
  • The default push target is "origin:current"
  • The pre-commit hook exists and is executable
  • There is a local branch named "main" (assuming init.defaultBranch is "main")
  • The main branch tracks "upstream/main"
  • Tags are sorted in descending order

See WORKFLOW.md for a detailed workflow that results in a samosa standard repository.

Suggestions

If you aren't forking, make origin and upstream equal

Forking a project may not be practical. In this case, set upstream and origin to the same URL.

(Forks may be disallowed for confidential projects. Forking may not be useful for solo maintainers.)

Out of scope

  • Detecting/supporting other workflows.
  • Oh sh*, git!
  • Non-Python packaging. Requires:
    • Both git and libgit2
    • For development (Debian): build-essentials, python3-dev, libffi-dev, libgit2-dev

Acknowledgements

WORKFLOW.md and the associated pre-commit bash script are derived from Aaron Bull Schaefer's excellent Git Triangular Workflow. License details are included in the relevant files.

Additional references

Alternatives

Development environment

Install prerequisites

  • Python 3.12 (including python3-dev)
  • pdm
  • make
  • pipx (optional, required for make install-source)

Instructions

  • Fork the upstream repository.
  • git clone [fork-url]
  • cd [project-folder]
  • Run make develop to initialize your development environment.

You can use any text editor or IDE that supports virtualenv / pdm. See the Makefile for toolchain details.

Please make test and make lint before submitting changes.

Make targets

USAGE: make [target]

help    : Show this message.
develop : Set up Python development environment.
run     : Run from source.
clean   : Remove all build artefacts.
test    : Run tests and generate coverage report.
lint    : Fix or warn about linting errors.
build   : Clean, test, lint, then generate new build artefacts.
publish : Upload build artefacts to PyPI.
install-source : Install source as a local Python application.

Sharing and contributions

Samosa (समोसा)
https://lofidevops.neocities.org
Copyright 2022 David Seaward and contributors
SPDX-License-Identifier: AGPL-3.0-or-later

Shared under AGPL-3.0-or-later. We adhere to the Contributor Covenant 2.1, and certify origin per DCO 1.1 with a signed-off-by line. Contributions under the same terms are welcome.

Submit security and conduct issues as private tickets. Sign commits with git commit --signoff. For a software bill of materials run reuse spdx. For more details see CONDUCT, COPYING and CONTRIBUTING.

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

samosa-0.7.2.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

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

samosa-0.7.2-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file samosa-0.7.2.tar.gz.

File metadata

  • Download URL: samosa-0.7.2.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.6 CPython/3.12.3 Linux/6.17.0-14-generic

File hashes

Hashes for samosa-0.7.2.tar.gz
Algorithm Hash digest
SHA256 dc1efa202ff5f2b333217fd9df5364c099dbc2b9f5f8ef5fa83909fba30fbbf3
MD5 45174f98a37a76f57c055762f6f5cabb
BLAKE2b-256 6c29a529cdeddc634136264820d4059289debd854e0ad9ae6d0713f040c7bf94

See more details on using hashes here.

File details

Details for the file samosa-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: samosa-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.26.6 CPython/3.12.3 Linux/6.17.0-14-generic

File hashes

Hashes for samosa-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 93e9be68a87a0ce57f3ad2731784abec5f24011b360e1d8bd65f4526fd9bc9fd
MD5 5a69126f580aa027bf70e926102d97ca
BLAKE2b-256 61d17b38caaefebacf60c9f511ad5b17e273c76f65bc3925f9f54643a17f68bb

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