Skip to main content

Large scale VCS change management

Project description

Silver-Platter logo

Silver-Platter makes it possible to contribute automatable changes to source code in a version control system (codemods).

It automatically creates a local checkout of a remote repository, makes user-specified changes, publishes those changes on the remote hosting site and then creates a pull request.

In addition to that, it can also perform basic maintenance on branches that have been proposed for merging - such as restarting them if they have conflicts due to upstream changes.

Silver-Platter powers the Debian Janitor (https://janitor.debian.org/) and Kali Janitor (https://kali.janitor.org/). However, it is an independent project and can be used fine as a standalone tool. The UI is still a bit rough around the edges, I’d be grateful for any feedback from people using it - please file bugs in the issue tracker at https://github.com/jelmer/silver-platter/issues/new.

Getting started

To log in to a code-hosting site, use svp login:

svp login https://github.com/

The simplest way to create a change as a merge proposal is to run something like:

svp run --mode=propose ./framwork.sh https://github.com/jelmer/dulwich

where framwork.sh makes some modifications to a working copy and prints the commit message and body for the pull request to standard out. For example:

#!/bin/sh
sed -i 's/framwork/framework/' README.rst
echo "Fix common typo: framwork ⇒ framework"

If you leave pending changes, silver-platter will automatically create a commit and use the output from the script as the commit message. Scripts also create their own commits if they prefer - this is especially useful if they would like to create multiple commits.

Recipes

To make this process a little bit easier to repeat, recipe files can be used. For the example above, we could create a framwork.yaml with the following contents:

---
name: framwork
command: |-
 sed -i 's/framwork/framework/' README.rst
 echo "Fix common typo: framwork ⇒ framework"
mode: propose
merge-request:
  commit-message: Fix a typo
  description:
    markdown: |-
      I spotted that we often mistype *framework* as *framwork*.

To execute this recipe, run:

svp run --recipe=framwork.yaml https://github.com/jelmer/dulwich

See example.yaml for an example recipe with plenty of comments.

In addition, you can run a particular recipe over a set of repositories by specifying a candidate list. For example, if candidates.yaml looked like this:

---
- url: https://github.com/dulwich/dulwich
- url: https://github.com/jelmer/xandikos

then the following command would process each repository in turn:

svp run --recipe=framwork.yaml --candidates=candidates.yaml

Batch Mode

Use batch mode when you’re going to make a large number of changes and would like to review or modify the diffs before sending them out:

svp batch generate --recipe=framwork.yaml --candidates=candidate.syml framwork

This will then create a directory called “framwork”, with a file called batch.yaml with all the pending changes:

name: framwork
work:
- url: https://github.com/dulwich/dulwich
  name: dulwich
  description: I spotted that we often mistype *framework* as *framwork*.
  commit-message: Fix a typo
  mode: propose
- url: https://github.com/jelmer/xandikos
  name: dulwich
  description: I spotted that we often mistype *framework* as *framwork*.
  commit-message: Fix a typo
  mode: propose
recipe: ../framwork.yaml

For each of the candidates, a clone with the changes is created. You can introspect and modify the clones as appropriate.

After you review the changes, edit batch.yaml as you see fit - remove entries that don’t appear to be correct, edit the details for the merge requests, etc.

Once you’re happy, you can publish the results:

svp batch publish framwork

This will publish all the changes, using the mode and parameters specified in batch.yaml.

batch.yaml is automatically stripped of any entries in work that have fully landed, i.e. where the pull request has been merged or where the changes were pushed to the origin.

To check up on the status of your changes, run svp batch status:

svp batch status framwork

And to refresh any merge proposals that may have become out of date, run publish again:

svp batch publish framwork

Supported hosters

At the moment, the following code hosters are supported:

Working with Debian packages

Several common operations for Debian packages have dedicated subcommands under the debian-svp command. These will also automatically look up packaging repository location for any Debian package names that are specified.

  • upload-pending: Build and upload a package and push/propose the changelog updates.

  • run: Similar to svp run but specific to Debian packages: it ensures that the upstream and pristine-tar branches are available as well, can optionally update the changelog, and can test that the branch still builds.

Some Debian-specific example recipes are provided in examples/debian/:

  • lintian-fixes.yaml: Run the lintian-brush command to fix common issues reported by lintian.

  • new-upstream-release.yaml: Merge in a new upstream release.

  • multi-arch-hints.yaml: Apply multi-arch hints.

  • orphan.yaml: Mark a package as orphaned, update its Maintainer field and move it to the common Debian salsa group.

  • rules-requires-root.yaml: Mark a package as “Rules-Requires-Root: no”

  • cme.yaml: Run “cme fix dpkg”, from the cme package.

debian-svp run takes package name arguments that will be resolved to repository locations from the Vcs-Git field in the package.

See debian-svp COMMAND --help for more details.

Examples running debian-svp:

# Create merge proposal running lintian-brush against Samba
debian-svp run --recipe=examples/lintian-brush.yaml samba

# Upload pending changes for tdb
debian-svp upload-pending tdb

# Upload pending changes for any packages maintained by Jelmer,
# querying vcswatch.
debian-svp upload-pending --vcswatch --maintainer jelmer@debian.org

# Import the latest upstream release for tdb, without testing
# the build afterwards.
debian-svp run --recipe=examples/debian/new-upstream-release.yaml \
    --no-build-verify tdb

# Apply multi-arch hints to tdb
debian-svp run --recipe=examples/debian/multiarch-hints.yaml tdb

The following environment variables are provided for Debian packages:

  • DEB_SOURCE: the source package name

  • DEB_UPDATE_CHANGELOG: indicates whether a changelog entry should be added. Either “leave” (leave alone) or “update” (update changelog).

Credentials

The svp hosters subcommand can be used to display the hosting sites that silver-platter is aware of:

svp hosters

And to log into a new hosting site, simply run svp login BASE-URL, e.g.:

svp login https://launchpad.net/

Exit status

svp run will exit 0 if no changes have been made, 1 if at least one repository has been changed and 2 in case of trouble.

Python API

Other than the command-line API, silver-platter also has a Python API. The core class is the Workspace context manager, which exists in two forms:

  • silver_platter.workspace.Workspace (for generic projects)

  • silver_platter.debian.Workspace (for Debian packages)

An example, adding a new entry to a changelog file in the dulwich Debian package and creating a merge proposal with that change:

from silver_platter.debian import Workspace
import subprocess

with Workspace.from_apt_package(package="dulwich") as ws:
    subprocess.check_call(['dch', 'some change'], cwd=ws.path)
    ws.commit()  # Behaves like debcommit
    ws.publish(mode='propose')

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

silver_platter-0.5.21.tar.gz (34.8 kB view details)

Uploaded Source

Built Distributions

silver_platter-0.5.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.21-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (4.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

silver_platter-0.5.21-cp312-cp312-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

silver_platter-0.5.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.21-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (4.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

silver_platter-0.5.21-cp311-cp311-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

silver_platter-0.5.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.21-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (4.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

silver_platter-0.5.21-cp310-cp310-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

silver_platter-0.5.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.21-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (4.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

silver_platter-0.5.21-cp39-cp39-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

silver_platter-0.5.21-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.21-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (4.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

silver_platter-0.5.21-cp38-cp38-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

silver_platter-0.5.21-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

silver_platter-0.5.21-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl (4.9 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ i686

File details

Details for the file silver_platter-0.5.21.tar.gz.

File metadata

  • Download URL: silver_platter-0.5.21.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for silver_platter-0.5.21.tar.gz
Algorithm Hash digest
SHA256 15c753ed69bc250a43db5c4f3044a7575022dcbb0804b07ab5ff39919bc78b16
MD5 fe53c2fa89a54a81b67e12c62949e985
BLAKE2b-256 7278ccf55f07290a3a949fd6ba6efad16403165a547f657571c8fdfeafcbf78e

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc722d4f4865757289af7822c7feff1a7e3e6d0b9a09b7803761d160bb77167a
MD5 e8ccd98d9e28e162f1b2f9faa4b527b3
BLAKE2b-256 4319bf47a602d83aeef0faee360bdf6dc8e5177a3434d01d1cfa752310ffa60c

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 50847c302b043e89f19a30b840452d50e6ccc958d0682ef8c7dcf8da07d5b2b9
MD5 9399a9ec1bbdaa0e521c6774831fe617
BLAKE2b-256 47be6664df7f91abffef93c46220c0a08d5137ffa34fee8f0093aae1df50ce17

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3c5695f8a2df8cc7f4372195bd0ad57573eeca369b18d6ed36f5c9b6164e544c
MD5 de275f12fff521bf0fc517fbc292c050
BLAKE2b-256 150d63b2ad515e95ac5a71a849efdf65c7f4e278b960ffb9d129a55d67644b77

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9debd999a3dbaa7c92129fb7532885bfb29a7ac70e79dd9ff54b54ff5ecedd18
MD5 9aba2ec8e28e76b241e964f7f80b323b
BLAKE2b-256 d50130aba4639ae7eaf729fe292afc01827d30a8967927c3f0f11fc9ba3d54b0

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 477b7aa3ecd3555e7fe507428d9540807cf9552ac057c7356b611b4d844a24dd
MD5 e53ca024855ef4ed73b0edf4e98411cd
BLAKE2b-256 2abbf4131ffbcd082c9d3a10203253de9228ddf3c871b4271310b86338148a09

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 21f14a11355dd550c94327ea510c976837b840f43e8fa433667d474d1b3592b9
MD5 d6b7929d81885cbd20c752b070564d98
BLAKE2b-256 8bf81ef6905dd99047705bc3a8871ac02480dff31ac0f7571a34b543555b6a74

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84fae00723b56f7a45a85e096874f39439b0f73d718d3a0ef804daf64a491c3e
MD5 d3340df05890b85b38b350aa4d27c44d
BLAKE2b-256 744e4904fbcbbb2ba1afe2cd6cff07a0d3416dc22406603bda4bea02d5a445ac

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ee513392ef00b3940748e6d5a51cc51ca6f1ce24108485a5617548eb0e272746
MD5 2ac39ff647ce4aa53e47eeb712162d51
BLAKE2b-256 b5078c73332015441f0d33e8d74d99266cde88ddece23124c167756fa7d5ec91

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 542f07877515e588ba18e93551b6f9e49fca5adc16e8f6843163d2327c806f4b
MD5 2030902acc14894b3e8514fc93542c60
BLAKE2b-256 56ff10428640c903d213e80b48a179dbef0f4b928efb2714d93e2b99fad5f3c4

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4e7bd6a2d431e38331872a610ae158d6184ee2785095ddc0b31268a76e99e17
MD5 cff43c99af7c4bb17bcac3e68c84d1f7
BLAKE2b-256 535b815b4f2d80b24681b5e1d2e8cdd6f0234d5027297b3eb6f916e241d0ee88

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6416390ac49ef5b5665fcc5a69a650e001baa8e95d28246a56e89d1c47e9e8f9
MD5 93e0a260e5e34debf0e74a0b6f14ea84
BLAKE2b-256 9cee592f0a38b189b8da5dfc4f316ff7354de5cbaf6038e3f45c85dfddec5323

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c5591b6864f9ed19357dd773101c5cdefcdf28b2d06956189503ee71e34da93c
MD5 f4a6730ab058736e2d623d13409a979f
BLAKE2b-256 1cca35fcff5d65a2c99d0f271690c8d46463b149149b9bd4802fbb520fd60e30

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9bbf69783af985fc5d423fbc7efbea33fc8b694ab151883c3acb465869b1ce2d
MD5 c7e79806c9afd7c29fe2cd4fde94f492
BLAKE2b-256 d297d384722da7fa75d7e009820645b80026384ba7ae14d2e26615ea8b66bfff

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f945b854148dbef877d092f69947b5181f9ea631f436198881b7b1d0ce61493d
MD5 7f4a2c2863ebc281f10a6d9b792b3429
BLAKE2b-256 5ff7f572a855bb36420768c3723cf722d7213792740d762e1925761dc196eb40

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d588a31c2f14f47bf49d055826e04de32a62004bd08202fc8f73764068602861
MD5 eca1ce17458fe09973d2869ddc60bc44
BLAKE2b-256 5a72e3874992752ff37ab132e99db6a3aea8bff9cc92b42f4a3cf463cce9a984

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f53a7be6596a294414d66bb82093d5b768ed5c3ddb9a0fac5c1276ab3fabbebc
MD5 0fb928611171c7c5a64de2be6226a318
BLAKE2b-256 90c109aa038f04e5a2ebb17a4744297f0cfdd654517a5d7f47a0a86eb2f01501

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.21-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.21-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 52fc916fb186aa0b7bdda40d8ea3cb74932067c7f97608f53769dae1fb484ebd
MD5 8bd6b485d2575a3c891d06d2fd9b3abf
BLAKE2b-256 8e1472e8124fd453cfa538d1f2307c4847b35fe1d0c046a8052a0184c0ba0232

See more details on using hashes here.

Supported by

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