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

Switch to poetry for dependency management #208

Merged
merged 5 commits into from
Feb 5, 2025
Merged

Conversation

bachase
Copy link
Collaborator

@bachase bachase commented Feb 4, 2025

Addresses #78 by switching to poetry for dependency management. I tried separating into a few logical commits to make it easier to review.

Copy link

@cosenal cosenal left a comment

Choose a reason for hiding this comment

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

Nice! 🚢

Out of curiosity, did the act tool work well to test the actions? If so, it's worth adding a comment with the specific act command you have used. Similar to what we did here: https://github.com/unitaryfund/metriq-gym/blob/8f556ac7d94257a2605203aecfe8f026aafadd39/.github/workflows/test.yml#L2

Copy link
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Poetry makes this so much cleaner! Nice job.

Comment on lines -35 to +37
source /venv/bin/activate && \
./benchmarks/scripts/run_benchmarks.sh 8 && \
python ./benchmarks/scripts/plot_avg_benchmarks_over_time.py && \
python ./benchmarks/scripts/plot_latest_benchmarks.py
poetry run ./benchmarks/scripts/run_benchmarks.sh 8 && \
poetry run python ./benchmarks/scripts/plot_avg_benchmarks_over_time.py && \
poetry run python ./benchmarks/scripts/plot_latest_benchmarks.py
Copy link
Member

Choose a reason for hiding this comment

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

Nice that you can use poetry run to run bash scripts!

Comment on lines +6 to +7
# Install Poetry
RUN pip3 install poetry==2.0.1
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to use the "official installer" here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only (minor reason) was to avoid needing to apt-get curl in the dockerfile. But admit thats a minor point. Happy to change if that's better.

Copy link
Member

Choose a reason for hiding this comment

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

avoid needing to apt-get curl in the dockerfile

ahh yeah true. I guess if it works, then 🤷🏻. I was just hesitant about using pip to install poetry since it's not on their docs, but I guess pipx (which is documented) is just pip with some fancy virtual env management.

"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
],
python_requires=">=3.12", # Python version required
Copy link
Member

Choose a reason for hiding this comment

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

Let's make sure we carry python_requires over to the pyproject.toml: docs.

It seems like a few others may have gotten dropped as well, such as the description and classifiers.

Copy link

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ah good point, I missed that. I don't think I was looking for "python" as a project dependency of a python project. It looks like that does the job! Just wanted to make sure we had it somewhere that python 3.12 is required.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I think this would cover it. But you have a good point @natestemen. I'm realizing this is the "legacy" format of pyproject.toml for poetry. As you note, the current version is https://packaging.python.org/en/latest/guides/writing-pyproject-toml/ (and can compare to what poetry new <project> would create. The new format is what I used in the #209 version with uv. I'll look to rewrite this to use that format.

@bachase
Copy link
Collaborator Author

bachase commented Feb 5, 2025

Nice! 🚢

Out of curiosity, did the act tool work well to test the actions? If so, it's worth adding a comment with the specific act command you have used. Similar to what we did here: https://github.com/unitaryfund/metriq-gym/blob/8f556ac7d94257a2605203aecfe8f026aafadd39/.github/workflows/test.yml#L2

Yes I did, was very easy, thanks for the pointer. Will add the reference.

Use updated pyproject.toml syntax to specifiy project requirements.

Add comment to link to act for testing github actions
Copy link
Collaborator

@Misty-W Misty-W left a comment

Choose a reason for hiding this comment

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

thanks @bachase! Nate and Alessandro have already given this a thorough review, so feel free to merge when ready.

@bachase
Copy link
Collaborator Author

bachase commented Feb 5, 2025

Will do @Misty-W ! Is there a preference between merge commit versus rebase commit?

@natestemen
Copy link
Member

merge commit versus rebase commit

I vote for rebase (but not a hill I'd die on)! I think whatever we choose, let's make it the only option for merging PRs in the future.

@bachase
Copy link
Collaborator Author

bachase commented Feb 5, 2025

Awesome -- I'm down with rebase too and more how I've worked in the past. Doing that now.

@bachase bachase merged commit 85ddbb9 into main Feb 5, 2025
1 check passed
@bachase bachase deleted the 78-dep-management branch February 5, 2025 18:15
@bachase
Copy link
Collaborator Author

bachase commented Feb 5, 2025

I switched the repo settings to only allow rebase and merge.

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.

4 participants