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

Migrate to copier #159

Merged
merged 24 commits into from
Aug 19, 2024
Merged

Migrate to copier #159

merged 24 commits into from
Aug 19, 2024

Conversation

d-perl
Copy link
Contributor

@d-perl d-perl commented Aug 15, 2024

To test:

  • Check docs are intact
  • Confirm changed tests are correct

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 36.08247% with 124 lines in your changes missing coverage. Please review.

Project coverage is 57.70%. Comparing base (1928954) to head (f161198).
Report is 14 commits behind head on main.

Files Patch % Lines
...4/serial/fixed_target/i24ssx_Chip_Manager_py3v1.py 25.00% 45 Missing ⚠️
...luesky/i24/serial/setup_beamline/setup_beamline.py 40.90% 26 Missing ⚠️
...4/serial/fixed_target/i24ssx_Chip_Mapping_py3v1.py 0.00% 19 Missing ⚠️
...4/serial/fixed_target/i24ssx_Chip_StartUp_py3v1.py 33.33% 10 Missing ⚠️
src/mx_bluesky/i24/serial/dcid.py 0.00% 8 Missing ⚠️
...4/serial/fixed_target/i24ssx_Chip_Collect_py3v1.py 54.54% 5 Missing ⚠️
src/mx_bluesky/i24/serial/write_nexus.py 20.00% 4 Missing ⚠️
...4/serial/extruder/i24ssx_Extruder_Collect_py3v2.py 71.42% 2 Missing ⚠️
...sky/i24/serial/parameters/experiment_parameters.py 66.66% 2 Missing ⚠️
src/mx_bluesky/example.py 75.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
+ Coverage   57.08%   57.70%   +0.62%     
==========================================
  Files          28       29       +1     
  Lines        3199     3256      +57     
==========================================
+ Hits         1826     1879      +53     
- Misses       1373     1377       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@d-perl d-perl requested a review from DominicOram August 15, 2024 15:22
Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Great, thank you! Couple of comments, some of which are more related to general code issues that to this change so feel free to ignore/spin out

.copier-answers.yml Show resolved Hide resolved
Comment on lines 13 to 15
package_name: mx_bluesky
pypi: true
repo_name: mx_bluesky
Copy link
Contributor

Choose a reason for hiding this comment

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

Could: I can't find the discussion now but I think @callumforrester convinced me that we should be using hyphens rather than underscores in our package names. Is this a good opportunity to fix this here?

Choose a reason for hiding this comment

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

It's in PEP8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great, I wanted to do that but didn't want to have a fight about it

.github/workflows/ci.yml Outdated Show resolved Hide resolved
# The devcontainer should use the developer target and run as root with podman
# or docker with user namespaces.
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION} as developer
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -251,22 +248,24 @@ def save_screen_map() -> MsgGenerator:

@log.log_on_entry
def upload_parameters(
chipid: str = "oxford",
pmac: PMAC = inject("pmac"),
chipid: str = "oxford", pmac: PMAC = inject("pmac"), width: int | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Could: It looks like upload_parameters is only ever called with oxford. If we don't use any other chips a better fix here would be to not even take the chip type as an argument and just hardcode oxford and width=8? Pull into a separate issue if we're not sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For this and other similar, I didn't want to change things beyond the minimum necessary to make pyright happy here, but I agree these things all need cleaning up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@@ -79,36 +79,36 @@ def plot_file(fid, chip_type):
ax1.set_xlim(-1, 26)
ax1.set_ylim(-1, 26)
ax1.invert_yaxis()
check_files(["%s.png" % chip_type])
plt.savefig("%s.png" % fid[:-5], dpi=200, bbox_inches="tight", pad_inches=0.05)
check_files("i24", [f"{chip_type}.png"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Could: check_files only ever uses i24 as a location, maybe this because they change the hardcoded location to something else when they do it at the xfel? If that is the case we need a clean way for them to change it rather than have to go through every location? If not the case why pass a location to it at all. Maybe new issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

elif chip_type == ChipType.Custom:
# No fiducial for custom
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: What does this comment give you over the existing log?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't add this comment, just moved it down two lines so it was in the section it referred to

Comment on lines 127 to 129
time: float | Literal[10] | Literal[50],
rotation: Literal[360] | Literal[100] | Literal[-100],
expected_speed: ApproxBase | Literal[72] | Literal[4],
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: This odd, if I want to add another case to the parameterize I need to change these types? I feel like they should just be floats/ints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hah, I guess ruff added these automagically

tests/i04/test_thawing.py Outdated Show resolved Hide resolved
@@ -29,7 +29,7 @@


async def test_arm_and_disarm_zebra(zebra: Zebra, RE):
zebra.pc.arm.TIMEOUT = 1
zebra.pc.arm.TIMEOUT = 1 # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Could: I feel like the correct answer is to change the definition to be TIMEOUT: float = 3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@d-perl d-perl requested a review from DominicOram August 16, 2024 13:00
@d-perl d-perl force-pushed the 158_migrate_to_copier branch from 8658b26 to ad47831 Compare August 16, 2024 13:05
Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Thanks, I think you were slightly too aggressive on the find/replace. Otherwise good.

@d-perl d-perl requested a review from DominicOram August 16, 2024 13:41
Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Great, thank you!

@d-perl d-perl merged commit 783badc into main Aug 19, 2024
18 checks passed
@d-perl d-perl deleted the 158_migrate_to_copier branch August 19, 2024 08:13
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