mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,5 Tsd.
aktive Profile

#bestpracticesinpractice

0 Beiträge0 Beteiligte0 Beiträge heute
Terri K O 🍁<p>Best practices in practice: Software release tracking and end of life <a href="https://curiousity.ca/2024/best-practices-in-practice-software-release-tracking-and-end-of-life/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">curiousity.ca/2024/best-practi</span><span class="invisible">ces-in-practice-software-release-tracking-and-end-of-life/</span></a> Continuing in my “best practices in practice series” : an API for finding the list of available software versions and an API for finding out if those versions are still actively supported (and for how long). … <a href="https://social.afront.org/tags/BestPractices" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BestPractices</span></a> <a href="https://social.afront.org/tags/BestPracticesInPractice" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BestPracticesInPractice</span></a> <a href="https://social.afront.org/tags/infosec" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>infosec</span></a> <a href="https://social.afront.org/tags/mailman" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mailman</span></a> <a href="https://social.afront.org/tags/OpenSource" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OpenSource</span></a> <a href="https://social.afront.org/tags/security" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>security</span></a></p>
Dr. Terri<p><em>This is part of my series on “<a href="https://curiousity.ca/category/best-practices/" rel="nofollow noopener" target="_blank">best practices in practice</a>” where I talk about best practices and related tools I use as an open source software developer and project maintainer. These can be specific tools, checklists, workflows, whatever. Some of these have been great, some of them have been not so great, but I’ve learned a lot. I wanted to talk a bit about the usability and assumptions made in various tools and procedures, especially relative to the wider conversations we need to have about open source maintainer burnout, mentoring new contributors, and improving the security and quality of software.</em></p><p>If you’re running Linux, usually there’s a super easy way to check for updates and apply them. For example, on Fedora Linux `sudo dnf update` will do the magic for you. But if you’re producing software with dependencies outside of a nice distro-managed system, figuring out what the latest version is or whether the version you’re using is still supported can sometimes be a real chore, especially if you’re maintaining software that is written in multiple programming languages. And as the software industry is trying to be more careful about shipping known vulnerable or unsupported packages, there’s a lot of people trying to find or make tools to help manage and monitor dependencies.</p><p>I see a lot of people trying to answer “what’s the latest” and “which versions are still getting support” questions themselves with web scrapers or things that read announcement mailing list posts, and since this came up last week on the Mailman irc channel, I figured I’d write a blog post about it. I realize lots of people get a kick out of writing scrapers as a bit of a programming exercise and it’s a great task for beginners. But I do want to make sure you know you don’t *have* to roll your own or buy a vendor’s solution to answer these questions!</p><p><strong>What is the latest released version?</strong></p><p>The website (and associated API) for this is <a href="https://release-monitoring.org/" rel="nofollow noopener" target="_blank">https://release-monitoring.org/</a></p><p>At the time that I’m writing this, the website claims it’s monitoring 313030 packages, so there’s a good chance that someone has already set up monitoring for most things you need so you don’t need to spend time writing your own scraper. It monitors different things depending on the project. </p><p>For example, the Python release tracking uses the tags on github to find the available releases: <a href="https://release-monitoring.org/project/13254/" rel="nofollow noopener" target="_blank">https://release-monitoring.org/project/13254/</a> . But the monitoring for curl uses the download site to find new releases: <a href="https://release-monitoring.org/project/381/" rel="nofollow noopener" target="_blank">https://release-monitoring.org/project/381/</a></p><p>It’s backed by software called <a href="https://release-monitoring.org/static/docs/index.html" rel="nofollow noopener" target="_blank">Anitya</a>, in case you want to set up something just for your own monitoring. But for the project where I use it, it turned out to be just as easy to <a href="https://release-monitoring.org/static/docs/api.html" rel="nofollow noopener" target="_blank">use the API</a>. </p><p><strong>What are the supported versions?</strong></p><p>My favourite tool for looking up “end of life” dates is <a href="https://endoflife.date/" rel="nofollow noopener" target="_blank">https://endoflife.date/</a> (so easy to remember!). It also <a href="https://endoflife.date/docs/api" rel="nofollow noopener" target="_blank">has an API</a> (note that you do need to enable javascript or the page will appear blank). It only tracks 343 products but does take requests for new things to track. </p><p>I personally use this regularly for the <a href="https://endoflife.date/python" rel="nofollow noopener" target="_blank">python end of life dates</a>, mostly for monitoring when to disable support for older versions of Python.</p><p>I also really like their <a href="https://endoflife.date/recommendations" rel="nofollow noopener" target="_blank">Recommendations for publishing End-of-life dates and support timelines</a> as a starting checklist for projects who will be providing longer term support. I will admit that my own open source project doesn’t publish this stuff and maybe I could do better there myself!</p><p><strong>Conclusion</strong></p><p>If you’re trying to do better at monitoring software, especially for security reasons, I hope those are helpful links to have!</p><p><a href="https://curiousity.ca/2024/best-practices-in-practice-software-release-tracking-and-end-of-life/" class="" rel="nofollow noopener" target="_blank">https://curiousity.ca/2024/best-practices-in-practice-software-release-tracking-and-end-of-life/</a></p><p><a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/bestpractices/" target="_blank">#BestPractices</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/bestpracticesinpractice/" target="_blank">#BestPracticesInPractice</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/infosec/" target="_blank">#infosec</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/mailman/" target="_blank">#mailman</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/opensource/" target="_blank">#OpenSource</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/security/" target="_blank">#security</a></p>
Terri K O 🍁<p>Best practices in practice: pre-commit <a href="https://curiousity.ca/2024/best-practices-in-practice-pre-commit/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">curiousity.ca/2024/best-practi</span><span class="invisible">ces-in-practice-pre-commit/</span></a> Continuing in my “best practices in practice series” : today’s tool is `pre-commit`. Using pre-commit takes a bunch of failure points out of our code quality and security process, and I highly recommend it. … <a href="https://social.afront.org/tags/BestPractices" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BestPractices</span></a> <a href="https://social.afront.org/tags/BestPracticesInPractice" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>BestPracticesInPractice</span></a> <a href="https://social.afront.org/tags/infosec" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>infosec</span></a> <a href="https://social.afront.org/tags/OpenSource" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>OpenSource</span></a> <a href="https://social.afront.org/tags/review" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>review</span></a></p>
Dr. Terri<p><em>This is part of my series on “<a href="https://curiousity.ca/category/best-practices/" rel="nofollow noopener" target="_blank">best practices in practice</a>” where I talk about best practices and related tools I use as an open source software developer and project maintainer. These can be specific tools, checklists, workflows, whatever. Some of these have been great, some of them have been not so great, but I’ve learned a lot. I wanted to talk a bit about the usability and assumptions made in various tools and procedures, especially relative to the wider conversations we need to have about open source maintainer burnout, mentoring new contributors, and improving the security and quality of software.</em></p><p>I was just out at Google Summer of Code Mentor Summit, which is a gathering of open source mentors associated with Google’s program. Everyone there regularly works with new contributors who have varying levels of ability and experience, and we want to maintain codebases that have good quality, so one of the sessions I attended was about tools and practices for code quality. <a href="https://pre-commit.com/" rel="nofollow noopener" target="_blank">Pre-commit</a> is one of the tools that came up in that session that I use regularly, so I’d like to talk about it today. This is a tool I wouldn’t have thought to look for on my own, but someone else recommended it to me and did the initial config for my project, so I’m happy to pay that forwards by recommending it to others.</p><p><strong>Pre-commit helps you run checks before your code can be checked to git. </strong>Your project provides a config file of whatever tools it recommends you use. Once you’ve got pre-commit installed, you can tell it to use that file, and then those checks will run when you type `<code>git commit</code>` with it halting if you don’t pass a check so you can fix it before you “save” the code. By default it only runs on files you changed and can be tuned by the project maintainers to skip files that aren’t compliant yet, so you don’t generally get stuck fixing other people’s technical debt unless that’s something that the maintainers chose to do.</p><p>Under the hood there’s some magic happening to make sure it can install, set up, and configure the tools. It does tell you what’s happening on the command line, but it’s worlds better than having to install them all yourself, and it puts it into a separate environment so you don’t have to worry about needing slightly different versions for different projects. Honestly, the only time I’ve had trouble with this tool was when I was using it in a weird environment behind a proxy and some combination of things meant that pre-commit was unable to set up tools for me. I think that’s more of a failure of the environment than of the tool, and it’s been shockingly easy to set up and use on every other development machine where I’ve used it. One command to install pre-commit, then one command to set it up for each project where I use it.</p><p>I’m sure there are some programmers who are incredibly disciplined and manage to run all required checks themselves manually, but I am not the sort of person who memorizes huge arrays of commands and flags and remembers to run them Every Single Time. I am the sort of person who writes scripts to automate stuff because I will forget. Before pre-commit I would have had a shell script to do the thing, but now I don’t have to write those for projects that already have a config file ready for me. <strong>Thus, pre-commit speaks to the heart of how I work as a developer. I got into computers because I could make them do the boring stuff.</strong> </p>Image Description: A photo of the package locker in a US shared mailbox. A label around the keyhole reads “open” with arrows and then says “key will remain in lock after opening door” — it’s a great example of design that doesn’t rely on users remembering to do the right thing (in this case, giving back the key for future use)<p>Pre-commit also speaks to the heart of my computer security philosophy: any security that relies on humans getting things 100% right 100% of the time is doomed to fail eventually. And although a lot of this blog is about knitting and fountain pens and my hobby work, I want to remind you that I’m not just some random person on the internet when it comes to talking about computer security: I have a PhD in web security policy and I work professionally as an open source security researcher. Helping people write and maintain better code is a large portion of my day job. A lot of the most effective work in security involves making it easy and “default” for people to make the most secure choices. (See the picture above for a more physical example of the design philosophy that ensures users do the right thing.)</p><p><strong>Using pre-commit takes a bunch of failure points out of our code quality and security process and makes it easier for developers to do the right thing. </strong> For my current work open source project, we recommend people install it and use it on their local systems, then we run it again in our continuous integration system and require the checks to pass there before the code can be merged into the main branch.</p><p>As a code contributor:</p><ul><li>I like that pre-commit streamlines the whole process of setting up tools. I just type <code>pre-commit install</code> in the directory of code I intend to modify and it does the work.</li><li>I can read the <code>.pre-commit-config.yaml</code> file to find out a list of recommended tools and configurations for a project all in one place. Good if you’re suspicious of installing and using random things without looking them up, but also great for learning about projects or about new tools that might help you with code quality in other projects.</li><li>It only runs on files I changed, so the fixes it recommends are usually relevant to me and not someone else’s technical debt haunting me.</li><li>It never forgets to run a check. (unless I explicitly tell it to)</li><li>It helps me fix any issues it finds before they go into git, so I don’t feel obliged to fuss around with my git history to hide my mistakes. Git history is extremely obnoxious to fuss with and I prefer to do it as infrequently as humanly possible.</li><li>It also subtly makes me feel more professional to know that all the basic checks are handled before I even make a pull request. I’ve been involved in open source so long that I mostly don’t care about my coding mistakes being public knowledge, but I know from mentoring others that a lot of people find the idea of making a mistake in public very hard, and they want to be better than the average contributor from the get-go. This is definitely a way to make your contributions look better than average!</li><li>It gives me nearly immediate, local feedback if my code is going to need fixes before it can be merged. I like that I get feedback usually before my brain has moved on to the next problem, so it fits into my personal mental flow before I even go to look at another window.</li><li>It can get you feedback considerably faster than waiting for checks to run in a continuous integration system. If you’re lucky, a system like github actions can get you feedback within a few minutes on quick linter-style checks, but if the system is backed up it or if you’re a new contributor to a project and someone has to approve things before they run (to make sure you’re not just running a cryptominer or other malicious code in their test system!), it can take hours or days to get feedback. Being able to fix things before the tests run can save a lot of time!</li></ul><p>As a project maintainer:</p><ul><li>Letting me configure the linters and pre-checks I want in one place instead of multiple config files is pretty fantastic and keeps the root directory of my project a lot less full of crap.</li><li>It virtually eliminates problems where someone uses a tool subtly differently than I do. If you’re not an open source project maintainer who works with random people on the internet you may not realize how much of a hassle it is helping people configure multiple development tools, but let me tell you, it’s a whole lot easier to just tell them to use pre-commit.<ul><li>Endlessly helping people get started and answering the same questions over and over can be surprisingly draining! It’s one of the things we really watch for in Google Summer of Code when trying to make sure our mentors don’t burn out. Anything I can do that makes life easier for contributors and mentors and avoid repetitive conversations has an outsized value in my toolkit.</li></ul></li><li>Being able to run exactly the same stuff in our continuous integration/test system means even if my contributors know nothing about it, I still get the benefits of those checks happening before I do my code review.</li><li>It saves me a lot of time back-and-forth with contributors asking for fixes so it lets me get their code merged faster. A nicer experience for all of us!</li><li>I can usually configure which files need to be skipped, so it can help us upgrade our code quality slowly. Or I can use it as a nudge to encourage people changing a file to also fix minor issues if I so desire.</li></ul><p>What gets run with pre-commit will obviously depend on the project, but I think it’s probably helpful to give you an idea of what I run. I talked about using <a href="https://curiousity.ca/2024/best-practices-black/" rel="nofollow noopener" target="_blank">black, the python code formatter in a previous best practices post</a>. For my work open source project, it’s only one of several code quality linters we use. We also use <a href="https://pypi.org/project/pyupgrade/" rel="nofollow noopener" target="_blank">pyupgrade</a> to help us be forward-compatibile with python syntaxes, <a href="https://bandit.readthedocs.io/en/latest/" rel="nofollow noopener" target="_blank">bandit</a> to help us find python security issues, <a href="https://jorisroovers.com/gitlint/latest/" rel="nofollow noopener" target="_blank">gitlint</a> to help us provide consistency in commit messages (we use the <a href="https://www.conventionalcommits.org/" rel="nofollow noopener" target="_blank">conventional commits </a>format rules), and <a href="https://www.mypy-lang.org/" rel="nofollow noopener" target="_blank">mypy</a> to help us slowly add static typing to our code base.</p><p>Usually before installing a new pre-commit hook, I make sure all files will pass the checks (and disable scanning of files that won’t). Some tools are pretty good at a slow upgrade if you so desire. One such tool for us as been <a href="https://interrogate.readthedocs.io/en/latest/" rel="nofollow noopener" target="_blank">interrogate</a>, which prompts people to add docstrings — I have it set up with a threshold so the files will pass. The output when pre-commit runs generates a report with red segments in it if there’s missing docstrings for some functions, even if the check passes so you don’t have to fix them. Sometimes that means someone working in that file will go ahead and fix those interrogate warnings while they’re working on their bugs, and that’s incredibly nice.</p><p>I’ll probably talk about some of these tools more later on in this <a href="https://curiousity.ca/category/best-practices/" rel="nofollow noopener" target="_blank">best practices in practice</a> series, but that should give you some hints of things you might run in pre-commit if you don’t already have your own list of code quality tools!</p><p><strong>Summary</strong></p><p>Pre-commit is a useful tool to help maintain code quality (and potentially security!) and it can be used to slowly improve over time. </p><p>I only found out about pre-commit because someone else told me and I’m happy to spread the word. I don’t think tools like pre-commit attract evangelists the way some other code-adjacent tools do, and it’s certainly not the sort of thing I learned about when I learned to code, when I got involved in opens source initially, or even when I was in university (which was long after I learned to code and got into open source). I’m sure it’s not the only tool in this category, but it’s the one I use and I like it enough that I haven’t felt a need to shop around for alternatives. I don’t know if it’s better for python than for other languages, but I love it enough that I could see myself contributing to make it work in other environments as needed, or finding similar tools now that I know this is an option.</p><p>As a project maintainer, I feel like it helps improve the experience both for new contributors who can use it to help guide them to submit code I’ll be able to merge, and for experienced contributors and mentors who then don’t have to spend as much time helping people get started and dealing with minor code nitpicks during code reviews. As an open source security researcher, I feel like it’s a pretty powerful tool to help improve code quality and security with easy feedback to developers before we even get to the manual code review stage. As a developer, I like that it helps me follow any project’s best practices and gives me feedback so I can fix things before another human even sees my code.</p><p>I hope other people will have similar good experiences with pre-commit! </p><p></p><p><a href="https://curiousity.ca/2024/best-practices-in-practice-pre-commit/" class="" rel="nofollow noopener" target="_blank">https://curiousity.ca/2024/best-practices-in-practice-pre-commit/</a></p><p><a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/bestpractices/" target="_blank">#BestPractices</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/bestpracticesinpractice/" target="_blank">#BestPracticesInPractice</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/infosec/" target="_blank">#infosec</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/opensource/" target="_blank">#OpenSource</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://curiousity.ca/tag/review/" target="_blank">#review</a></p>