Skip to content

Commit ca0ca5d

Browse files
committed
Reorganize project following standard Python conventions
This commit relocates all of the Python source files into the `batchtools` package. This, along with appropriate modifications to `pyproject.toml`, mean that: - We now have an installable package. From within this directory, you can run `pip install .` to install the package on the local system. You can also install the package straight from the GitHub repository: pip install git+https://github.com/memalhot/python-batchtools - We install a runnable `batchtools` script. By setting `project.scripts` in `pyproject.toml`, we install a `batchtools` command when we install the package. This permits you to run the code by simply typing `batchtools` at the command line, just like any other command. You can run the script without installing it using the `uv run` command: uv run batchtools - We have a distributable package. Running `uv build` will produce a distributable Python package (both a `.tar.gz` file and a Python wheel [1]) in the `dist/` directory. This can be uploaded to PyPi using `uv publish`, or simply copied and installed somewhere using `pip`. [1]: https://pythonwheels.com/
1 parent 6a9f2e9 commit ca0ca5d

23 files changed

+59
-47
lines changed

batchtools/__init__.py

Whitespace-only changes.

batchtools.py renamed to batchtools/batchtools.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import argparse
22
import sys
33

4-
from basecommand import Command
5-
from basecommand import SubParserFactory
6-
from bj import ListJobsCommand
7-
from bd import DeleteJobsCommand
8-
from bl import LogsCommand
9-
from bp import PrintJobsCommand
10-
from bq import GpuQueuesCommand
11-
from br import CreateJobCommand
12-
from bps import ListPodsCommand
13-
from helpers import is_logged_in
4+
from .basecommand import Command
5+
from .basecommand import SubParserFactory
6+
from .bj import ListJobsCommand
7+
from .bd import DeleteJobsCommand
8+
from .bl import LogsCommand
9+
from .bp import PrintJobsCommand
10+
from .bq import GpuQueuesCommand
11+
from .br import CreateJobCommand
12+
from .bps import ListPodsCommand
13+
from .helpers import is_logged_in
1414

1515

1616
class BatchTools:

bd.py renamed to batchtools/bd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
import openshift_client as oc
88

9-
from basecommand import Command
10-
from basecommand import SubParserFactory
11-
from helpers import oc_delete
9+
from .basecommand import Command
10+
from .basecommand import SubParserFactory
11+
from .helpers import oc_delete
1212

1313

1414
class DeleteJobsCommandArgs(argparse.Namespace):

bj.py renamed to batchtools/bj.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55
import openshift_client as oc
66

7-
from basecommand import Command
7+
from .basecommand import Command
88

99

1010
class ListJobsCommand(Command):

bl.py renamed to batchtools/bl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import argparse
66
import openshift_client as oc
77

8-
from basecommand import Command
9-
from basecommand import SubParserFactory
10-
from helpers import pretty_print
8+
from .basecommand import Command
9+
from .basecommand import SubParserFactory
10+
from .helpers import pretty_print
1111

1212

1313
class LogsCommandArgs(argparse.Namespace):

bp.py renamed to batchtools/bp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import openshift_client as oc
88

9-
from basecommand import Command
10-
from basecommand import SubParserFactory
9+
from .basecommand import Command
10+
from .basecommand import SubParserFactory
1111

1212

1313
class PrintJobsCommandArgs(argparse.Namespace):

bps.py renamed to batchtools/bps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import argparse
77
import openshift_client as oc
88

9-
from basecommand import Command
10-
from basecommand import SubParserFactory
9+
from .basecommand import Command
10+
from .basecommand import SubParserFactory
1111

1212

1313
class ListPodsCommandArgs(argparse.Namespace):

bq.py renamed to batchtools/bq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import openshift_client as oc
77

8-
from basecommand import Command
8+
from .basecommand import Command
99

1010

1111
class GpuQueuesCommand(Command):

br.py renamed to batchtools/br.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
import openshift_client as oc
1313

14-
from basecommand import Command
15-
from basecommand import SubParserFactory
16-
from build_yaml import build_job_body
17-
from helpers import pretty_print
18-
from helpers import oc_delete
19-
from file_setup import prepare_context
14+
from .basecommand import Command
15+
from .basecommand import SubParserFactory
16+
from .build_yaml import build_job_body
17+
from .helpers import pretty_print
18+
from .helpers import oc_delete
19+
from .file_setup import prepare_context
2020

2121

2222
class CreateJobCommandArgs(argparse.Namespace):

0 commit comments

Comments
 (0)