Skip to content

Commit

Permalink
add defensefinder version
Browse files Browse the repository at this point in the history
  • Loading branch information
jcury committed Apr 11, 2024
1 parent 5f3230f commit 9a88433
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ A [Github action](https://github.com/mdmparis/defense-finder/actions) is setup t
Note that you don't need to publish defense-finder everytime the models change: only changes in this repository are relevant.

Here are the steps to follow in order to publish defense-finder:
- find the current version in the `setup` function of `setup.py`.
- find the current version in `defense_finder_cli/_version.py`
- get a new version number according to [semantic versionning](https://semver.org/)
- update the version un `setup.py`
- update the version un `defense_finder_cli/_version.py`
- commit this change, and tag the commit with `git tag -a v<your version number> -m '<your version number> <an optional message>'`
- push your commits to master
- run `git push origin v<your version>` to sync the tags
Expand Down
1 change: 1 addition & 0 deletions defense_finder_cli/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.2.2"
13 changes: 10 additions & 3 deletions defense_finder_cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
except AttributeError:
logging = colorlog.wrappers.logging

from ._version import __version__

@click.group(context_settings=dict(help_option_names=["-h", "--help"]))
def cli():
Expand All @@ -32,6 +33,12 @@ def cli():
"""
pass

@cli.command()
def version():
"""Get the version of DefenseFinder (software)
"""
print(f"Using DefenseFinder version {__version__}")


@cli.command()
@click.option('--models-dir', 'models_dir', required=False, help='Specify a directory containing your models.')
Expand Down Expand Up @@ -68,8 +75,6 @@ def update(models_dir=None, force_reinstall: bool = False):
@click.option('--log-level', 'loglevel', default="INFO",
help='set the logging level among DEBUG, [INFO], WARNING, ERROR, CRITICAL')
@click.option('--index-dir', 'index_dir', required=False, help='Specify a directory to write the index files required by macsyfinder when the input file is in a read-only folder')


def run(file: str, outdir: str, dbtype: str, workers: int, coverage: float, preserve_raw: bool,
no_cut_ga: bool, models_dir: str = None, loglevel : str = "INFO",
index_dir: str = None):
Expand Down Expand Up @@ -146,7 +151,7 @@ def run(file: str, outdir: str, dbtype: str, workers: int, coverage: float, pres
else:
protein_file_name = filename

logger.info("Running DefenseFinder")
logger.info(f"Running DefenseFinder version {__version__}")
defense_finder.run(protein_file_name, dbtype, workers, coverage, tmp_dir, models_dir, no_cut_ga, loglevel, index_dir)
logger.info("Post-treatment of the data")
defense_finder_posttreat.run(tmp_dir, outdir, os.path.splitext(os.path.basename(filename))[0])
Expand All @@ -168,6 +173,8 @@ def run(file: str, outdir: str, dbtype: str, workers: int, coverage: float, pres
Tesson F., Hervé A. , Mordret E., Touchon M., d’Humières C., Cury J., Bernheim A., 2022, Nature Communication
Systematic and quantitative view of the antiviral arsenal of prokaryotes
Using DefenseFinder version {__version__}.
DefenseFinder relies on MacSyFinder :
{get_version_message().split("and don't")[0]}
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ def read_md(f):
def read_req(req: str):
return [i for i in [l.strip() for l in open(req).read().split('\n')] if i]

exec(open('defense_finder_cli/_version.py').read())

setup(name='mdmparis-defense-finder',
version='1.2.2',
version=__version__, # from 'defense_finder_cli/_version.py'
description="Defense Finder: allow for a systematic search of all known anti-phage systems.",
long_description=read_md('README.md'),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 9a88433

Please sign in to comment.