Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
- "3.11"
os:
- ubuntu-latest
- macos-13
- macos-26
- macos-26-intel
- windows-latest
env:
MPLBACKEND: Agg # https://github.com/orgs/community/discussions/26434
Expand Down
92 changes: 51 additions & 41 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Publish Resourcecode 📦 to PyPI and TestPypi (for providing test builds to alpha users)
name: Publish Resourcecode 📦 to PyPI

on:
pull_request:
push:
branches:
- main
tags:
- 'v*' # Déclenche uniquement pour les tags commençant par 'v'

jobs:
build:
Expand All @@ -12,9 +15,9 @@ jobs:
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
uses: astral-sh/setup-uv@v8.2.0
with:
version: "0.11.16"
version: ""
enable-cache: true
- name: Build a binary wheel and a source tarball
run: uv build
Expand All @@ -24,12 +27,50 @@ jobs:
name: resourcecode
path: dist/

verify-version:
name: Verify package version
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: resourcecode
path: dist/
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install package in development mode
run: pip install -e .
- name: Verify version consistency
run: |
# Extraire la version du package installé
PACKAGE_VERSION=$(python -c "import resourcecode; print(resourcecode.__version__)")
TAG_VERSION=${GITHUB_REF#refs/tags/v}

echo "Tag version: $TAG_VERSION"
echo "Package version: $PACKAGE_VERSION"

if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "ERROR: Version mismatch between tag ($TAG_VERSION) and package ($PACKAGE_VERSION)"
exit 1
fi

# Vérifie que la version existe déjà sur PyPI
EXISTS=$(curl -s -o /dev/null -w "%{http_code}" "https://pypi.org/pypi/resourcecode/$TAG_VERSION/json")
if [ "$EXISTS" -ne 404 ]; then
echo "ERROR: Version $TAG_VERSION already exists on PyPI"
exit 1
fi

publish-to-pypi:
name: >-
Publish Resourcecode 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
name: Publish Resourcecode 📦 to PyPI
needs:
- build
- verify-version
runs-on: ubuntu-latest
environment:
name: publish
Expand All @@ -51,9 +92,7 @@ jobs:
run: uv publish

github-release:
name: >-
Sign the Resourcecode 📦 with Sigstore
and upload them to GitHub Release
name: Sign the Resourcecode 📦 with Sigstore and upload to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,41 +121,12 @@ jobs:
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
--notes "Release ${{ github.ref_name }}"
--generate-notes
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

publish-to-testpypi:
name: Publish Resourcecode 📦 to TestPyPI
if: "!startsWith(github.ref, 'refs/tags/')" # only publish to testPyPI for non-tagged pushes
needs:
- build
runs-on: ubuntu-latest

environment:
name: publish
url: https://test.pypi.org/p/resourcecode

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: resourcecode
path: dist/
- name: Install uv
uses: astral-sh/setup-uv@v8.1.0
with:
version: "0.11.16"
- name: Publish Resourcecode 📦 to TestPyPI
run: uv publish --publish-url https://test.pypi.org/legacy/
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ uv.lock
.venv/

# Jupyter checkpoints
**/.ipynb_checkpoints/
**/.ipynb_checkpoints/

/resourcecode/__pycache__
/resourcecode/*/__pycache__
*/__pycache__
/build
/.doctrees
/resourcecode.egg-info
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
## Version 2.1 (TBD)

### 👷 Bug Fixes
- Add Time Zone information in index from `download_data()` (thanks to @Nouhaylaa1)
- Updated tests accordingly

### Packaging & Tooling
- Fix the CI/CD to check before uploading to pypi and remove TestPyPi (unused)

## Version 2.0 (02/06/2026) (thanks to @chabotsi)

### Compatibility Updates
- Removed `numexpr` dependency for full pyiodide compatibility
- Updated `np.trapz()` → `np.trapezoid()` (numpy API change)
- Migrated from `scipy.stats.mvn()` to `scipy.stats.multivariate_normal()`
- Fixed crash in `download_data()` with Python 3.14 and numpy/xarray when opening files
- Updated dependency versions for marimo wasm compatibility

### 👷 Bug Fixes
- Fixed `censgaussfit()` to handle positive semi-definite sigma matrices
- Updated tests to check values instead of `dtypes`
- Set fixed random seed for reproducible tests

### Packaging & Tooling
- Moved `config.ini` into the package for distribution
- Migrated project to uv package manager


## Version 1.3.1 (TBD)
### 👷 Bug fixes
- Pin version of Numpy to be < 2.0.0 because `trapz` is renamed in higher versions
Expand Down
5 changes: 2 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ type: software
license: 'GPL-3.0-or-later'
repository-code: "https://resourcecode-project.github.io/py-resourcecode/"
url: "https://resourcecode-project.github.io/py-resourcecode/"
version: 1.3.1
date-released: '2023-03-18'
version: 2.1.0
date-released: '2026-06-30'
authors:
- given-names: Nicolas
family-names: Raillard
Expand Down Expand Up @@ -38,4 +38,3 @@ authors:
family-names: Papillon
email: louis.papillon@innosea.fr
affiliation: Innosea

24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,18 @@ See the following example:
... """)

>>> data
fp hs
2017-01-01 00:00:00 0.412 0.246
2017-01-01 01:00:00 0.410 0.212
2017-01-01 02:00:00 0.414 0.172
2017-01-01 03:00:00 0.437 0.138
2017-01-01 04:00:00 0.464 0.102
... ... ...
2017-03-19 02:00:00 0.088 0.056
2017-03-19 03:00:00 0.088 0.066
2017-03-19 04:00:00 0.089 0.078
2017-03-19 05:00:00 0.090 0.084
2017-03-19 06:00:00 0.732 0.086
fp hs
2017-01-01 00:00:00+00:00 0.412 0.246
2017-01-01 01:00:00+00:00 0.410 0.212
2017-01-01 02:00:00+00:00 0.414 0.172
2017-01-01 03:00:00+00:00 0.437 0.138
2017-01-01 04:00:00+00:00 0.464 0.102
... ... ...
2017-03-19 02:00:00+00:00 0.088 0.056
2017-03-19 03:00:00+00:00 0.088 0.066
2017-03-19 04:00:00+00:00 0.089 0.078
2017-03-19 05:00:00+00:00 0.090 0.084
2017-03-19 06:00:00+00:00 0.732 0.086
<BLANKLINE>
[1855 rows x 2 columns]

Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
4 changes: 2 additions & 2 deletions resourcecode/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr

# This file is part of Resourcecode.
Expand All @@ -17,5 +17,5 @@
# You should have received a copy of the GNU General Public License along
# with Resourcecode. If not, see <https://www.gnu.org/licenses/>.

numversion = (2, 0, 0)
numversion = (2, 1, 0)
__version__ = ".".join(str(num) for num in numversion)
8 changes: 4 additions & 4 deletions resourcecode/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down Expand Up @@ -212,7 +212,7 @@ def get_dataframe_from_criteria(self, criteria: Union[str, dict]) -> pd.DataFram
try:
node_id = int(parsed_criteria["node"])
except ValueError: # failed to convert node to an integer
raise BadPointIdError("Point Id must be an integer, can not be " f"{parsed_criteria['node']!r}")
raise BadPointIdError(f"Point Id must be an integer, can not be {parsed_criteria['node']!r}")
else:
if node_id not in self.possible_points_id:
raise BadPointIdError(f"{parsed_criteria['node']} is an unknown pointId.")
Expand Down Expand Up @@ -276,7 +276,7 @@ def get_dataframe_from_criteria(self, criteria: Union[str, dict]) -> pd.DataFram
return pd.DataFrame(
result_array[:, 1:],
columns=parsed_criteria["parameter"],
index=pd.to_datetime(index_array.astype(np.int64), unit="ms"),
index=pd.to_datetime(index_array.astype(np.int64), unit="ms", utc=True),
)

def _get_rawdata_from_criteria(self, single_parameter_criteria):
Expand All @@ -298,4 +298,4 @@ def _get_rawdata_from_criteria(self, single_parameter_criteria):
if response.ok:
return response.json()

raise ValueError("Unable to get a response from the database" "(status code = {})".format(response.status_code))
raise ValueError("Unable to get a response from the database(status code = {})".format(response.status_code))
2 changes: 1 addition & 1 deletion resourcecode/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/eva/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
# Extreme Values Modelling

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/eva/censgaussfit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/eva/extrema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/eva/huseby.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/eva/simulation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
2 changes: 1 addition & 1 deletion resourcecode/io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# coding: utf-8

# Copyright 2020-2022 IFREMER (Brest, FRANCE), all rights reserved.
# Copyright 2020-2026 IFREMER (Brest, FRANCE), all rights reserved.
# contact -- mailto:nicolas.raillard@ifremer.fr
#
# This file is part of Resourcecode.
Expand Down
Loading
Loading