Skip to content

Commit 837d97a

Browse files
authored
Merge pull request #418 from nsoranzo/ci_improvements
CI improvements and type annotations
2 parents bb001ea + 649fd04 commit 837d97a

File tree

11 files changed

+71
-47
lines changed

11 files changed

+71
-47
lines changed

.github/workflows/deploy.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v5
8+
with:
9+
persist-credentials: false
810
- uses: actions/setup-python@v6
911
with:
10-
python-version: '3.13'
12+
python-version: '3.14'
13+
cache: pip
1114
- name: Install requirements
1215
run: |
1316
python3 -m pip install build twine

.github/workflows/galaxy_framework.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,21 @@ jobs:
2828
- uses: actions/checkout@v5
2929
with:
3030
path: 'pulsar'
31+
persist-credentials: false
3132
- name: Checkout tools repo
3233
uses: actions/checkout@v5
3334
with:
3435
repository: galaxyproject/galaxy
3536
ref: ${{ matrix.galaxy-branch }}
3637
path: galaxy
38+
persist-credentials: false
3739
- uses: actions/setup-python@v6
3840
with:
3941
python-version: ${{ matrix.python-version }}
42+
cache: pip
4043
- name: Build Pulsar wheel and replace Galaxy's requirements.
4144
run: python tools/replace_galaxy_requirements_for_ci.py
4245
working-directory: 'pulsar'
43-
- name: Cache pip dir
44-
uses: actions/cache@v4
45-
with:
46-
path: ~/.cache/pip
47-
key: pip-cache-${{ matrix.python-version }}-${{ hashFiles('galaxy/requirements.txt') }}
4846
- name: Run tests
4947
run: ./run_tests.sh --framework
5048
working-directory: 'galaxy'

.github/workflows/pulsar.yaml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,38 @@ jobs:
66
runs-on: ubuntu-22.04
77
strategy:
88
matrix:
9-
tox-env: [py37-lint, py37-docs]
9+
python-version: ['3.7']
10+
tox-env: [lint, docs]
11+
include:
12+
- python-version: '3.14'
13+
tox-env: lint
1014
steps:
1115
- uses: actions/checkout@v5
16+
with:
17+
persist-credentials: false
1218
- uses: actions/setup-python@v6
1319
with:
14-
python-version: '3.7'
20+
python-version: ${{ matrix.python-version }}
21+
cache: pip
1522
- name: Install tox
1623
run: pip install tox
1724
- name: Run lint
1825
run: tox -e ${{ matrix.tox-env }}
1926
mypy:
2027
name: MyPy
21-
runs-on: ubuntu-22.04
28+
runs-on: ubuntu-latest
2229
strategy:
2330
matrix:
24-
include:
25-
- tox-env: py311-mypy
26-
python: '3.11'
31+
tox-env: [mypy]
32+
python-version: ['3.14']
2733
steps:
2834
- uses: actions/checkout@v5
35+
with:
36+
persist-credentials: false
2937
- uses: actions/setup-python@v6
3038
with:
31-
python-version: ${{ matrix.python }}
39+
python-version: ${{ matrix.python-version }}
40+
cache: pip
3241
- name: Install tox
3342
run: pip install tox
3443
- name: Setup pycurl
@@ -40,17 +49,11 @@ jobs:
4049
runs-on: ubuntu-22.04
4150
strategy:
4251
matrix:
52+
tox-env: [test-ci, test-unit]
53+
python-version: ['3.7', '3.11']
4354
include:
44-
- tox-env: py37-test-ci
45-
python: '3.7'
46-
- tox-env: py37-test-unit
47-
python: '3.7'
48-
- tox-env: py311-test-ci
49-
python: '3.11'
50-
- tox-env: py311-test-unit
51-
python: '3.11'
52-
- tox-env: py39-install_wheel
53-
python: '3.9'
55+
- tox-env: install_wheel
56+
python-version: '3.9'
5457
services:
5558
job-files:
5659
image: galaxy/simple-job-files:latest
@@ -62,9 +65,12 @@ jobs:
6265
- '/tmp:/tmp:rw'
6366
steps:
6467
- uses: actions/checkout@v5
68+
with:
69+
persist-credentials: false
6570
- uses: actions/setup-python@v6
6671
with:
67-
python-version: ${{ matrix.python }}
72+
python-version: ${{ matrix.python-version }}
73+
cache: pip
6874
- name: Install tox
6975
run: pip install tox
7076
- name: Run setup
@@ -84,13 +90,16 @@ jobs:
8490
# strategy:
8591
# matrix:
8692
# include:
87-
# - tox-env: py37-test-funnel
88-
# python: 3.7
93+
# - tox-env: test-funnel
94+
# python-version: 3.7
8995
# steps:
9096
# - uses: actions/checkout@v5
97+
# with:
98+
# persist-credentials: false
9199
# - uses: actions/setup-python@v6
92100
# with:
93-
# python-version: ${{ matrix.python }}
101+
# python-version: ${{ matrix.python-version }}
102+
# cache: pip
94103
# - name: Set up Go 1.x
95104
# uses: actions/setup-go@v2
96105
# with:

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sphinxcontrib-apidoc
2323
pyflakes
2424
flake8
2525

26-
mypy<=1.0.1 # https://github.com/pydantic/pydantic/issues/5192
26+
mypy
2727
types-paramiko
2828
types-setuptools
2929
types-PyYAML

mypy.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[mypy]
2+
plugins = pydantic.mypy
23
show_error_codes = True
34
pretty = True
45

pulsar/client/staging/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
exists,
88
join,
99
)
10+
from typing import (
11+
TYPE_CHECKING,
12+
Union,
13+
)
1014

1115
from galaxy.util.bunch import Bunch
1216

