There is now a PublicConVar class that automatically makes a ConVar public on instantiation and removes it from being public when the plugin that instantiated it is unloaded. Previously, make_public didn't actually make the ConVar public, it just added the NOTIFY flag. Now, we can actually make the ConVar public. To use it, simply create the ConVar as you would any other, but make sure it is in the global scope. This is one typical way in which I would think most people would use this class:
Syntax: Select all
from cvars.public import PublicConVar
from plugins.info import PluginInfo
info = PluginInfo()
info.name = '<Project Name>'
info.author = '<Your Name>'
info.version = '<Version Number>'
info.basename = '<Actual Name of the Plugin>'
info.variable = info.basename + '_version'
info.url = '<Link to Repository>'
info.convar = PublicConVar(
info.variable, info.version, 0, info.name + ' Version')
This doesn't only need to be used for the plugin's version variable, but any variable you wish to be seen publicly from your plugin.
We have also included a ConVar instance of sv_tags to directly interact with its value. You should use it like it is a set object:
Syntax: Select all
from cvars.tags import sv_tags
sv_tags.add('<some name>')
def unload():
sv_tags.remove('<some name>')