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

[WIP] Adding the support of python packages to streamline the commit & PR flow #37

Merged
merged 78 commits into from
Oct 8, 2023

Conversation

hrushikesh-s
Copy link
Member

Adding the support of pre-commit, flake8, mypy, coverage report, ruff linter and black -- motivation taken from jobflow package developed by Alex Ganose to improve the code quality, consistency, and reliability. The file that takes care of this is .pre-commit-config.yaml

Also, adding the support of pyproject.toml, which is the standard way for managing dependencies in projects with >= Python 3.6. This means that we can safely remove requirements.txt, requirements-dev.txt & setup.py from the repository.

@hrushikesh-s
Copy link
Member Author

@idocx , most of the tests are failing mainly because of the two reasons:

  • formatting issues in the code
  • missing docstrings

I'm working on fixing them.

@hrushikesh-s
Copy link
Member Author

Added a PR template file in .github folder.
The file resembles the PR template of jobflow python package

@hrushikesh-s hrushikesh-s changed the title Adding the support of python packages to streamline the commit & PR flow [WIP] Adding the support of python packages to streamline the commit & PR flow Sep 14, 2023
@hrushikesh-s
Copy link
Member Author

Add the support of pyright for type checking to pyproject.toml

@hrushikesh-s
Copy link
Member Author

@idocx , the CI is again failing because of the same error. Any idea of to fix it?
Just a side note, I've already pulled in all the changes that you made in #41.

@idocx
Copy link
Member

idocx commented Sep 20, 2023

@hrushikesh-s hmmm this is really wired.

@hrushikesh-s
Copy link
Member Author

@idocx, so apparently, even after pulling in your changes, my local branch still hasn't updated itself.
But when I try to pull the master branch, github says that I'm already up to date.
Any idea what could have gone wrong?

@@ -4,8 +4,9 @@
from bson import ObjectId

from alab_management import BaseTask
from tests.fake_lab.devices.furnace import Furnace

Copy link
Member

@idocx idocx Sep 21, 2023

Choose a reason for hiding this comment

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

@hrushikesh-s It should be this line that causes issues. Change it to

from .devices.furnace import Furnace so that it will not run add_device twice

@hrushikesh-s
Copy link
Member Author

@idocx, most of the tests are failing. The following is a short summary of the failed tests:

=================================================== short test summary info ====================================================
FAILED tests/test_device_manager.py::TestDeviceManager::test_rpc - pika.exceptions.AMQPConnectionError
FAILED tests/test_device_view.py::TestDeviceView::test_occupied_device_twice - AttributeError: 'DeviceView' object has no attribute 'logger'
FAILED tests/test_device_view.py::TestDeviceView::test_occupy_device - AttributeError: 'DeviceView' object has no attribute 'logger'
FAILED tests/test_device_view.py::TestDeviceView::test_release_device - TypeError: DeviceView.release_device() got an unexpected keyword argument 'device'
FAILED tests/test_device_view.py::TestDeviceView::test_request_device_timeout - ValueError: No such device of name RobotArm
FAILED tests/test_device_view.py::TestDeviceView::test_request_device_twice - AttributeError: 'DeviceView' object has no attribute 'logger'
FAILED tests/test_device_view.py::TestDeviceView::test_request_devices_single - ValueError: No such device of name RobotArm
FAILED tests/test_experiment_manager.py::TestExperimentManager::test_handle_pending_experiments - pydantic.error_wrappers.ValidationError: 6 validation errors for InputExperiment
FAILED tests/test_experiment_manager.py::TestExperimentManager::test_mark_completed_experiments - pydantic.error_wrappers.ValidationError: 6 validation errors for InputExperiment
FAILED tests/test_experiment_view.py::TestExperimentView::test_create_experiment - pydantic.error_wrappers.ValidationError: 4 validation errors for InputExperiment
FAILED tests/test_experiment_view.py::TestExperimentView::test_get_experiment - ValueError: Cannot find an experiment with id: 650b9417c454190288723682
FAILED tests/test_experiment_view.py::TestExperimentView::test_get_experiments_with_status - pydantic.error_wrappers.ValidationError: 4 validation errors for InputExperiment
FAILED tests/test_experiment_view.py::TestExperimentView::test_update_experiment_with_status - pydantic.error_wrappers.ValidationError: 4 validation errors for InputExperiment
FAILED tests/test_experiment_view.py::TestExperimentView::test_update_sample_task_id - pydantic.error_wrappers.ValidationError: 4 validation errors for InputExperiment
FAILED tests/test_lab_view.py::TestLabView::test_request_resources - pika.exceptions.AMQPConnectionError
FAILED tests/test_lab_view.py::TestLabView::test_request_resources_empty - pika.exceptions.AMQPConnectionError
FAILED tests/test_launch.py::TestLaunch::test_submit_experiment - requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8896): Max retries exceeded with url: /api/e...
FAILED tests/test_sample_view.py::TestSampleView::test_create_sample - ValueError: Invalid sample position: furnace_table
FAILED tests/test_sample_view.py::TestSampleView::test_get_sample - ValueError: No sample found with id: 650b9425c454190288723789
FAILED tests/test_sample_view.py::TestSampleView::test_lock_sample_position - ValueError: Invalid sample position: furnace_table
FAILED tests/test_sample_view.py::TestSampleView::test_move_sample - ValueError: Invalid sample position: furnace_table
FAILED tests/test_sample_view.py::TestSampleView::test_request_device_timeout - ValueError: Position prefix `furnace_table` can only have 0 matches, but requests 1
FAILED tests/test_sample_view.py::TestSampleView::test_request_multiple_sample_positions - ValueError: Position prefix `furnace_temp` can only have 0 matches, but requests 1
FAILED tests/test_sample_view.py::TestSampleView::test_request_multiple_sample_positions_multiple_tasks - ValueError: Position prefix `furnace_temp` can only have 0 matches, but requests 2
FAILED tests/test_sample_view.py::TestSampleView::test_request_sample_position_single - ValueError: Position prefix `furnace_table` can only have 0 matches, but requests 1
FAILED tests/test_sample_view.py::TestSampleView::test_request_sample_positions_occupied - ValueError: Invalid sample position: furnace_table
FAILED tests/test_sample_view.py::TestSampleView::test_request_sample_positions_twice - ValueError: Invalid sample position: furnace_table
FAILED tests/test_task_manager.py::TestTaskManager::test_task_request_wrong_format - AttributeError: 'list' object has no attribute 'items'
FAILED tests/test_task_manager.py::TestTaskManager::test_task_request_wrong_number - AttributeError: 'list' object has no attribute 'items'
FAILED tests/test_task_manager.py::TestTaskManager::test_task_requester - AttributeError: 'list' object has no attribute 'items'
========================================== 30 failed, 9 passed, 6 warnings in 46.62s ===========================================

I'm trying to fix them now.

@idocx idocx merged commit 77bf06a into CederGroupHub:master Oct 8, 2023
2 of 5 checks passed
@idocx
Copy link
Member

idocx commented Oct 8, 2023

Looks pretty good! Probably we can fix the CI flow in the other PR. 👍

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