Skip to content

Commit

Permalink
Merge branch 'main' into allocation_output_file
Browse files Browse the repository at this point in the history
  • Loading branch information
SouthEndMusic committed Nov 7, 2023
2 parents b0c549a + 8ef2835 commit 061e6f8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 29 deletions.
27 changes: 0 additions & 27 deletions docs/contribute/python.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,6 @@ If the example models change, re-run this script.

2. Copy `.vscode/settings_template.json` into `.vscode/settings.json`

## How to publish to PyPI {#sec-pypi}

1) Update `__version__` in `ribasim/__init__.py`

2) Open a terminal and run `cd python/ribasim`

3) Activate the ribasim environment with `conda activate ribasim`

4) If present remove dist folder

5) Re-create the wheels:
```
python -m build
```

6) Check the package files:
```
twine check dist/*
```

7) Make a new commit with the updated version number, and push to remote

8) Re-upload the new files:
```
twine upload dist/*
```

## Linting

To run our linting suite locally, execute:
Expand Down
11 changes: 10 additions & 1 deletion docs/contribute/release.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ All changes

## Release Ribasim Python to PyPI

To be able to do `pip install ribasim`, Ribasim Python needs to be released on the Python Package Index, see [these instructions](python.qmd#sec-pypi)
To be able to install packages with `pip`, they need to be released on the Python Package Index (PyPI).
In order to publish Ribasim Python or Ribasim API follow the following steps:

1) Update `__version__` in `__init__.py`

2) Open a terminal and run `pixi run build-ribasim-python-wheel` or `pixi run build-ribasim-api-wheel`

3) Make a new commit with the updated version number, and push to remote

4) Publish on PyPI with `pixi run publish-ribasim-python` or `pixi run publish-ribasim-api`

## Wait for TeamCity to build the new release {#sec-teamcity}

Expand Down
13 changes: 13 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ generate-python = """\
datamodel-codegen --use-title-as-name --use-double-quotes --disable-timestamp --use-default --strict-nullable --input-file-type=jsonschema --input docs/schema/root.schema.json --output python/ribasim/ribasim/models.py && \
datamodel-codegen --use-title-as-name --use-double-quotes --disable-timestamp --use-default --strict-nullable --input-file-type=jsonschema --input docs/schema/Config.schema.json --output python/ribasim/ribasim/config.py"""
codegen = { depends_on = ["generate-schema", "generate-python", "lint"] }
# Publish
build-ribasim-python-wheel = { cmd = "rm --recursive --force dist && python -m build && twine check dist/*", cwd = "python/ribasim" }
build-ribasim-api-wheel = { cmd = "rm --recursive --force dist && python -m build && twine check dist/*", cwd = "python/ribasim_api" }
build-wheels = { depends_on = [
"build-ribasim-python-wheel",
"build-ribasim-api-wheel",
] }
publish-ribasim-python = { cmd = "twine upload dist/*", cwd = "python/ribasim", depends_on = [
"build-ribasim-python-wheel",
] }
publish-ribasim-api = { cmd = "twine upload dist/*", cwd = "python/ribasim_api", depends_on = [
"build-ribasim-api-wheel",
] }

[dependencies]
build = "*"
Expand Down
23 changes: 23 additions & 0 deletions python/ribasim_api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Ribasim API

`ribasim_api` is an extension to [xmipy](https://pypi.org/project/xmipy/) for the Ribasim API.

The `ribasim_api` can be used to access functionality in the eXtended Model Interface (XMI) wrapper (XmiWrapper)
and additional functionality specific to the Ribasim API.


`ribasim_api` can be installed by running

```
pip install ribasim-api
```

or

```
conda install -c conda-forge ribasim-api
```

# Contributing

For the developer docs please have a look at https://deltares.github.io/Ribasim/python/developer.html
2 changes: 1 addition & 1 deletion python/ribasim_api/ribasim_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.3.0"
__version__ = "0.4.0"

from ribasim_api.ribasim_api import RibasimApi

Expand Down

0 comments on commit 061e6f8

Please sign in to comment.