Skip to content

Commit

Permalink
Merge pull request #28 from openghg/release0p0p3
Browse files Browse the repository at this point in the history
Release 0.0.3
  • Loading branch information
gareth-j authored May 15, 2024
2 parents 292b51d + 1633a69 commit 73c8ab5
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 13 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,34 @@ on:
branches: [main, devel]

jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install dev requirements
run: |
pip install -r requirements-dev.txt
- name: Install package
run: |
pip install .
- name: Run tests
run: |
pytest .
release_pypi:
name: Build and publish Python distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
Expand All @@ -27,12 +47,12 @@ jobs:
run: |
python -m build --sdist --wheel --outdir dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450
with:
password: ${{ secrets.PYPI_API_TOKEN }}
release_conda:
Expand All @@ -44,7 +64,7 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- uses: mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1
- uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7
with:
init-shell: bash
- name: Build the conda package
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
build/
dist/
*.egg-info/
*/__pycache__/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
51 changes: 46 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ This repository contains the supplementary information / metadata around site, s
## Installation

Note that `openghg_defs` should be installed in the same virtual environment as OpenGHG.
There are two ways of installing `openghg_defs`, as an editable install of this git repository or via PyPI.

### Editable install

Expand All @@ -21,7 +20,7 @@ git clone https://github.com/openghg/openghg_defs.git

Next, move into the repository and use pip to create an editable install using the `-e` flag.

> **_NOTE:_** If you're using OpenGHG, please install `openghg_defs` in the [same virtual environment](https://docs.openghg.org/install.html#id1).
> **_NOTE:_** If you're using OpenGHG, please install `openghg_defs` in the [same virtual environment](https://docs.openghg.org/install.html#id1).
```console
cd openghg_defs
Expand Down Expand Up @@ -59,10 +58,52 @@ site_info_file = openghg_defs.site_info_file
domain_info_file = openghg_defs.domain_info_file
```

## Updating information
## Development

### Updating information

We invite users to update the information we have stored. If you find a mistake in the data or want to add something, please
[open an issue](https://github.com/openghg/supplementary_data/issues/new) and fill out the template that matches your
problem.
problem. You're also welcome to submit a pull-request with your fix.

For the recommended development process please see the [OpenGHG documentation](https://docs.openghg.org/development/python_devel.html)

### Run the tests

After making changes to the package please ensure you've added a test if adding new functionality and run the tests making sure they all pass.

```console
pytest -v tests/
```

### Release

The package is released using GitHub actions and pushed to conda and PyPI.

#### 1. Update the CHANGELOG

- Update the changelog to add the header for the new version and add the date.
- Update the Unreleased header to match the version you're releasing and `...HEAD`.

#### 2. Update `pyproject.toml`

For a new release the package version must be updated in the `pyproject.toml` file. Try and follow the [Semantic Versioning](https://semver.org/) method.

#### 3. Tag the commit

Now tag the commit. First we create the tag and add a message (remember to insert correct version numbers here).

```console
git tag -a x.x.x -m "openghg_defs release vx.x.x"
```

Next push the tag. This will trigger the automated release by GitHub Actions.

```console
git push origin x.x.x
```

#### 4. Check GitHub Actions runners

You're also welcome to submit a pull-request with your fix.
Check the GitHub Actions [runners](https://github.com/openghg/openghg_defs/actions) to ensure the tests have
all passed and the build for conda and PyPI has run successfully.
2 changes: 1 addition & 1 deletion openghg_defs/data/site_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@
"height_station_masl": 110.0,
"latitude": 49.0915,
"long_name": "Karlsruhe, Germany",
"longitude": 8.4249,
"longitude": 8.4249
}
},
"KJN": {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openghg_defs"
version = "0.0.2"
version = "0.0.3"
description = "Supplementary definition data for OpenGHG"
readme = "README.md"
requires-python = ">=3.7"
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
19 changes: 19 additions & 0 deletions tests/test_valid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import json
from openghg_defs import site_info_file, species_info_file, domain_info_file


# NOTE - these tests should be expanded to check all
# data matches a simple schema for site info etc
def test_site_info_valid():
site_info = json.loads(site_info_file.read_text())
assert site_info


def test_species_info_valid():
species_info = json.loads(species_info_file.read_text())
assert species_info


def test_domain_info_valid():
domain_info = json.loads(domain_info_file.read_text())
assert domain_info

0 comments on commit 73c8ab5

Please sign in to comment.