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

ci: some ci maintenance work #675

Merged
merged 3 commits into from
Jul 23, 2024
Merged

ci: some ci maintenance work #675

merged 3 commits into from
Jul 23, 2024

Conversation

JoepVanlier
Copy link
Member

@JoepVanlier JoepVanlier commented Jul 19, 2024

Why this PR?
The pyproject.toml file is decribed in PEP 621. It is a more modern way of packaging python.

In addition, this PR sets up commit hooks. The last commit is just updates from updating black.

pyproject.toml Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
@alessiamarcolini
Copy link

alessiamarcolini commented Jul 22, 2024

maybe out of scope here but since we are in maintenance mode:

now you could also put the flake8 configuration in pyproject.toml (with https://pypi.org/project/pyproject-flake8/)

Copy link

@alessiamarcolini alessiamarcolini left a comment

Choose a reason for hiding this comment

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

Copy link
Member

@dean0x7d dean0x7d left a comment

Choose a reason for hiding this comment

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

Great improvements! Nice to see the modernization to pyproject.toml. It makes things so much easier (like checking the minimum Python version). But I feel like you should swap the where the version is stored. Check out my last comment.

dependencies = [
"pytest>=3.5",
"h5py>=3.4, <4",
"numpy>=1.24, <2", # 1.24 is needed for dtype in vstack/hstack (Dec 18th, 2022)
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but it reminded me: think about lifting this upper limit soon. numpy v2.1.0 is already out. In general, v2.x brings some really nice performance improvements for Mx Macs and with a much smaller package size (thanks to using the Accelerate SDK).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I will. I'll play around with it soon, but indeed, I don't want to piggyback that now.

pyproject.toml Outdated
length_sort_sections = ["stdlib", "thirdparty", "firstparty", "localfolder"]
lines_between_sections = 1

[tool.pytest.ini_options]
minversion = "3.5"
Copy link
Member

Choose a reason for hiding this comment

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

I'm fairly sure that you're using pytest features newer than v3.5. Maybe bump this up to v7 or v8?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! You are correct. I quickly bisected and 7.4 is the first one with everything green, so lower bound to that one.

Comment on lines 1 to 4
from importlib.metadata import version

__title__ = "lumicks.pylake"
__version__ = "1.5.1"
__version__ = version("lumicks.pylake")
Copy link
Member

Choose a reason for hiding this comment

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

I would swap this to work the other way around with pyproject.toml dynamic metadata: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#dynamic-metadata

That way, pyproject.toml reads from this file rather than the other way around. IMO this is nicer because users will be doing import lumicks.pylake a lot more often than pip install lumicks.pylake so it's good to avoid extra overhead on the more frequently used path.

You can share __summary__, __url__ and other info similarly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I inverted the dependency since I didn't manage to make it work with the editable install (it complained about missing dependencies). But I only just realized that I should really just directly pull it from the __about__ file instead. Must have been tired last Friday 😬.

This is actually nicer for a second reason on top of the overhead, since I would indeed want the package code to be leading in the case of an editable install, rather than the time I happened to install it.

I don't think __summary__ and __url__ can be shared through an attribute, and I would prefer not to put them in a separate file, since I feel that adding file reading to __init__ or __about__ is messier than having these properties we virtually never change in two places.

@JoepVanlier
Copy link
Member Author

Great improvements! Nice to see the modernization to pyproject.toml. It makes things so much easier (like checking the minimum Python version). But I feel like you should swap the where the version is stored. Check out my last comment.

Did you read the small discussion about the filename normalization? For now I upper bounded to 69.3, but do you know if any packaging we do (other than conda) relies on the actual filename of the generated package?

@dean0x7d
Copy link
Member

I think it's only Conda. I think you should just go ahead and unlock the upper bound and see. There really isn't any other way in the end.

Copy link
Member

@dean0x7d dean0x7d left a comment

Choose a reason for hiding this comment

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

Great work!

filterwarnings = "error"

[tool.setuptools.dynamic]
version = {attr = "lumicks.pylake.__about__.__version__"}
Copy link
Member

Choose a reason for hiding this comment

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

👌

@JoepVanlier JoepVanlier merged commit 3dc3012 into main Jul 23, 2024
8 checks passed
@JoepVanlier JoepVanlier deleted the pyproject branch July 23, 2024 16:26
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