From 02305427ca79584c6e641df7872ea5d1469b517f Mon Sep 17 00:00:00 2001
From: Larissa Glass <larissa.glass@unibas.ch>
Date: Tue, 8 Nov 2022 16:14:49 +0000
Subject: [PATCH] Resolve: Hotfix package installation

---
 README.md       |  8 ++------
 pyproject.toml  | 21 +++++++++++++++++++++
 setup.py        | 18 ------------------
 tsg/__init__.py |  1 -
 tsg/__main__.py |  4 ++++
 tsg/cli.py      |  8 ++------
 6 files changed, 29 insertions(+), 31 deletions(-)
 create mode 100644 pyproject.toml
 delete mode 100644 setup.py
 create mode 100644 tsg/__main__.py

diff --git a/README.md b/README.md
index d29a0a8..2d8c3ba 100644
--- a/README.md
+++ b/README.md
@@ -27,15 +27,11 @@ To install package, run
 pip install .
 ```
 
-Afterwards, it can be imported using
+To generate the sampled transcripts, open a new shell, activate your environment and run
 
-```python
-import tsg
 ```
+conda activate transcript-structure-generator
 
-To generate the sampled transcripts, run
-
-```
 transcript-generator --transcripts <transcripts_file> --annotation <annotations_file> --prob_inclusion=<probability_inclusion>
 ```
 
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..ed805ec
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,21 @@
+[project]
+name = "tsg"
+version = "0.1.0"
+authors = [
+  { name="Michael Zimmermann", email="michael.zimmermann@unibas.ch" },
+  { name="Andri Fraenkl", email="andri.fraenkl@unibas.ch" },
+  { name="Larissa Glass", email="larissa.glass@unibas.ch" },
+]
+description = "Transcript Structure Generator"
+readme = "README.md"
+requires-python = ">=3.7"
+license = {text = "MIT"}
+dependencies = [
+    "pandas",
+]
+
+[project.urls]
+"Homepage" = "https://git.scicore.unibas.ch/zavolan_group/tools/transcript-structure-generator"
+
+[project.scripts]
+transcript-generator = "tsg.cli:app"
\ No newline at end of file
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 3352b1f..0000000
--- a/setup.py
+++ /dev/null
@@ -1,18 +0,0 @@
-"""Setup the package."""
-
-from setuptools import setup
-
-setup(
-    name='tsg',
-    author='Zimmermann, M; Fraenkl, A;Glass, L',
-    url='https://git.scicore.unibas.ch/zavolan_group/tools/transcript-structure-generator',
-    license='MIT',
-    version='0.0.1',
-    packages=['tsg'],
-    install_requires=['pandas'],
-    entry_points={
-        'console_scripts': [
-            'transcript-generator = tsg:cli',
-        ]
-    }
-)
diff --git a/tsg/__init__.py b/tsg/__init__.py
index b9b9505..229aaf5 100644
--- a/tsg/__init__.py
+++ b/tsg/__init__.py
@@ -1,5 +1,4 @@
 """Transcript structure generator package."""
 
-from tsg.cli import cli
 
 __version__ = '0.0.0'
diff --git a/tsg/__main__.py b/tsg/__main__.py
new file mode 100644
index 0000000..cd76d30
--- /dev/null
+++ b/tsg/__main__.py
@@ -0,0 +1,4 @@
+from tsg.cli import app
+
+if __name__ == "__main__":
+    app()
\ No newline at end of file
diff --git a/tsg/cli.py b/tsg/cli.py
index 72da7ba..29de297 100644
--- a/tsg/cli.py
+++ b/tsg/cli.py
@@ -2,7 +2,7 @@ import argparse
 import logging
 from pathlib import Path
 
-from .main import sample_transcripts
+from tsg.main import sample_transcripts
 
 
 def setup_logging(loglevel: str=None) -> None:
@@ -40,7 +40,7 @@ def output_filename(filename: str) -> str:
         return "generated_" + filepath.name
 
 
-def cli():
+def app():
     args = get_args()
 
     setup_logging(args.log)
@@ -51,7 +51,3 @@ def cli():
         output_filename(args.transcripts),
         output_filename(args.annotation),
     )
-
-
-if __name__ == "__main__":
-    cli()
-- 
GitLab