diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 00000000..a2fff3bb --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -0,0 +1,78 @@ +name: test-build-publish + +# on: pull_request +on: + push: + tags: [ 'v*.*.*' ] +# on: push + +jobs: + test: + runs-on: ubuntu-latest + steps: + #---------------------------------------------- + # check-out repo and set-up python + #---------------------------------------------- + - name: Check out repository + uses: actions/checkout@v4 + with: + lfs: true + - name: Set up python + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + #---------------------------------------------- + # ----- install & configure poetry ----- + #---------------------------------------------- + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + virtualenvs-path: .venv + installer-parallel: true + + #---------------------------------------------- + # load cached venv if cache exists + #---------------------------------------------- + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + #---------------------------------------------- + # install dependencies if cache does not exist + #---------------------------------------------- + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + #---------------------------------------------- + # install your root project, if required + #---------------------------------------------- + - name: Install project + run: poetry install --no-interaction + #---------------------------------------------- + # install JARS + #---------------------------------------------- + - name: Install JARs + run: | + source .venv/bin/activate + python -m teehr.utils.install_spark_jars + #---------------------------------------------- + # run test suite + #---------------------------------------------- + - name: Run tests + run: | + source .venv/bin/activate + pytest tests/ + # coverage report + #---------------------------------------------- + # build publish package + #---------------------------------------------- + - name: Build and publish package + run: | + source .venv/bin/activate + poetry build + poetry publish --username __token__ --password ${{ secrets.POETRY_PYPI_TOKEN_TEEHR }} \ No newline at end of file diff --git a/README.md b/README.md index 771c1389..93659c6f 100644 --- a/README.md +++ b/README.md @@ -28,16 +28,17 @@ cd teehr_examples python3 -m venv .venv source .venv/bin/activate -# Install using pip. The version can be changed to install a different version. -pip install 'teehr @ git+https://github.com/RTIInternational/teehr@v0.4.1' +# Install using pip. +# Starting with version 0.4.1 TEEHR is available in PyPI +pip install teehr # Download the required JAR files for Spark to interact with AWS S3. python -m teehr.utils.install_spark_jars ``` Use Docker ```bash -$ docker build -t teehr:v0.4.1 . -$ docker run -it --rm --volume $HOME:$HOME -p 8888:8888 teehr:v0.4.1 jupyter lab --ip 0.0.0.0 $HOME +$ docker build -t teehr:v0.4.2 . +$ docker run -it --rm --volume $HOME:$HOME -p 8888:8888 teehr:v0.4.2 jupyter lab --ip 0.0.0.0 $HOME ``` ## Examples diff --git a/docs/sphinx/changelog/index.rst b/docs/sphinx/changelog/index.rst index 7ba9bedf..2c120d4a 100644 --- a/docs/sphinx/changelog/index.rst +++ b/docs/sphinx/changelog/index.rst @@ -1,6 +1,17 @@ Release Notes ============= +0.4.2 - 2024-10-18 +-------------------- + +Added +^^^^^ +* A test-build-publish workflow to push to PyPI + +Changed +^^^^^^^ +* None + 0.4.1 - 2024-10-15 -------------------- diff --git a/docs/sphinx/development/index.rst b/docs/sphinx/development/index.rst index 8c16d584..8153036a 100644 --- a/docs/sphinx/development/index.rst +++ b/docs/sphinx/development/index.rst @@ -89,9 +89,11 @@ This document describes the release process which has some manual steps to compl Create branch with the following updated to the new version (find and replace version number): -- ``version.txt`` -- ``README.md`` -- ``pyproject.toml`` +- `version.txt` +- `README.md` +- `pyproject.toml` +- `src/teehr/__init__.py` +- `docs/sphinx/getting_started/index.rst` Update the changelog at ``docs/sphinx/changelog/index.rst`` to reflect the changes included in the release. diff --git a/docs/sphinx/getting_started/index.rst b/docs/sphinx/getting_started/index.rst index e0829379..31b75573 100644 --- a/docs/sphinx/getting_started/index.rst +++ b/docs/sphinx/getting_started/index.rst @@ -14,9 +14,9 @@ TEEHR requires the following dependencies: * Java 8 or later for Spark (we use 17) -We do not currently push TEEHR to PyPI, so the easiest way to install it is directly from GitHub. +The easiest way to install TEEHR is from PyPI using `pip`. If using `pip` to install TEEHR, we recommend installing TEEHR in a virtual environment. -The code below should create a new virtual environment and install TEEHR in it. +The code below creates a new virtual environment and installs TEEHR in it. .. code-block:: python @@ -26,8 +26,9 @@ The code below should create a new virtual environment and install TEEHR in it. python3 -m venv .venv source .venv/bin/activate - # Using pip. The version can be changed to install a different version. - pip install 'teehr @ git+https://github.com/RTIInternational/teehr@v0.4.1' + # Install using pip. + # Starting with version 0.4.1 TEEHR is available in PyPI + pip install teehr # Download the required JAR files for Spark to interact with AWS S3. python -m teehr.utils.install_spark_jars @@ -36,8 +37,8 @@ Or, if you do not want to install TEEHR in your own virtual environment, you can .. code-block:: bash - docker build -t teehr:v0.4.1 . - docker run -it --rm --volume $HOME:$HOME -p 8888:8888 teehr:v0.4.1 jupyter lab --ip 0.0.0.0 $HOME + docker build -t teehr:v0.4.2 . + docker run -it --rm --volume $HOME:$HOME -p 8888:8888 teehr:v0.4.2 jupyter lab --ip 0.0.0.0 $HOME Project Objectives ------------------ diff --git a/pyproject.toml b/pyproject.toml index 12036298..f087a975 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "teehr" -version = "0.4.1" +version = "0.4.2" description = "Tools for Exploratory Evaluation in Hydrologic Research" authors = [ "RTI International", diff --git a/src/teehr/__init__.py b/src/teehr/__init__.py index 315b9637..fe1e9e50 100644 --- a/src/teehr/__init__.py +++ b/src/teehr/__init__.py @@ -1,3 +1,5 @@ +__version__ = "0.4.2" + from teehr.evaluation.evaluation import Evaluation # noqa from teehr.models.metrics.metric_models import Metrics # noqa from teehr.models.metrics.metric_enums import Operators # noqa diff --git a/version.txt b/version.txt index 44bb5d1f..f7abe273 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.4.1 \ No newline at end of file +0.4.2 \ No newline at end of file