1317
from ..util import PathHelper
1418

19+
if TYPE_CHECKING:
20+
from galaxy.tool_util.parser.interface import RequiredFiles
21+
1522
COMMAND_VERSION_FILENAME = "COMMAND_VERSION"
1623
DEFAULT_DYNAMIC_COLLECTION_PATTERN = [
1724
"|".join(
@@ -51,6 +58,8 @@ class ClientJobDescription:
5158
command_line : str
5259
The local command line to execute, this will be rewritten for
5360
the remote server.
61+
tool :
62+
The Galaxy tool to execute.
5463
config_files : list
5564
List of Galaxy 'configfile's produced for this job. These will
5665
be rewritten and sent to remote server.
@@ -60,9 +69,6 @@ class ClientJobDescription:
6069
client_outputs : ClientOutputs
6170
Description of outputs produced by job (at least output files along
6271
with optional version string and working directory outputs.
63-
tool_dir : str
64-
Directory containing tool to execute (if a wrapper is used, it will
65-
be transferred to remote server).
6672
working_directory : str
6773
Local path created by Galaxy for running this job (job_wrapper.tool_working_directory).
6874
metadata_directory : str
@@ -72,8 +78,6 @@ class ClientJobDescription:
7278
tool dependency context for remote depenency resolution.
7379
env: list
7480
List of dict object describing environment variables to populate.
75-
version_file : str
76-
Path to version file expected on the client server
7781
arbitrary_files : dict()
7882
Additional non-input, non-tool, non-config, non-working directory files
7983
to transfer before staging job. This is most likely data indices but
@@ -99,7 +103,7 @@ def __init__(
99103
env=[],
100104
arbitrary_files=None,
101105
job_directory_files=None,
102-
tool_directory_required_files=None,
106+
tool_directory_required_files: Union["RequiredFiles", None] = None,
103107
rewrite_paths=True,
104108
touch_outputs=None,
105109
container=None,

pulsar/client/staging/up.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
escape,
1515
findall,
1616
)
17-
from typing import Optional
17+
from typing import (
18+
Optional,
19+
TYPE_CHECKING,
20+
)
1821

1922
from ..action_mapper import (
2023
FileActionMapper,
@@ -32,10 +35,13 @@
3235
PathHelper,
3336
)
3437

38+
if TYPE_CHECKING:
39+
from ..staging import ClientJobDescription
40+
3541
log = getLogger(__name__)
3642

3743

38-
def submit_job(client, client_job_description, job_config=None):
44+
def submit_job(client, client_job_description: "ClientJobDescription", job_config=None):
3945
"""
4046
"""
4147
file_stager = FileStager(client, client_job_description, job_config)
@@ -99,7 +105,7 @@ class FileStager:
99105
Description of client view of job to stage and execute remotely.
100106
"""
101107

102-
def __init__(self, client, client_job_description, job_config):
108+
def __init__(self, client, client_job_description: "ClientJobDescription", job_config):
103109
"""
104110
"""
105111
self.client = client

pulsar/tools/toolbox.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
dirname,
55
join,
66
)
7+
from typing import (
8+
List,
9+
Union,
10+
)
711
from xml.etree import ElementTree
812

913
from pulsar.tools.validator import ExpressionValidator
@@ -19,8 +23,8 @@ class ToolBox:
1923
to support simple, non-toolshed based tool setups.
2024
"""
2125

22-
def __init__(self, path_string):
23-
self.tool_configs = []
26+
def __init__(self, path_string) -> None:
27+
self.tool_configs: List[Union[SimpleToolConfig, ToolShedToolConfig]] = []
2428
paths = [path.strip() for path in path_string.split(",")]
2529
for path in paths:
2630
toolbox_tree = ElementTree.parse(path)
@@ -41,17 +45,17 @@ def __load_tools_from_els(self, toolbox_root, tool_path):
4145
except Exception:
4246
log.exception('Failed to load tool.')
4347

44-
def get_tool(self, id):
48+
def get_tool(self, id) -> Union["SimpleToolConfig", "ToolShedToolConfig"]:
4549
# Need to handle multiple tools per id someday, but
4650
# starting simple.
4751
tools = self.__find_tools_by_id(id)
4852
if not tools:
4953
raise KeyError("Failed to find tool with id '%s'" % id)
5054
if len(tools) > 1:
51-
log.warn("Found multiple tools with id '%s', returning first." % id)
55+
log.warning("Found multiple tools with id '%s', returning first.", id)
5256
return tools[0]
5357

54-
def __find_tools_by_id(self, id):
58+
def __find_tools_by_id(self, id) -> List[Union["SimpleToolConfig", "ToolShedToolConfig"]]:
5559
return [tool for tool in self.tool_configs if tool.id == id]
5660

5761

pulsar/tools/validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class ExpressionValidator:
1212

1313
def __init__(self, xml_el):
14-
if type(xml_el) == str:
14+
if isinstance(xml_el, str):
1515
xml_el = fromstring(xml_el)
1616
self.xml_el = xml_el
1717

pulsar/util/pastescript/serve.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ def pad(self, s, length, dir='left'):
258258
else:
259259
return ' ' * (length - len(s)) + s
260260

261-
def _standard_parser(cls, verbose=True,
261+
@classmethod
262+
def standard_parser(cls, verbose=True,
262263
interactive=False,
263264
no_interactive=False,
264265
simulate=False,
@@ -308,8 +309,6 @@ class MyCommand(Command):
308309
help="Overwrite files (warnings will be emitted for non-matching files otherwise)")
309310
return parser
310311

311-
standard_parser = classmethod(_standard_parser)
312-
313312
def quote_first_command_arg(self, arg):
314313
"""
315314
There's a bug in Windows when running an executable that's

0 commit comments

Comments
 (0)