Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use hatchling instead of setuptools, add pixi task: pypi-publish #760

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

Merged
merged 9 commits into from
Jan 24, 2024

Conversation

Huite
Copy link
Contributor

@Huite Huite commented Jan 19, 2024

This setups the pyproject to use hatching instead of setuptools.

It also adds a pypi-publish task to pixi to make the release process a little smoother.

Finally, the pyproject version is derived from the imod.init. Ideally, there's a single source of truth, but pixi still contains its own version number (note: that one is not used anywhere, you could set it to a dummy value as well).

@Huite Huite requested a review from JoerivanEngelen January 19, 2024 16:19
@Huite
Copy link
Contributor Author

Huite commented Jan 19, 2024

I just set this up for xugrid, and it seems to be working.

Keep in mind that you will need to update the conda-recipe for the host requirements. See for example:
https://statics.teams.cdn.office.net/evergreen-assets/safelinks/1/atp-safelinks.html

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

Apart from the one comment looks good to me

pixi.toml Outdated
@@ -38,6 +38,7 @@ examples = { cmd = [
"--verbose",
"--junitxml=examples_report.xml",
], depends_on = ["install"], cwd = "imod/tests" }
pypi-publish = { cmd = "rm --recursive --force dist && python -m build && twine check dist/*" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add hatchling to the dependencies?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I've added it to the pyproject dev dependencies.

Copy link
Contributor Author

@Huite Huite Jan 22, 2024

Choose a reason for hiding this comment

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

By the way, we could arguably remove the dev dependencies since we recommend pixi anyway, right?

And hatchling then wouldn't be need for a regular user.

I'll open an issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that should be fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still annoying that there is no good way to find out if you require too much or especially too little in your normal dependencies.

@JoerivanEngelen
Copy link
Contributor

JoerivanEngelen commented Jan 22, 2024

Link doesn't work, but here are some useful links:

FYI: The developer also promotes Hatch, which would kinda replace pixi, but I don't think that would work for us.

@Hofer-Julian
Copy link
Contributor

Hofer-Julian commented Jan 22, 2024

FYI: The developer also promotes Hatch, which would kinda replace pixi, but I don't think that would work for us.

Agreed.
hatchlings on its own mostly helps us by requiring less configuration and that it makes IDEs support editable installations properly

@Huite
Copy link
Contributor Author

Huite commented Jan 22, 2024

I removed the MANIFEST.in, which is no longer needed, and I re-added the upload command to the new pixi task.
To test it, just remove the upload part (or cancel when asked to submit your pypi name/token/password).

Copy link
Contributor

@JoerivanEngelen JoerivanEngelen left a comment

Choose a reason for hiding this comment

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

Looks good to me, just a question: Does this require developers to do a new editable install on their machines?

@Huite
Copy link
Contributor Author

Huite commented Jan 23, 2024

I don't think so, and otherwise you just run pixi run install...

@Hofer-Julian
Copy link
Contributor

Looks good to me, just a question: Does this require developers to do a new editable install on their machines?

Good that you mention that.
Yesterday I saw that editable installations had to be redone on @SouthEndMusic's machine, so I think the answer is yes.

@JoerivanEngelen
Copy link
Contributor

Looks good to me, just a question: Does this require developers to do a new editable install on their machines?

Good that you mention that. Yesterday I saw that editable installations had to be redone on @SouthEndMusic's machine, so I think the answer is yes.

Ah good to know, this means the advice has to be added to the changelog: "Users who did a development install are adviced to run pip uninstall imod followed by pip install -e . again". I'll add that, and I'll fix the conflict in .lock files.

@JoerivanEngelen
Copy link
Contributor

We shouldn't forget to update the imod-feedstock for the next release, I made an issue to remind myself here: conda-forge/imod-feedstock#31

@JoerivanEngelen
Copy link
Contributor

Blocked by: #774, wait until #775 is merged.

github-merge-queue bot pushed a commit that referenced this pull request Jan 24, 2024
Fixes #774 

# Description
Build in #760 fails for
test_rasterio_ascii

``test_rasterio_ascii`` doesn't work for GDAL 3.8.3 compared to 3.7.3. 

Previously it was tested if files are exactly identical. This defeats
the purpose, more important is that GDAL can read the file and
interprets the file equal as if it were written with GDAL. Replacing
``assert_equal_content`` with the changes fixes things.

# Checklist
<!---
Before requesting review, please go through this checklist:
-->

- [x] Links to correct issue
- [ ] Update changelog, if changes affect users
- [x] PR title starts with ``Issue #nr``, e.g. ``Issue #737``
- [x] Unit tests were added
- [ ] **If feature added**: Added/extended example
@JoerivanEngelen JoerivanEngelen added this pull request to the merge queue Jan 24, 2024
Merged via the queue into master with commit 03d97ba Jan 24, 2024
@JoerivanEngelen JoerivanEngelen deleted the hatchling branch January 24, 2024 17:07
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