How do I use Jenkins to maintain versioning on a Python project?
If you follow Semantic Versioning you could achieve this as a step in the pipeline using Semantic Release.
This and the original tool it's based on are designed for automated releases as part of a continuous integration and delivery pipeline. From the docs:

The key point with using this package is to automate your releases and stop worrying about version numbers. Different approaches to automatic releases and publishing with the help of this package can be found below. Using a CI is the recommended approach.

In your case the workflow would be to do all the testing in pull request, and then when they are merged, a step in the develop branch would run semantic-release publish. Again, referencing the docs, this does the following actions:

Publish will do a sequence of things:

Run semantic-release version.
Push changes to git.
Run build_command and upload the created files to PyPI.
Run semantic-release changelog and post to your vcs provider.
Attach the files created by build_command to GitHub releases.


Part of the benefit of having this included in the pipeline is maintaining a clear and consistent changelog, with the help of a commit message linter like committizen.