A revisit for this topic is available in: Revisited: Version Numbering in Python Package After written the short Python package post I realized that the version number (actually string but anyway) of the package is now in two different places: in the package code (__init__.py) and in the package install metadata (setup.py). Obviously that’s not […]
Tag: python
Creating a Python Package, the Cruel Way
This is how you can create a package of Python code so that you can use the module in various projects. Let’s assume this is the code your module has: STUFF_VERSION = “1.1-dev” def get_stuff(): return “This is stuff. Use it wisely.” Of course the module can be much more complicated with various functions and […]
Configuration File Parsing in Python
Example of configuration file parsing in Python: With the configuration file configtest.cfg: Example output: More information: https://docs.python.org/3/library/configparser.html Also available in GitHub: https://github.com/markkuleinio/python-config-parsing
Logging in Python
Example of configuring logging in Python: Output: More information: https://docs.python.org/3/library/logging.html
Argument Parsing in Python
Example of command line argument parsing in Python: Output: More information: https://docs.python.org/3/library/argparse.html Also available in GitHub: https://github.com/markkuleinio/python-argument-parsing
Enabling Python Syntax Coloring and Indenting in Vim
Put these in your .vimrc to enable for example Python syntax coloring and indenting in Vim: syntax on filetype indent plugin on