diff --git a/pyproject.toml b/pyproject.toml index cc4bdf0b..26d04b0f 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,7 +105,6 @@ classifiers = [ # Optional # https://packaging.python.org/discussions/install-requires-vs-requirements/ dependencies = [ # Optional "more-itertools", - "semantic-version", "ruamel.yaml", ] @@ -149,7 +148,7 @@ sunbeam = "sunbeamlib.scripts.command:main" [tool.setuptools] # If there are data files included in your packages that need to be # installed, specify them here. -package-data = {"sunbeamlib" = ["src/sunbeamlib/data/*.yml", "src/sunbeamlib/data/*.yaml"]} +package-data = {"sunbeamlib" = ["*.yml", "*.yaml"]} [build-system] # These are the assumed default build requirements from pip: @@ -158,9 +157,8 @@ requires = ["setuptools>=61.0.0", "wheel"] build-backend = "setuptools.build_meta" #[tool.setuptools.packages.find] -#where = ["src/sunbeamlib"] +#where = ["src/"] # include = ["pkg*"] # alternatively: `exclude = ["additional*"]` -#exclude = ["src/sunbeamlib/data"] #namespaces = false [tool.setuptools.dynamic] diff --git a/src/sunbeamlib/__init__.py b/src/sunbeamlib/__init__.py index 277ce17d..e2eecae4 100755 --- a/src/sunbeamlib/__init__.py +++ b/src/sunbeamlib/__init__.py @@ -8,10 +8,30 @@ from pathlib import Path -from semantic_version import Version from sunbeamlib.parse import parse_fasta -__version__ = str(Version.coerce(os.environ.get("SUNBEAM_VER", "0.0.0"))) +class Version(): + def __init__(self, version: str) -> None: + self.version = version + if self.version.startswith("v"): + self.version = self.version[1:] + + version_parts = self.version.split(".") + self.major = version_parts[0] + try: + self.minor = version_parts[1] + except IndexError: + self.minor = 0 + try: + self.patch = version_parts[2] + except IndexError: + self.patch = 0 + + def __str__(self) -> str: + return f"{self.major}.{self.minor}.{self.patch}" + + +__version__ = str(Version(os.environ.get("SUNBEAM_VER", "0.0.0"))) def load_sample_list(samplelist_fp, paired_end=True, root_proj=""): diff --git a/src/sunbeamlib/scripts/command.py b/src/sunbeamlib/command.py similarity index 84% rename from src/sunbeamlib/scripts/command.py rename to src/sunbeamlib/command.py index ef59e01b..bb8a989c 100644 --- a/src/sunbeamlib/scripts/command.py +++ b/src/sunbeamlib/command.py @@ -1,11 +1,11 @@ import sys import argparse import sunbeamlib -from sunbeamlib.scripts.run import main as Run -from sunbeamlib.scripts.init import main as Init -from sunbeamlib.scripts._config import main as Config -from sunbeamlib.scripts.list_samples import main as ListSamples -from sunbeamlib.scripts.extend import main as Extend +from sunbeamlib.script_run import main as Run +from sunbeamlib.script_init import main as Init +from sunbeamlib.script_config import main as Config +from sunbeamlib.script_list_samples import main as ListSamples +from sunbeamlib.script_extend import main as Extend def main(): diff --git a/src/sunbeamlib/config.py b/src/sunbeamlib/config.py index bca8dd6d..4c19d280 100644 --- a/src/sunbeamlib/config.py +++ b/src/sunbeamlib/config.py @@ -1,12 +1,11 @@ import os +import ruamel.yaml import sys from collections.abc import Mapping from pathlib import Path from pkg_resources import resource_stream -from semantic_version import Version -import ruamel.yaml -from sunbeamlib import __version__ +from sunbeamlib import __version__, Version def makepath(path): diff --git a/src/sunbeamlib/data/default_config.yml b/src/sunbeamlib/default_config.yml similarity index 100% rename from src/sunbeamlib/data/default_config.yml rename to src/sunbeamlib/default_config.yml diff --git a/src/sunbeamlib/data/default_profile.yaml b/src/sunbeamlib/default_profile.yaml similarity index 100% rename from src/sunbeamlib/data/default_profile.yaml rename to src/sunbeamlib/default_profile.yaml diff --git a/src/sunbeamlib/data/microb120.yml b/src/sunbeamlib/microb120.yml similarity index 100% rename from src/sunbeamlib/data/microb120.yml rename to src/sunbeamlib/microb120.yml diff --git a/src/sunbeamlib/data/pmacs.yml b/src/sunbeamlib/pmacs.yml similarity index 100% rename from src/sunbeamlib/data/pmacs.yml rename to src/sunbeamlib/pmacs.yml diff --git a/src/sunbeamlib/scripts/_config.py b/src/sunbeamlib/script_config.py similarity index 100% rename from src/sunbeamlib/scripts/_config.py rename to src/sunbeamlib/script_config.py diff --git a/src/sunbeamlib/scripts/extend.py b/src/sunbeamlib/script_extend.py similarity index 100% rename from src/sunbeamlib/scripts/extend.py rename to src/sunbeamlib/script_extend.py diff --git a/src/sunbeamlib/scripts/init.py b/src/sunbeamlib/script_init.py similarity index 99% rename from src/sunbeamlib/scripts/init.py rename to src/sunbeamlib/script_init.py index b78df2eb..f6715996 100644 --- a/src/sunbeamlib/scripts/init.py +++ b/src/sunbeamlib/script_init.py @@ -5,7 +5,7 @@ import ruamel.yaml from pathlib import Path -from .list_samples import ( +from sunbeamlib.script_list_samples import ( build_sample_list, MissingMatePairError, SampleFormatError, diff --git a/src/sunbeamlib/scripts/list_samples.py b/src/sunbeamlib/script_list_samples.py similarity index 100% rename from src/sunbeamlib/scripts/list_samples.py rename to src/sunbeamlib/script_list_samples.py diff --git a/src/sunbeamlib/scripts/run.py b/src/sunbeamlib/script_run.py similarity index 100% rename from src/sunbeamlib/scripts/run.py rename to src/sunbeamlib/script_run.py diff --git a/src/sunbeamlib/scripts/__init__.py b/src/sunbeamlib/scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/sunbeamlib/data/slurm_profile.yaml b/src/sunbeamlib/slurm_profile.yaml similarity index 100% rename from src/sunbeamlib/data/slurm_profile.yaml rename to src/sunbeamlib/slurm_profile.yaml diff --git a/src/sunbeamlib/data/tibanna_profile.yaml b/src/sunbeamlib/tibanna_profile.yaml similarity index 100% rename from src/sunbeamlib/data/tibanna_profile.yaml rename to src/sunbeamlib/tibanna_profile.yaml