Add a “contrib” directory to your projects

栏目: IT技术 · 发布时间: 4年前

内容简介:There’s a common pattern among free- and open-source software projects to include a “contrib” directory at the top of their source code tree. I’ve seen this in many projects for many years, but I’ve seen it discussed only rarely — so here we are!The contri

There’s a common pattern among free- and open-source software projects to include a “contrib” directory at the top of their source code tree. I’ve seen this in many projects for many years, but I’ve seen it discussed only rarely — so here we are!

The contrib directory is used as an unorganized (or, at best, lightly organized) bin of various useful things contrib uted by the community around the software, but which is not necessarily a good candidate for being a proper part of the software. Things in contrib should not be wired into your build system, shouldn’t be part of your automated testing, shouldn’t be included in your documentation, and should not be installed with your packages. contrib entries are not supported by the maintainers, and are given only a light code review at the most. There is no guarantee whatsoever of workitude or maintenance for anything found in contrib.

Nevertheless, it is often useful to have such a place to put various little scripts, config files, and so on, which provide a helpful leg-up for users hoping to integrate the software with some third-party product, configure it to fit nicely into an unusual environment, coax it into some unusual behavior, or whatever else the case may be. The idea is to provide a place to drop a couple of files which might save a future someone facing similar problems from doing all of the work themselves. Such people can contribute back small fixes or improvements, and the maintenance burden of such contributions lies entirely with the users.

If the contributor wants to take on a greater maintenance burden, this kind of stuff is better suited to a standalone project, with its own issue tracking, releases, and so on. If you just wrote a little script and want somewhere to drop it so that others may find it useful, then contrib is the place for you.

For a quick example, let’s consult Sway’s contrib folder :

_incr_version
autoname-workspaces.py
grimshot
grimshot.1
grimshot.1.scd
inactive-windows-transparency.py

The _incr_version script is something that I use myself to help with preparing new releases. It is a tool useful only to maintainers, and therefore is not distributed with the project.

Looking at autoname-workspaces.py next, from which we can see that the quality criteria is reduced for members of contrib — none of Sway’s upstream code is written in Python, and the introduction of such a dependency would be controversial. This script automatically changes your workspace name based on what applications you’re running in it — an interesting workflow, but quite different from the OOTB experience.

grimshot is a shell script which ties together many third-party programs (grim, slurp, wl-copy, jq, and notify-send) to make a convenient way of taking screenshots. Adding this upstream would introduce a lot of third-party dependencies for a minor convenience. This tool has had a bit more effort put into it: notice that a man page is provided as well. Because the contrib directory does not participate in the upstream build system, the contributor has also added a pre-compiled man page so that you can skip this step when installing it on your system.

Last, we have inactive-windows-transparency.py , which is a script for making all windows other than your focused one semi-transparent. Some people may want this, but again, it’s not really something we’d consider appropriate for the OOTB experience. Perfect for contrib!

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~sircmpwn/public-inbox@lists.sr.ht [ mailing list etiquette ]

Are you a free software maintainer who is struggling with stress, demanding users, overwork, or any other social problems in the course of your work? Please email me — I know how you feel, and I can lend a sympathetic ear and share some veteran advice.

Articles from blogs I follow around the net

A simple way to get more value from tracing

A lot of people seem to think that distributed tracing isn't useful, or at least not without extreme effort that isn't worth it for companies smaller than FB. For example, here are a couple of public conversations that sound like a number of priva…

via Dan Luu May 31, 2020

Achieving accessibility through simplicity

I have received many emails complimenting SourceHut’s simple design and lightweight pages1, but I have received a surprising amount of positive feedback from a particular group of users: the blind community. For many software teams, especially web developers…

via Blogs on Sourcehut May 27, 2020

Status update, May 2020

This month I’ve started working with Valve, the company behind the Steam game platform. I’ll be helping them improving gamescope, their gaming Wayland compositor. Unlike existing compositors, gamescope uses Vulkan and libliftoff. Because these are pretty …

via emersion May 18, 2020

Generated by openring


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

搜索模式

搜索模式

Peter Morville、Jeffery Callender / 蒋彬 / 电子工业出版社 / 2010-10 / 35.00元

本书是信息架构领域创始人彼得•莫维里的又一力作,全书详尽剖析了10种搜索模式,告诉读者如何为不同情境设计搜索功能,涉及互联网、电子商务、企业、手机、社交和实时搜索等不同平台和领域。每种搜索模式均配以大量案例,并结合了作者自身的经验,因此更富实用性和实战性。书中遍布作者对于搜索模式的探索和思考,既适合对未来的搜索进行前瞻性的探讨,也能够指导当前进行中的项目。一起来看看 《搜索模式》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换