From 497d93ea329722eda7d2a5dc9552efd2d4c03fcb Mon Sep 17 00:00:00 2001 From: Chris Havlin Date: Tue, 25 Jul 2023 18:34:12 -0500 Subject: [PATCH 1/4] switching to use pyproject --- .github/workflows/build-test.yaml | 3 +- .github/workflows/pypi-release.yaml | 2 +- MANIFEST.in | 3 +- pyproject.toml | 46 +++++++++++++++++++++++++++ release_history.md | 6 ++++ requirements.txt | 5 --- requirements_dev.txt | 5 --- requirements_style.txt | 4 --- setup.cfg | 3 -- setup.py | 49 ----------------------------- 10 files changed, 56 insertions(+), 70 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 requirements_dev.txt delete mode 100644 requirements_style.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 6c7b9df..79055f2 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -21,10 +21,9 @@ jobs: sudo apt-get install libopenblas-dev python -m pip install --upgrade pip python -m pip install scipy==1.8.0 - python -m pip install -r requirements_dev.txt - name: Setup pyVBRc run: | - python -m pip install -e . + python -m pip install -e .[dev] - name: Run Tests run: pytest --cov=./ --cov-report=xml:coverage/coverage.xml -v pyVBRc/ # https://github.com/marketplace/actions/codecov#example-workflowyml-with-codecov-action diff --git a/.github/workflows/pypi-release.yaml b/.github/workflows/pypi-release.yaml index 29a4cc2..8d2b5af 100644 --- a/.github/workflows/pypi-release.yaml +++ b/.github/workflows/pypi-release.yaml @@ -21,7 +21,7 @@ jobs: python -m pip install --upgrade pip python -m pip install -U setuptools setuptools_scm wheel twine - name: Build and check source tarball - run: python setup.py sdist bdist_wheel + run: python _old_setup_py.txt sdist bdist_wheel - name: Twine check run: twine check dist/* - name: Publish distribution to PyPI diff --git a/MANIFEST.in b/MANIFEST.in index 0126f57..81dc02e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,9 +10,10 @@ include *.txt include Makefile recursive-include * *.m +recursive-include pyVBRc *.mat +recursive-include pyVBRc *.py recursive-exclude * __pycache__ recursive-exclude * *.py[co] -recursive-exclude * *.mat recursive-exclude examples *.mat recursive-exclude examples *.png include examples *.ipynb diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1e11d41 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,46 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "pyVBRc" +version = "0.1.1" +authors = [ + { name="Chris Havlin", email="chris.havlin@gmail.com" }, +] +description="python utilities for working with the VBRc" +readme = "README.md" +requires-python = ">=3.9" +classifiers=[ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] +dependencies=["numpy", + "scipy", + "matplotlib", + "packaging", + "unyt", + ] + +[tool.setuptools] +packages = ["pyVBRc"] + +[project.urls] +"Homepage" = "https://github.com/vbr-calc/pyVBRc" +"Bug Tracker" = "https://github.com/vbr-calc/pyVBRc/issues" + +[project.optional-dependencies] +dev = [ + "pytest>=3", + "pytest-cov", + "pre-commit", +] +lint = [ + "black==22.8.0", + "isort==5.12.0", + "flake8==6.0.0" +] diff --git a/release_history.md b/release_history.md index 080c74e..cc401ea 100644 --- a/release_history.md +++ b/release_history.md @@ -1,3 +1,9 @@ +# v0.1.2 + +maintenance release +* full switch to pyproject +* docs improvements + # v0.1.1 Initial release of pyVBRc, still experimental diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 0de0154..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -numpy -scipy -matplotlib -packaging -unyt diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index fae8ee6..0000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,5 +0,0 @@ -pip>=21.1 -wheel==0.33.6 -twine==1.14.0 -pytest -pytest-cov diff --git a/requirements_style.txt b/requirements_style.txt deleted file mode 100644 index ced1c74..0000000 --- a/requirements_style.txt +++ /dev/null @@ -1,4 +0,0 @@ -pre-commit -black==22.8.0 -isort==5.12.0 -flake8==6.0.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b8a1655..0000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[bdist_wheel] -universal = 1 - diff --git a/setup.py b/setup.py deleted file mode 100644 index 947b615..0000000 --- a/setup.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -"""The setup script.""" - -from setuptools import find_packages, setup - -with open("README.md") as readme_file: - readme = readme_file.read() - -with open("requirements.txt") as reqs_file: - requirements = [line.strip() for line in reqs_file.readlines()] - -test_requirements = [ - "pytest>=3", -] - -setup( - author="Chris Havlin", - author_email="chris.havlin@gmail.com", - python_requires=">=3.9", - classifiers=[ - "Development Status :: 2 - Pre-Alpha", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - ], - description="python utilities for working with the VBRc", - entry_points={ - "console_scripts": [ - "pyVBRc=pyVBRc.cli:main", - ], - }, - install_requires=requirements, - license="MIT license", - long_description=readme, - long_description_content_type="text/markdown", - include_package_data=True, - package_data={"": ["sample_data/*.mat"]}, - keywords="pyVBRc", - name="pyVBRc", - packages=find_packages(include=["pyVBRc", "pyVBRc.*"]), - test_suite="tests", - tests_require=test_requirements, - url="https://github.com/vbr-calc/pyVBRc", - version="0.1.1", -) From 92ed925898b6c90a3b14ba5b276e7ac9ddb7a3f9 Mon Sep 17 00:00:00 2001 From: Chris Havlin Date: Tue, 25 Jul 2023 18:35:54 -0500 Subject: [PATCH 2/4] update action --- .github/workflows/check-manifest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-manifest.yaml b/.github/workflows/check-manifest.yaml index f4b14a6..53c365b 100644 --- a/.github/workflows/check-manifest.yaml +++ b/.github/workflows/check-manifest.yaml @@ -19,7 +19,7 @@ jobs: - name: install build dependencies run: | python -m pip install wheel - - name: Install yt_xarray + - name: Install pyVBRc shell: bash run: | python -m pip install --no-build-isolation . From 2717a7ba9d0d3cd9d721e6610cb8f5185ce0dd41 Mon Sep 17 00:00:00 2001 From: Chris Havlin Date: Wed, 26 Jul 2023 10:36:54 -0500 Subject: [PATCH 3/4] update the relase and build verification actions --- .github/workflows/check-build.yml | 24 ++++++++++++------------ .github/workflows/pypi-release.yaml | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/check-build.yml b/.github/workflows/check-build.yml index 827015e..36e44c6 100644 --- a/.github/workflows/check-build.yml +++ b/.github/workflows/check-build.yml @@ -1,21 +1,21 @@ -name: Check Build +name: Build Verification on: pull_request jobs: - twinecheck: - name: twinecheck + build-and-check: + name: Build Verification runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v3 with: python-version: 3.9 - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install -U setuptools setuptools_scm 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/pypi-release.yaml b/.github/workflows/pypi-release.yaml index 8d2b5af..9be150d 100644 --- a/.github/workflows/pypi-release.yaml +++ b/.github/workflows/pypi-release.yaml @@ -1,27 +1,27 @@ +name: Publish distributions to PyPI + on: push: # Sequence of patterns matched against refs/tags tags: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 -name: Publish distributions to PyPI - jobs: build-and-publish: name: Build and Publish runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v3 - name: Set up Python 3.9 - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: 3.9 - 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 _old_setup_py.txt sdist bdist_wheel + run: python -m build - name: Twine check run: twine check dist/* - name: Publish distribution to PyPI From 0e1efcb1d6bbcce89bc8f62a9fc7953dd03c0021 Mon Sep 17 00:00:00 2001 From: Chris Havlin Date: Wed, 26 Jul 2023 11:29:15 -0500 Subject: [PATCH 4/4] rm linting from pyproject deps, update readme --- README.md | 32 ++++++++++++++++++++------------ pyproject.toml | 5 ----- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 35db811..aa4c313 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ pyVBRc is a python package for working with output from the [Very Broadband Rheology Calculator](https://github.com/vbr-calc/vbr). pyVBRc is currently (very) experimental and is likely to change drastically between early versions, but feel free to use it. -## installation +## Installation To install the latest release: @@ -10,20 +10,17 @@ To install the latest release: pip install pyVBRc ``` -To install the latest development version, fork and clone this repository then run +To install the latest development version, see the section on +[Contributing](#contributing). -``` -pip install . -``` - -## usage +## Usage As of now, you can use `pyVBRc` to: * load a VBR structure * interpolate between calculated values in the VBR structure -### loading a VBR structure +### Loading a VBR structure The primary gateway into working with VBRc data in the `VBRstruct`. Note that the following examples rely on a tiny VBR output file, `VBRc_sample_LUT.mat`, included in pyVBRc to allow simple testing of functionality. For any real application, you should generate your own VBR structure (in MATLAB or Octave). @@ -53,7 +50,7 @@ plt.show() ![](https://raw.githubusercontent.com/vbr-calc/pyVBRc/main/examples/andrade_psp_T_dep.png) -## interpolating +### Interpolating In some situations, it may be useful to interpolate VBRc results at arbitrary points between calculated points. The sample file,`"VBRc_sample_LUT.mat"` was calculated for a very coarse grid of temperature (`T_K`), melt fraction (`phi`) and grain size(`dg_um`) at two frequencies to serve as a simple look-up table (LUT). You can provide these variable names to the `lut_dimensions` keyword argument when initializing the `VBRCstruct`: @@ -115,7 +112,7 @@ which yields **NOTE** that the validity of any interpolation will depend on the underlying VBR structure that you have built. -## Additional examples +### Additional examples For now, check out the [examples directory](https://github.com/vbr-calc/pyVBRc/tree/main/examples) for more examples. @@ -127,14 +124,25 @@ If you have questions, feel free to ask in the VBRc slack channel (see [here](ht ## Contributing -Contributions fall a fork-pull request open source work flow. +Contributions fall a fork-pull request open source work flow: + +1. Fork this repository +2. Clone your fork and build a development installation (see below) +3. Create a new branch (`git checkout -b your_new_branch_name`) +4. Commit changes on your branch +5. Push your branch to your fork +6. Submit pull request (PR) to the main `pyVBRc` repository + +After PR submission, a number of automated tests will run and your changes +will be reviewed. Often this may involve some iteration, but we'll help you out +if you're new to git! ### Development installation After cloning your fork, you can install `pyVBRc` with ```shell -pip install -e . +pip install -e .[dev] ``` and then install all the development requirements with diff --git a/pyproject.toml b/pyproject.toml index 1e11d41..517c0fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,3 @@ dev = [ "pytest-cov", "pre-commit", ] -lint = [ - "black==22.8.0", - "isort==5.12.0", - "flake8==6.0.0" -]