question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vermin configuration file

See original GitHub issue

Many tools support loading configuration from config files in addition to command line arguments (e.g. flake8, mypy, pytest). It would be good if vermin can also do this. In some sense, declaring project configuration in a config file is more clear and discoverable than saving command line arguments in a script or Makefile, and is much better than typing out the command line arguments manually in the long term.

Proposed config file name and format

  • Many tools have chosen the INI format, and put all configuration items in one specific section. For vermin the file name could be vermin.ini and the section name could be vermin.
  • Tools tend to look for multiple files to find configuration (e.g. toolname.ini, setup.cfg, tox.ini and such). This allows a project to put configuration for different tools in different sections in a single file like setup.cfg. For vermin, it is a good start to only look at vermin.ini, and this may be extended in the future.
  • Tools may look for a config file in the “containing directory” of processed files and the parent directories. For vermin, to simplify, it is a good start to only look at the current working directory (assuming users are running vermin in project root), and this may be extended in the future.

Here is a sample vermin.ini:

[vermin]
# declaring minimum compatible version in a config file is good
target = 3.4

# key names in the INI file can be the same as the "long form" argument name in CLI
exclude = foo.bar.baz
backport = argparse,typing

# alternative way to express arrays:
backport =
    argparse
    typing
# this is supported by flake8 and pytest, not sure how INI format handles arrays

feature = fstring-self-doc

Configuration priority

  • When using CLI, manually passed command line arguments override the items in the config file
  • When using the Python API, we may have two options:
    • Don’t read the config file at all
    • Manually passed config objects override the items in the config file (Does it make sense to look for a config file in the current working directory? We’re passing code strings and not dealing with any files.)

Finally, it could be good to print a verbose message like “loading configuration from file …” when a configuration file is discovered and used. This will let users know that a config file is in effect and help them diagnose configuration problems.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
gousaiyangcommented, Nov 27, 2020

Looks good

1reaction
gousaiyangcommented, Nov 20, 2020

Oh for the --exclude-file parameter, I’ve misunderstood its meaning. I thought it is excluding certain files from analysis rather than reading --exclude args from a file (instead of from CLI). Excluding certain files from analysis could be useful to some extent, if a project has some files with .py extension which are test cases (data) for static analysis rather than code to be executed.

As for vermin.ini detection in subfolders, I thinks it’s fine not to check all subfolders based on file paths specified in sys.argv. The user can easily specify the config file in the subfolder via --config-file, or simply do a chdir before executing vermin. And it’s fine to only recognize one config file instead of allowing multiple config files (and the one in the subfolder overrides the one in the root folder). Otherwise the design would be complicated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

netromdk/vermin: Concurrently detect the minimum ... - GitHub
Configuration File. Vermin automatically tries to detect a config file, starting in the current working directory where it is run, following parent folders ......
Read more >
Vermin Hunter - PCGamingWiki PCGW
↑ File/folder structure within this directory reflects the path(s) listed for Windows and/or Steam game data (use Wine regedit to access ...
Read more >
Using vermin to manage your own VMs - Mohammed Hewedy
You need to configure the VM so we can run ansible-playbook against it to make it vermin-ready. Obtain the IP address of the...
Read more >
Vermin
Vermin is a smart, simple and powerful command line tool for Linux, Windows and macOS. It's designed for developers who want a fresh...
Read more >
How to use the vermin.main function in vermin - Snyk
To help you get started, we've selected a few vermin.main examples, based on popular ways it is used in public projects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found