Skip to content

Commit

Permalink
Migrate to pyproject.toml and deprecate local meta.yaml (#771)
Browse files Browse the repository at this point in the history
* Update requirements.txt

* update requirements.txt

* pyproject.toml

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add pyprpoject.toml

* update pyproject.toml

* revert changes in test dir

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert changes in benchmarks

* update conf.py

* update pyproject.toml

* update install docs

* update install docs

* update instal guide

* update instal guide

* update instal guide

* update instalation.rst

* add back setup.py for compatibility

* update optional dependencies

* Create MANIFEST.in

* add ruff to dev dependencies

* use matplotlib instead of matplotlib-base

* Remove .txt from LICENSE

* Update MANIFEST.in

Co-authored-by: Anissa Zacharias <anissaz@ucar.edu>

* update pyproject.toml

* remove references to meta.yaml

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Anissa Zacharias <anissaz@ucar.edu>
  • Loading branch information
3 people authored Apr 26, 2024
1 parent dff3971 commit 1cb2374
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 130 deletions.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/release_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Date of intended release:
## Release progress checklist

- [ ] CI tests are passing
- [ ] update version number in `meta.yaml`
- [ ] a new tag and release has been made on GitHub
- [ ] feedstock PR has been merged
- [ ] release on pypi action has been triggered and run successfully
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ repos:
hooks:
- id: check-yaml # Checks the syntax of .yaml files.
args: [--allow-multiple-documents]
exclude: 'meta.yaml' # Exclude this because it gives an error for '%' in Line 1 and couldn't fix yet
- id: end-of-file-fixer # Makes sure files end with a newline.
- id: trailing-whitespace # Checks for any tabs or spaces after the last non-whitespace character on the line.
- id: check-docstring-first # Checks that code comes after the docstrings.

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.5
rev: v0.4.1
hooks:
# Run the linter.
- id: ruff
Expand Down
18 changes: 18 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include LICENSE
include README.md

recursive-include uxarray *.py
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
exclude .gitignore
exclude .pre-commit-config.yaml
exclude .readthedocs.yml

include *.md
include *.toml
include *.txt
prune test*
prune ci*
prune .github*
prune docs*
prune benchmarks*
15 changes: 0 additions & 15 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,6 @@ def __getattr__(cls, name):
copyright = "{}, Uxarray".format(current_year)
author = "UXARRAY"


# The version info for the project being documented
def read_version():
for line in open("../meta.yaml").readlines():
index = line.find("set version")
if index > -1:
return line[index + 15 :].replace('" %}', "").strip()


# The short X.Y version.
version = read_version()

# The full version, including alpha/beta/rc tags.
release = read_version()

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# This is also used if you do content translation via gettext catalogs.
Expand Down
25 changes: 25 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,31 @@ An alternative to Conda is using pip::

pip install uxarray

This installs the minimum set of required dependencies, which includes the following:

.. literalinclude:: ../pyproject.toml
:language: toml
:start-after: minimal dependencies start
:end-before: minimal dependencies end


UXarray also maintains other dependency sets for different subsets of functionality::

$ python -m pip install "uxarray[math]" # Install optional dependencies for accurate math utlities
$ python -m pip install "uxarray[dev]" # Install optional dependencies for development
$ python -m pip install "uxarray[complete]" # Install all optional dependencies

The above commands should install most of the optional dependencies. However,
some packages which are either not listed on PyPI or require extra
installation steps are excluded. To know which dependencies would be
installed, take a look at the ``[project.optional-dependencies]`` section in
``pyproject.toml``:

.. literalinclude:: ../pyproject.toml
:language: toml
:start-at: [project.optional-dependencies]
:end-before: [project.urls]

Installing UXarray from source (Github)
---------------------------------------

Expand Down
59 changes: 0 additions & 59 deletions meta.yaml

This file was deleted.

74 changes: 74 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[project]
classifiers=[
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
'Operating System :: Microsoft :: Windows',
'Operating System :: Unix',
'Operating System :: MacOS',
"Topic :: Scientific/Engineering",
]

dynamic = ["version"]
keywords = ["unstructured grids"]
description = "Xarray-styled package for reading and directly operating on unstructured grid datasets following UGRID conventions"
license = {file = "LICENSE"}
name = "uxarray"
readme = "README.md"
requires-python = ">=3.9"

# minimal dependencies start
dependencies = [
"antimeridian",
"cartopy",
"cartopy",
"dask[dataframe]",
"datashader",
"geoviews",
"holoviews",
"matplotlib",
"matplotlib-inline",
"netcdf4",
"numba",
"numpy",
"pandas<2.1.0",
"pyarrow",
"requests",
"scikit-learn",
"scipy",
"shapely",
"spatialpandas",
"xarray",
]
# minimal dependencies end

[project.optional-dependencies]
complete = ["uxarray[math, dev]"]
math = ['gmpy2', 'pyfma']
dev = ['pathlib', 'pre_commit', 'pytest', 'pytest-cov', 'ruff']

[project.urls]
Documentation = "uxarray.readthedocs.io/"
Source = "https://github.com/UXARRAY/uxarray"
Tracker = "https://github.com/UXARRAY/uxarray/issues"


[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=60",
"setuptools-scm>=8",
]

[tool.setuptools.packages]
find = {}

[tool.setuptools_scm]
fallback_version = "9999"

[tool.ruff]
extend-exclude = ["test","benchmarks"]
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions ruff.toml

This file was deleted.

51 changes: 2 additions & 49 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,3 @@
#''' setup.py is needed, but only to make namespaces happen
from setuptools import setup

from setuptools import find_packages, setup

with open("README.md") as f:
long_description = f.read()

with open("requirements.txt") as f:
requirements = f.read().strip().split("\n")


#''' moved into function, can now be used other places
def version():
for line in open("meta.yaml").readlines():
index = line.find("set version")
if index > -1:
return line[index + 15 :].replace('" %}', "").strip()


setup(
name="uxarray",
version=version(),
maintainer="UXARRAY",
maintainer_email="",
python_requires=">=3.9",
install_requires=requirements,
description="""Unstructured grid model reading and recognizing with xarray.""",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers=[
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
],
include_package_data=True,
packages=find_packages(exclude=["docs", "test", "docs.*", "test.*"]),
# namespace_packages=['UXARRAY'],
url="https://github.com/UXARRAY/uxarray",
project_urls={
# 'Documentation': 'https://uxarray.readthedocs.io',
"Source": "https://github.com/UXARRAY/uxarray",
"Tracker": "https://github.com/UXARRAY/uxarray/issues",
},
zip_safe=False,
)
setup(use_scm_version={"fallback_version": "9999"})
1 change: 1 addition & 0 deletions uxarray/grid/grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""uxarray.core.grid module."""

import xarray as xr
import numpy as np

Expand Down

0 comments on commit 1cb2374

Please sign in to comment.