From 177c49037fae64a182548d2b7d65432938dc71fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ma=C3=ABl=20Madon?= <mael.madon@irit.fr>
Date: Thu, 13 Apr 2023 22:32:33 +0200
Subject: [PATCH] rename to make tests work. Explain new install in README

---
 README.md                                     | 23 ++++++++++++++++---
 pyproject.toml                                |  2 +-
 .../{swf2userSessions.py => swf2sessions.py}  |  2 +-
 test/conftest.py                              |  2 +-
 4 files changed, 23 insertions(+), 6 deletions(-)
 rename swf2userSessions/{swf2userSessions.py => swf2sessions.py} (99%)

diff --git a/README.md b/README.md
index 7920c2a..474c565 100644
--- a/README.md
+++ b/README.md
@@ -14,19 +14,36 @@ The idea behind it is to keep the *logic* of user submissions rather than the ex
 
 
 
-## Usage
+## Installation
+Installation with `pip` without cloning:
+```terminal
+pip install git+https://gitlab.irit.fr/sepia-pub/mael/swf2userSessions
+```
+
+Clone and install with `flit`:
+```terminal
+git clone https://gitlab.irit.fr/sepia-pub/mael/swf2userSessions
+cd swf2userSessions
+flit install
+```
+
+You can then run the app from CLI by simply calling `swf2userSessions`.
+
+You can also clone the repository and directly execute the main script `python3 swf2userSessions/swf2sessions.py`.
+
 Requirements:
 - python3
 - [networkx](https://github.com/networkx/networkx) (optional, for the graph outputs): `pip3 install networkx`
 - [pytest](https://pytest.org/) (optional, for the tests): `pip3 install pytest`
 
+## Usage
 To run the session decomposition on the workload `workloads/example.swf` illustrated above, with "Arrival" delimitation approach and a threshold of 60 minutes:
 
 ```terminal
-python3 swf2userSessions.py -a 60 workloads/example.swf out/
+swf2userSessions -a 60 workloads/example.swf out/
 ```
 
-For more documentation, see: `python3 swf2userSessions.py -h`
+For more documentation, see: `swf2userSessions -h`
 
 
 ## Example
diff --git a/pyproject.toml b/pyproject.toml
index 75fbea1..22233ec 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -18,4 +18,4 @@ classifiers = [
 ]
 
 [project.scripts]
-swf2userSessions = "swf2userSessions.swf2userSessions:parse_from_cli"
\ No newline at end of file
+swf2userSessions = "swf2userSessions.swf2sessions:parse_from_cli"
\ No newline at end of file
diff --git a/swf2userSessions/swf2userSessions.py b/swf2userSessions/swf2sessions.py
similarity index 99%
rename from swf2userSessions/swf2userSessions.py
rename to swf2userSessions/swf2sessions.py
index 53486b2..a909109 100755
--- a/swf2userSessions/swf2userSessions.py
+++ b/swf2userSessions/swf2sessions.py
@@ -232,4 +232,4 @@ def parse_from_cli():
 
 
 if __name__ == "__main__":
-    main()
\ No newline at end of file
+    parse_from_cli()
\ No newline at end of file
diff --git a/test/conftest.py b/test/conftest.py
index e844f1a..b074361 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -30,7 +30,7 @@ def run_script(delim, threshold,
     out_dir = os.path.abspath(f'test-out/{test_name}')
     create_dir_rec_if_needed(out_dir)
 
-    args = ['python3', 'swf2userSessions.py', f'--{delim}', str(threshold), 
+    args = ['python3', 'swf2userSessions/swf2sessions.py', f'--{delim}', str(threshold), 
             '-q', input_swf, out_dir]
     if graph:
         args.append("--graph")
-- 
GitLab