Skip to content

Commit

Permalink
Flatten sunbeamlib dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulthran committed Oct 5, 2023
1 parent dd1188f commit 197119d
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 15 deletions.
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ classifiers = [ # Optional
# https://packaging.python.org/discussions/install-requires-vs-requirements/
dependencies = [ # Optional
"more-itertools",
"semantic-version",
"ruamel.yaml",
]

Expand Down Expand Up @@ -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:
Expand All @@ -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]
Expand Down
24 changes: 22 additions & 2 deletions src/sunbeamlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""):
Expand Down
10 changes: 5 additions & 5 deletions src/sunbeamlib/scripts/command.py → src/sunbeamlib/command.py
Original file line number Diff line number Diff line change
@@ -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():
Expand Down
5 changes: 2 additions & 3 deletions src/sunbeamlib/config.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
File renamed without changes.
File renamed without changes.
Empty file removed src/sunbeamlib/scripts/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.

0 comments on commit 197119d

Please sign in to comment.