class: center, middle # We are still bad at versioning a ☇ talk pygraz, meisterluk, 2018/03/06 --- # Hey, I want to implement X. How? Use python! ``` user@shell ~ % python Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print "Hello World" File "
", line 1 print "Hello World" ^ SyntaxError: Missing parentheses in call to 'print' >>> ``` We (people in IT) are not beginners-friendly. --- # What is the problem? Version management. --- # Fact: Py3k was backwards-incompatible Why? - long versus int - unicode mess - relative imports - int vs float division - nonlocal variables - ... via Guido's PyCascades slides (Jan 2018) > Not all warts could be fixed without breaking compatibility > > esp. the unicode mess --- # Question: Is this okay? Should software change? If it changes, what changes? - TeX: frozen and converging towards 𝛑 - pretty much every other software: new features, refactoring, improvements, security patches. I personally advocate, that software _changes_ over time. If there is a need for this software, it will improve and **refactoring** and **patching** is an essential part of the development. --- # Claim: Version numbers are good If software changes, the version number changes. Example `requirements.txt`: ``` et-xmlfile==1.0.1 jdcal==1.3 openpyxl==2.4.9 pytest==3.2.3 ruamel.yaml<=0.15 ``` Yay, version numbers! Wait... does it require python 2.7 or python 3.5? Maybe setup.py will tell you: ``` classifiers=['Programming Language :: Python :: 3'] ``` --- # My point today - if the software behavior changes, the identifier changes * TeX uses name as identifier - everything okay! - but TeX did not evolve and few forks - maybe not a good example * identifier for every other software: 1. name 2. version number --- # Fact: Semantic Versioning exists Release 1.5.2 - MAJOR version when you make incompatible API changes - MINOR version when you add functionality in a backwards-compatible manner - PATCH version when you make backwards-compatible bug fixes MAJOR=1 MINOR=5 PATCH=2 Non-chronological. https://semver.org/ --- # Best approach? Rolling releases? Timestamp as version number? Desired as developer: - dependencies never change (even for security fixes, they might break something) - publish it to a centralised host - it is easy to publish a new version Desired as sysadmin: - all software is kept up2date - retrieval from decentralised/many hosts - it is easy to deploy an arbitrary version For both: - Easy migration from creator to creator, distributor to distributor, hoster to hoster In general: We need reproducible builds. We need origin integrity. Both are widely adopted today. Thanks! Semantic versioning does not all problems. But it helps. --- # Fact: go is starting to advocate Semantic Versioning Rationale by Russ Cox: https://research.swtch.com/vgo Introducing a `mod.go` file: ``` module "github.com/you/hello" require "rsc.io/quote" v1.5.2 ``` --- # Fact: we ignore versioning Python was designed in 1991. `requirements.txt` was invented much later. Semantic versioning appeared much later. Go was designed in **2009**. Go could have done better from the beginning. No lessons learned. --- # Issue 1: On UNIX commands are called by name, not (name, version) We still say `python`. Is it `python3` oder `python`? ``` #!/usr/bin/env python ``` or ``` #!/usr/bin/env python3 ``` Specify! --- # Issue 2: ALWAYS think about the version Do I import the correct version of the library? Did I pick the correct version number for this release? Provide executables with version numbers in the name. Embed a version number when designing a network protocol. Or simply, in any protocol. --- # Will we become beginners-friendly? ~~I learned to program in python~~. I learned to program in python 3. At least, the previous issue won't happen again. --- # Homework - Guido van Rossum: [BDFL Python 3 retrospective](https://www.youtube.com/watch?v=Oiw23yfqQy8) - Read [semver.org](https://semver.org/) - Advocate 'think of the version number' --- # Cheers Thank you!
Slides version 1.0.2