From 3804a157c4911bfbd46213c31104d8ae96896866 Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Tue, 10 Oct 2023 11:50:26 -0500 Subject: [PATCH 1/5] initialize full pyproject --- setup.cfg => .flake8 | 3 --- pyproject.toml | 32 +++++++++++++++++++++++++++++- setup.py | 46 -------------------------------------------- 3 files changed, 31 insertions(+), 50 deletions(-) rename setup.cfg => .flake8 (84%) delete mode 100644 setup.py diff --git a/setup.cfg b/.flake8 similarity index 84% rename from setup.cfg rename to .flake8 index 8edefbf..48215ff 100644 --- a/setup.cfg +++ b/.flake8 @@ -1,6 +1,3 @@ -[bdist_wheel] -universal = 1 - [flake8] max-line-length = 88 exclude = docs, diff --git a/pyproject.toml b/pyproject.toml index 4d4f9d7..00f2f48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,36 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "yt_xarray" +version = "0.1.4" +authors = [ + { name="Chris Havlin", email="chris.havlin@gmail.com" }, +] +description="interface between yt and xarray" +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +dependencies=['yt>=4.2.0', 'h5py>=3.4.0', 'pooch>=1.5.1', 'xarray'] + +[project.urls] +"Homepage" = "https://github.com/data-exp-lab/yt_xarray" +"Bug Tracker" = "https://github.com/data-exp-lab/yt_xarray/issues" + + [tool.black] line-length = 88 -target-version = ['py37'] +target-version = ['py310'] [tool.isort] profile = "black" diff --git a/setup.py b/setup.py deleted file mode 100644 index 3998919..0000000 --- a/setup.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python - -"""The setup script.""" - -from setuptools import find_packages, setup - -with open("requirements.txt") as reqs_file: - requirements = reqs_file.read().strip().split("\n") - -with open("README.md", "r") as readme_file: - readme_md = readme_file.read() - - -test_requirements = [ - "pytest>=3", -] - -setup( - author="Chris Havlin", - author_email="chris.havlin@gmail.com", - python_requires=">=3.9", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - description="interface between yt and xarray", - install_requires=requirements, - license="MIT license", - long_description=readme_md, - long_description_content_type="text/markdown", - include_package_data=True, - keywords="yt_xarray", - name="yt_xarray", - packages=find_packages(include=["yt_xarray", "yt_xarray.*"]), - test_suite="tests", - tests_require=test_requirements, - url="https://github.com/data-exp-lab/yt_xarray", - version="0.1.4", - zip_safe=False, -) From 05a578c346569faa8c1de1a6d883d82a78badb6f Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Tue, 10 Oct 2023 11:58:33 -0500 Subject: [PATCH 2/5] move all reqs to pyproject --- .readthedocs.yaml | 7 ++++--- pyproject.toml | 4 ++++ requirements.txt | 5 ----- requirements_dev.txt | 9 --------- requirements_docs.txt | 3 --- 5 files changed, 8 insertions(+), 20 deletions(-) delete mode 100644 requirements.txt delete mode 100644 requirements_dev.txt diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 5401e83..0b49008 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -14,6 +14,7 @@ build: # Optionally declare the Python requirements required to build your docs python: install: - - requirements: requirements.txt - - requirements: requirements_dev.txt - - requirements: requirements_docs.txt + - method: pip + path: . + extra_requirements: + - docs diff --git a/pyproject.toml b/pyproject.toml index 00f2f48..9bff91b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,10 @@ dependencies=['yt>=4.2.0', 'h5py>=3.4.0', 'pooch>=1.5.1', 'xarray'] "Homepage" = "https://github.com/data-exp-lab/yt_xarray" "Bug Tracker" = "https://github.com/data-exp-lab/yt_xarray/issues" +[project.optional-dependencies] +full = ["netCDF4", "scipy", "dask[complete]"] +test = ["pytest", "pytest-cov"] +docs = ["Sphinx==1.8.5", "jinja2<3.1.0", "nbsphinx"] [tool.black] line-length = 88 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 1585694..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ - -yt>=4.2.0 -h5py>=3.4.0 -pooch>=1.5.1 -xarray diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 49bf8cb..0000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,9 +0,0 @@ -pip -twine -pre-commit -netCDF4 -h5py -scipy -pytest -pytest-cov -dask[complete] diff --git a/requirements_docs.txt b/requirements_docs.txt index 5371437..e69de29 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -1,3 +0,0 @@ -Sphinx==1.8.5 -jinja2<3.1.0 -nbsphinx From a8695e5ff5a16203144b83dc34fb2537aa691164 Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Tue, 10 Oct 2023 12:03:48 -0500 Subject: [PATCH 3/5] update reqs in tests --- .github/workflows/run-pytest-tests.yml | 7 ++----- .github/workflows/weekly-test.yml | 8 +++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-pytest-tests.yml b/.github/workflows/run-pytest-tests.yml index f3ff65f..7e0e60f 100644 --- a/.github/workflows/run-pytest-tests.yml +++ b/.github/workflows/run-pytest-tests.yml @@ -17,13 +17,10 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements_dev.txt - name: Setup yt_xarray run: | - python -m pip install -e . + python -m pip install --upgrade pip + python -m pip install -e .[full,test] - name: Run Tests run: pytest --cov=./ --cov-report=xml:coverage/coverage.xml diff --git a/.github/workflows/weekly-test.yml b/.github/workflows/weekly-test.yml index 5e2783a..a3b37a7 100644 --- a/.github/workflows/weekly-test.yml +++ b/.github/workflows/weekly-test.yml @@ -20,11 +20,9 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r requirements_dev.txt - name: Setup yt_xarray - run: python -m pip install -e . + run: | + python -m pip install --upgrade pip + python -m pip install -e .[full,test] - name: Run Tests run: pytest -v . From 93fc4a0f26174ad8511f05aa975b6c8bc7ed4ff2 Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Tue, 10 Oct 2023 12:05:45 -0500 Subject: [PATCH 4/5] adjust codecov upload --- .github/workflows/run-pytest-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-pytest-tests.yml b/.github/workflows/run-pytest-tests.yml index 7e0e60f..a0818f9 100644 --- a/.github/workflows/run-pytest-tests.yml +++ b/.github/workflows/run-pytest-tests.yml @@ -26,7 +26,6 @@ jobs: # https://github.com/marketplace/actions/codecov#example-workflowyml-with-codecov-action - name: Upload coverage to Codecov - if: matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: directory: ./coverage/ From 7e2fafd23353399d1a6846bdfdc86bf858dab99d Mon Sep 17 00:00:00 2001 From: chrishavlin Date: Tue, 10 Oct 2023 12:09:24 -0500 Subject: [PATCH 5/5] fix build and manifest --- .github/workflows/check-build.yml | 12 ++++++------ .github/workflows/publish-to-pypi.yml | 4 ++-- MANIFEST.in | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index d844d0e..c7096b9 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -13,9 +13,9 @@ jobs: python-version: '3.10' - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install -U setuptools wheel twine - - name: Build and check - run: | - python setup.py sdist bdist_wheel - twine check dist/* + python -m pip install --upgrade pip + python -m pip install -U build twine + - name: Build and check source tarball + run: python -m build + - name: Twine check + run: twine check dist/* diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index dd0bde4..f28a953 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -20,9 +20,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install -U setuptools setuptools_scm wheel twine + python -m pip install -U build twine - name: Build and check source tarball - run: python setup.py sdist bdist_wheel + run: python -m build - name: Twine check run: twine check dist/* - name: Publish distribution to PyPI diff --git a/MANIFEST.in b/MANIFEST.in index 4642861..75e7757 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -6,6 +6,7 @@ include *.yaml include Makefile include tox.ini include .coveragerc +include .flake8 recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co]