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

Update for PyPI release #18

Merged
merged 17 commits into from
Oct 8, 2024
Merged

Update for PyPI release #18

merged 17 commits into from
Oct 8, 2024

Conversation

frodre
Copy link
Contributor

@frodre frodre commented Oct 2, 2024

Updates for releases to PyPI. Includes move to pyproject.toml the current suggested format for package configuration over setup.py. Includes some deployment makefile targets for test/production.

https://test.pypi.org/project/fme

Resolves #14

@frodre
Copy link
Contributor Author

frodre commented Oct 2, 2024

Try an installation with uv pip install -i https://test.pypi.org/simple/ fme --extra-index-url https://pypi.org/simple

pyproject.toml Outdated
description = "Train and evaluate weather/climate model emulators"
readme = "README.md"
requires-python = ">=3.9"
license = {file = "LICENSE"}
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 had to move the pyproject.toml to the top level in order to dynamically link the README and LICENSE files. I did try to leave it under fme, but it's not permitted to access parent directories for dynamic builds.

@mcgibbon doesn't recall if there was a requirement that setup.py and other files exist in fme and not at the top level, but did mention that it would make things more difficult for having multiple packages. Could be something worth discussing.

Copy link
Contributor

Choose a reason for hiding this comment

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

This does fundamentally change our repo so that it is now the repo of a single python package, as opposed to being a repo containing a single python package (but which could contain more). Probably worth discussing in our weekly fme sync.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would lean to maintaining the current repo structure. Maybe we could duplicate the LICENSE within fme and make an fme-specific README within that folder? The benefit of current structure is we can have the scripts folder with data processing etc scripts that are distinct from the fme package.

pyproject.toml Outdated

[project]
name = "fme"
version = "2024.10.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.

This version number was just for testing things out on testpypi. I'm thinking we should use the 2023.12.0 version that's tagged in the repo for actual pypi, but I wanted to check before actually committing a version.

rm -rf dist
python -m build

deploy_pypi: build_pypi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

User needs an API key to push, so it's safe to include in make target (i.e., can't accidentally push without access, and pushing same version fails)

@oliverwm1
Copy link
Collaborator

Although installing doesn't fail, and I can import fme, when I try to call a function that should be available, I get an AttributeError:

$ conda create -n test-pip python=3.10 pip
$ conda activate test-pip
$ pip install -i https://test.pypi.org/simple/ fme --extra-index-url https://pypi.org/simple
$ python
>>> import fme
>>> fme.get_device()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'fme' has no attribute 'get_device'

pyproject.toml Outdated

[project]
name = "fme"
version = "2024.10.5"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make sure fme.core.version.py is updated accordingly.

@@ -6,10 +6,10 @@ numpy<2
wandb
tensorly
tensorly-torch
xarray
xarray>=2023.2.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Mostly out of curiosity.. was there a particular feature that required this version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the original setup.py python>=3.8 the tests were failing without xarray above that version (which also forced the bump to python>=3.9). I removed since the python requirement automatically solves the xarray version correctly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, that is helpful explanation. I'm +1 on requiring python 3.9 given EOL for 3.8.

@frodre
Copy link
Contributor Author

frodre commented Oct 8, 2024

@oliverwm1 Okay, I've moved the pyproject.toml into the fme directory along with a new README.md and LICENSE to be accessed by that, updated version to rely on a single top-level fme.__version__, and changed that version to 2024.9.0 to reflect the last PR updates.

An example of what the package will appear as can be seen here: https://test.pypi.org/project/fme/2024.9.0/

Copy link
Collaborator

@oliverwm1 oliverwm1 left a comment

Choose a reason for hiding this comment

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

LGTM! I tested the install from test-pypi and it worked for me.

@frodre frodre merged commit 4b54d65 into main Oct 8, 2024
4 checks passed
frodre added a commit that referenced this pull request Oct 8, 2024
This reverts commit 4b54d65, reversing
changes made to 6d56caa.
frodre added a commit that referenced this pull request Oct 8, 2024
This reverts commit 4b54d65, reversing
changes made to 6d56caa.
@frodre frodre mentioned this pull request Oct 8, 2024
@frodre frodre deleted the pypi branch October 8, 2024 23:22
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.

Make fme package available on PyPI
3 participants