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

Version specification in main text of tutorials/pyproject-toml.md #191

Merged
merged 11 commits into from
Apr 3, 2024

Conversation

sneakers-the-rat
Copy link
Contributor

Currently version specifiers are just in an admonition, and the examples all use dependency specifiers without versions. I think it's important to model version specification in the tutorials, since they probably won't see many real packages with wide open version specifiers in the wild, and they are the things that are the most troublesome/require the most maintenance over time/will be the source of the most bugs if left without version spec.

Currently

Screenshot 2024-03-01 at 2 59 37 PM Screenshot 2024-03-01 at 2 59 47 PM

This PR

After the unchanged start of the section...

Screenshot 2024-03-01 at 2 51 10 PM Screenshot 2024-03-01 at 2 51 19 PM

So now the "pin dependencies with caution" is just about pinning and narrow version constraints, and it also has a specific example for poetry, and the main text has a discussion about version specification.

I also changed the dependencies array throughout to match.

Something that newbies will also experience (i mean i am currently dealing with a problem like this) some cryptic messages about version incompatibility from requires-python saying they need to add an upper bound. I added a quick note there saying that lower bounds are just one way to specify it, but that you can use the more general version spec syntax there.

IDK why gh's syntax highlighter is showing everything as red...

@@ -303,31 +338,30 @@ readme = "README.md"
license = {file = 'LICENSE'}
requires-python = ">=3.10"

dependencies = ["numpy", "requests", "pandas", "pydantic"]
dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
Copy link
Member

Choose a reason for hiding this comment

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

@sneakers-the-rat one thing i think users will get stuck on here is how do they know what minimum version of a tool a package supports? i'm not sure how we'd explain that. it's not trivial because normally if you are new to software dev you are just installing tools and you won't do any pinning or lower or upper bound entries at all (unless you use poetry which has defaults). So how would i know (as a scientist who is a beginner to creating a package) that my tool can't support numpy < 1.0

Copy link
Member

Choose a reason for hiding this comment

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

so this comment is really about adding some direction to a scientist on how to figure this out. rather than telling them to use a lower bounds with out any guidance as to how to do it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I typically set to the lower bound to the version that I create the package with. Described in another comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I initially had that in here but took it out bc i didn't want to be too verbose, but if this is a sticking point then yes :). poetry at least does this automatically with poetry add, same with pdm add. i'm sort of surprised that hatch doesn't seem to have a cli command to add a dependency.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sneakers-the-rat I think if we choose the greater than current numpy version and make the comment: "Greater than or equal to the current version" that might clarify for @lwasser's concern.

Copy link
Member

Choose a reason for hiding this comment

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

yes this would absolutely clarify my concern. i think this is important to add but also guiding a user through how to pick the minimum version would be great. Currently using hatch, it does not support this feature (yet i think anyway) but i'm pretty sure ofek plans to add something like this? or that locking and deps are in the future of hatch's tooling. if you could add this clarification that would be great. @sneakers-the-rat

@@ -370,7 +404,7 @@ readme = "README.md"
license = {file = 'LICENSE'}
requires-python = ">=3.10"

dependencies = ["numpy", "requests", "pandas", "pydantic"]
dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
Copy link
Member

Choose a reason for hiding this comment

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

yes so here - i know pydantic well at this point. below 2.0 makes sense. but why did you pick 1.7 as the lower bound? and why doesn't pandas have any bounds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just random numbers to illustrate the version syntax :) - showing you can do exact pins, lower bounds, ranges, or unspecified - let me add some annotations to make that explicit

Copy link
Member

Choose a reason for hiding this comment

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

awesome. yes that clarification would be great. for instance the pydantic <2 makes a ton of sense

tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
Copy link
Member

@lwasser lwasser left a comment

Choose a reason for hiding this comment

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

I left some feedback. let's get folks in slack involved with this one as well!

Copy link
Collaborator

@willingc willingc left a comment

Choose a reason for hiding this comment

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

There are some good additions and distinctions made in this PR. I gone ahead and made some suggestions for clarity. I think the section on pinning needs to be reworked a bit since the topic of pinning has many perspectives and views.

tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
tutorials/pyproject-toml.md Outdated Show resolved Hide resolved
@willingc
Copy link
Collaborator

@lwasser @sneakers-the-rat How would you like to reboot this PR? I'm happy to add and commit the suggestions which will likely fix the merge conflict.

@sneakers-the-rat
Copy link
Contributor Author

oop sorry accidentally marked as read. i can fix merge conflict and accept suggestions!

@@ -303,31 +338,30 @@ readme = "README.md"
license = {file = 'LICENSE'}
requires-python = ">=3.10"

dependencies = ["numpy", "requests", "pandas", "pydantic"]
dependencies = ["numpy>=1.0", "requests==10.1", "pandas", "pydantic>=1.7,<2"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

@sneakers-the-rat I think if we choose the greater than current numpy version and make the comment: "Greater than or equal to the current version" that might clarify for @lwasser's concern.

@lwasser
Copy link
Member

lwasser commented Mar 21, 2024

ok i'll put this PR in my task list for tomorrow / monday to re-review. thank you all for this. @sneakers-the-rat another great addition to our guide here. thank you!

@lwasser lwasser added 🚀 ready-for-review enhancement-feature something new to add to our guide labels Mar 21, 2024
Copy link
Member

@lwasser lwasser left a comment

Choose a reason for hiding this comment

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

@sneakers-the-rat once again so sorry for the slow response. i've been so focused on our training coming up. This is a GREAT pr with really useful updates. let's merge it.

if i haven't told you this lately, i'm SO appreciative of all that you contribute to pyOpenSci. i've learned so much from you being here!! thank you.

@lwasser lwasser merged commit e6af5f6 into pyOpenSci:main Apr 3, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement-feature something new to add to our guide 🚀 ready-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants