Skip to content

Commit

Permalink
Merge pull request #55 from pacificclimate/i54-upgrade-python
Browse files Browse the repository at this point in the history
I54 upgrade python
  • Loading branch information
eyvorchuk authored May 24, 2024
2 parents d750746 + 0a3a99d commit 8b2f6fa
Show file tree
Hide file tree
Showing 17 changed files with 1,887 additions and 1,010 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ on:
jobs:
publish:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
python-version: '3.10'
- name: Install Poetry
run: |
pip install -U pip
pip install Sphinx==2.4.4 setuptools wheel twine
curl -sSL https://install.python-poetry.org | python3 -
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.pcic_at_pypi_username }}
TWINE_PASSWORD: ${{ secrets.pcic_at_pypi_password }}
PCIC_PYPI_USERNAME: ${{ secrets.pcic_at_pypi_username }}
PCIC_PYPI_PASSWORD: ${{ secrets.pcic_at_pypi_password }}
run: |
python setup.py sdist bdist_wheel
twine upload --repository-url https://pypi.pacificclimate.org/ --skip-existing -u $TWINE_USERNAME -p $TWINE_PASSWORD dist/*
poetry config repositories.pcic https://pypi.pacificclimate.org/
poetry config http-basic.pcic $PCIC_PYPI_USERNAME $PCIC_PYPI_PASSWORD
poetry build
poetry publish -r pcic
31 changes: 14 additions & 17 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.7, 3.8]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand All @@ -17,38 +17,35 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install cdo and pipenv
- name: Install cdo and poetry
run: |
sudo apt-get update
sudo apt-get install cdo
pip install -U pip pipenv
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- id: cache-pipenv
- id: cache-poetry
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies if changed
if: steps.cache-pipenv.outputs.cache-hit != 'true' && ${{ matrix.python-version == '3.8' }}
if: ${{ steps.cache-poetry.outputs.cache-hit != 'true' }}
run: |
pipenv install --deploy --dev
- name: Re-install dependencies if alternative python version
if: ${{ matrix.python-version != '3.8' }}
run: |
mv Pipfile.lock do-not-use
pipenv install --python ${{ matrix.python-version }} --dev
poetry env use python${{ matrix.python-version }}
poetry install --extras "complete"
poetry run pip install -e .
- name: Test with pytest (full)
if: github.ref == 'refs/heads/master'
run: |
pipenv run py.test -m "not online" -v
poetry run py.test -m "not online" -v
- name: Test with pytest (fast)
if: github.ref != 'refs/heads/master'
run: |
pipenv run py.test -m "not online and not slow" -v
poetry run py.test -m "not online and not slow" -v
- name: Code Quality
run: pipenv run black . --check
run: poetry run black . --check
23 changes: 0 additions & 23 deletions Pipfile

This file was deleted.

856 changes: 0 additions & 856 deletions Pipfile.lock

This file was deleted.

19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@ These functions gather PyWPS inputs, build PyWPS outputs, and handle logging inf

## Installation as GitHub Repository

Clone the repo onto the target machine. Python installation should be done using the `pipenv` tool. The required dependencies can be installed using
Clone the repo onto the target machine. Python installation should be done using the `poetry` tool. The required dependencies can be installed using

```bash
pipenv install
poetry install
```

The additional R dependencies can be installed using
```bash
poetry install --extras "r"
```

This also creates a virtual environment that can be activated using
```bash
pipenv shell
poetry shell
```

## Installation and Usage as Package
Expand All @@ -59,7 +64,7 @@ Once the repository is cloned and the required development packages are installe
More Python packages are required to run the tests and they can be installed by executing

```bash
pipenv install --dev
poetry install --extras "complete"
```

The entire test suite can then be run by executing
Expand All @@ -78,14 +83,14 @@ pytest tests/test_utils.py::test_is_opendap_url

To create a versioned release:

1. Increment `__version__` in `setup`
1. Increment `version` in `pyproject.toml`
2. Summarize the changes from the last release in `NEWS.md`
3. Commit these changes, then tag the release:

```bash
git add setup NEWS.md
git add pyproject.toml NEWS.md
git commit -m"Bump to version x.x.x"
git tag -a -m"x.x.x" x.x.x
git push --follow-tags
```
4. [Github Actions](https://github.com/pacificclimate/wps-tools/blob/i16-update-documentation/.github/workflows/pypi-publish.yml) will automatically build and publish the package to our pypi server
4. [Github Actions](https://github.com/pacificclimate/wps-tools/blob/master/.github/workflows/pypi-publish.yml) will automatically build and publish the package to our pypi server
Loading

0 comments on commit 8b2f6fa

Please sign in to comment.