Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move jobs to pyproject.toml using poethepoet #1161

Merged
merged 9 commits into from
Feb 18, 2025
Merged

move jobs to pyproject.toml using poethepoet #1161

merged 9 commits into from
Feb 18, 2025

Conversation

shapiromatron
Copy link
Owner

@shapiromatron shapiromatron commented Jan 25, 2025

This package removes the Makefile and make.bat files to run routine tasks and instead uses poethepoet which specifies tasks in pyproject.toml. In the future, its likely that we can switch to use uv and remove this additional dependency, but this switch should make that easier in the future.

To call tasks, instead of running make test, you'd run poe test. The command poe shows all available tasks.

I also updated the github actions to use uv and poe.

I added two new tasks:

  • run-py: start the django runserver
  • run-js: start the npm webserver

And removed two tasks, make dev, test-refresh.

This allows us to maintain a single set of tests that work on all operating systems.

@shapiromatron shapiromatron marked this pull request as ready for review January 25, 2025 19:04
Copy link
Collaborator

@rabstejnek rabstejnek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried a few commands, but I'm having trouble with sync-dev on windows:

Poe => uv pip install -e '.[dev,docs]'
Using Python 3.12.0 environment at: C:\Users\drabstej\Anaconda3\envs\hawc-3.12
Audited 1 package in 4.32s
Poe => uv pip install -e client
Using Python 3.12.0 environment at: C:\Users\drabstej\Anaconda3\envs\hawc-3.12
Audited 1 package in 120ms
Poe => yarn --cwd frontend
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Scripts\poe.exe\__main__.py", line 7, in <module>
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\__init__.py", line 54, in main
    result = app(cli_args=sys.argv[1:])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\app.py", line 130, in __call__
    return self.run_task(task) or 0
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\app.py", line 181, in run_task
    return task.run(context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\base.py", line 464, in run
    return self._handle_run(context, task_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\sequence.py", line 145, in _handle_run
    task_result = subtask.run(context=context, parent_env=env)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\base.py", line 464, in run
    return self._handle_run(context, task_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\cmd.py", line 60, in _handle_run
    return self._get_executor(context, env).execute(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\executor\base.py", line 134, in execute
    return self._execute_cmd(cmd, input=input, use_exec=use_exec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\executor\base.py", line 164, in _execute_cmd
    return self._exec_via_subproc(cmd, input=input, env=env, shell=shell)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\executor\base.py", line 238, in _exec_via_subproc
    proc = Popen(cmd, **popen_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 is not a valid Win32 application

@rabstejnek rabstejnek removed their assignment Feb 14, 2025
Copy link
Collaborator

@caseyhans caseyhans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not replicate Danny's issue, and the other commands worked fine for me as well. Worth investigating his problem but LGTM otherwise.

@caseyhans caseyhans assigned shapiromatron and unassigned caseyhans Feb 14, 2025
@shapiromatron
Copy link
Owner Author

Tried a few commands, but I'm having trouble with sync-dev on windows:

Poe => uv pip install -e '.[dev,docs]'
Using Python 3.12.0 environment at: C:\Users\drabstej\Anaconda3\envs\hawc-3.12
Audited 1 package in 4.32s
Poe => uv pip install -e client
Using Python 3.12.0 environment at: C:\Users\drabstej\Anaconda3\envs\hawc-3.12
Audited 1 package in 120ms
Poe => yarn --cwd frontend
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Scripts\poe.exe\__main__.py", line 7, in <module>
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\__init__.py", line 54, in main
    result = app(cli_args=sys.argv[1:])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\app.py", line 130, in __call__
    return self.run_task(task) or 0
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\app.py", line 181, in run_task
    return task.run(context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\base.py", line 464, in run
    return self._handle_run(context, task_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\sequence.py", line 145, in _handle_run
    task_result = subtask.run(context=context, parent_env=env)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\base.py", line 464, in run
    return self._handle_run(context, task_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\task\cmd.py", line 60, in _handle_run
    return self._get_executor(context, env).execute(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\executor\base.py", line 134, in execute
    return self._execute_cmd(cmd, input=input, use_exec=use_exec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\executor\base.py", line 164, in _execute_cmd
    return self._exec_via_subproc(cmd, input=input, env=env, shell=shell)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\site-packages\poethepoet\executor\base.py", line 238, in _exec_via_subproc
    proc = Popen(cmd, **popen_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\drabstej\Anaconda3\envs\hawc-3.12\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 is not a valid Win32 application

I too couldn't recreate this issue on Windows. I re-ran everything one more time on mac and windows, and it all worked for me. I'll move forward w/ merging; let me know if this continues to fail for you and is causing issues.

@shapiromatron
Copy link
Owner Author

@rabstejnek re-requesting review to merge.

@shapiromatron shapiromatron merged commit 2396c49 into main Feb 18, 2025
6 checks passed
@shapiromatron shapiromatron deleted the poethepoet branch February 18, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants