Skip to content

Commit e6ff2cc

Browse files
committed
add conda support
1 parent e0c2af2 commit e6ff2cc

7 files changed

Lines changed: 247 additions & 4 deletions

File tree

CONDA_PUBLISHING.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Publishing NeqSim to Conda-Forge
2+
3+
This guide explains how to publish NeqSim to conda-forge for easy installation via Anaconda.
4+
5+
## Option 1: Submit to conda-forge (Recommended)
6+
7+
### Step 1: Ensure PyPI Package is Published
8+
9+
The conda-forge recipe pulls from PyPI, so ensure the latest version is published:
10+
11+
```bash
12+
poetry build
13+
poetry publish
14+
```
15+
16+
### Step 2: Fork and Clone staged-recipes
17+
18+
```bash
19+
git clone https://github.com/conda-forge/staged-recipes.git
20+
cd staged-recipes
21+
git checkout -b neqsim
22+
```
23+
24+
### Step 3: Create the Recipe
25+
26+
Copy the recipe from the `conda/` directory:
27+
28+
```bash
29+
mkdir recipes/neqsim
30+
cp /path/to/neqsim-python/conda/meta.yaml recipes/neqsim/
31+
```
32+
33+
### Step 4: Get the SHA256 Hash
34+
35+
After publishing to PyPI, get the hash:
36+
37+
```bash
38+
curl -sL https://pypi.io/packages/source/n/neqsim/neqsim-3.1.5.tar.gz | sha256sum
39+
```
40+
41+
Update `meta.yaml` with the hash.
42+
43+
### Step 5: Test Locally (Optional)
44+
45+
```bash
46+
conda build recipes/neqsim
47+
```
48+
49+
### Step 6: Submit Pull Request
50+
51+
Push your branch and create a PR to conda-forge/staged-recipes:
52+
53+
```bash
54+
git add recipes/neqsim
55+
git commit -m "Add neqsim recipe"
56+
git push origin neqsim
57+
```
58+
59+
Then open a PR at https://github.com/conda-forge/staged-recipes
60+
61+
### Step 7: Maintenance
62+
63+
Once accepted, a feedstock repository will be created at:
64+
https://github.com/conda-forge/neqsim-feedstock
65+
66+
For version updates, submit PRs to the feedstock.
67+
68+
## Option 2: Personal Anaconda Channel
69+
70+
For quick testing or private distribution:
71+
72+
### Step 1: Create Anaconda Account
73+
74+
Register at https://anaconda.org
75+
76+
### Step 2: Build the Package
77+
78+
```bash
79+
cd neqsim-python
80+
conda build conda/
81+
```
82+
83+
### Step 3: Upload to Anaconda
84+
85+
```bash
86+
anaconda login
87+
anaconda upload /path/to/conda-bld/noarch/neqsim-*.tar.bz2
88+
```
89+
90+
### Step 4: Install from Your Channel
91+
92+
```bash
93+
conda install -c YOUR_USERNAME neqsim
94+
```
95+
96+
## Option 3: Using environment.yml (Immediate Solution)
97+
98+
Users can install immediately using the provided environment file:
99+
100+
```bash
101+
conda env create -f environment.yml
102+
conda activate neqsim-env
103+
```
104+
105+
This installs all dependencies via conda (including Java) and neqsim via pip.
106+
107+
## Key Benefits of Conda Distribution
108+
109+
1. **Automatic Java Installation**: OpenJDK is installed as a conda dependency
110+
2. **Cross-platform**: Works on Windows, macOS, and Linux
111+
3. **Environment Management**: Easy to create isolated environments
112+
4. **Reproducibility**: Pin exact versions for reproducible builds
113+
114+
## Testing the Installation
115+
116+
```python
117+
import neqsim
118+
from neqsim.thermo import fluid
119+
120+
# Create a simple fluid
121+
gas = fluid('srk')
122+
gas.addComponent('methane', 0.9)
123+
gas.addComponent('ethane', 0.1)
124+
gas.setTemperature(25.0, 'C')
125+
gas.setPressure(50.0, 'bara')
126+
127+
# Run a flash calculation
128+
from neqsim.thermo import TPflash
129+
TPflash(gas)
130+
131+
print(f"Density: {gas.getDensity('kg/m3'):.2f} kg/m³")
132+
```

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,39 @@
77

88
NeqSim Python is part of the [NeqSim project](https://equinor.github.io/neqsimhome/). NeqSim Python is a Python interface to the [NeqSim Java library](https://github.com/equinor/neqsim) for estimation of fluid behavior and process design for oil and gas production. NeqSim Python toolboxes (eg. [thermoTools](https://github.com/equinor/neqsim-python/blob/master/src/neqsim/thermo/thermoTools.py) and [processTools](https://github.com/equinor/neqsim-python/blob/master/src/neqsim/process/processTools.py)) are implemented to streamline use of neqsim in Python. Examples of use are given in the [examples folder](https://github.com/equinor/neqsim-python/tree/master/examples).
99

10-
## Releases
10+
## Installation
1111

12-
NeqSim Python is distributed as a pip package. Please read the [Prerequisites](#prerequisites).
12+
NeqSim Python can be installed via **pip** or **conda**.
1313

14-
End-users should install neqsim python with some additional packages by running
14+
### Using pip
1515

16-
```
16+
```bash
1717
pip install neqsim
1818
```
1919

20+
### Using Conda
21+
22+
NeqSim is available on conda-forge. Install with:
23+
24+
```bash
25+
conda install -c conda-forge neqsim
26+
```
27+
28+
Or add conda-forge to your channels and install:
29+
30+
```bash
31+
conda config --add channels conda-forge
32+
conda config --set channel_priority strict
33+
conda install neqsim
34+
```
35+
36+
**Note:** The conda package automatically includes Java (OpenJDK) as a dependency, so no separate Java installation is required.
37+
38+
### Prerequisites
39+
40+
- Python 3.9 or higher
41+
- Java 11 or higher (automatically installed with conda, or install separately for pip)
42+
2043
## Getting Started
2144

2245
See the [NeqSim Python Wiki](https://github.com/equinor/neqsim-python/wiki) for how to use NeqSim Python via Python or in Jupyter notebooks. Also see [examples of use of NeqSim for Gas Processing in Colab](https://colab.research.google.com/github/EvenSol/NeqSim-Colab/blob/master/notebooks/examples_of_NeqSim_in_Colab.ipynb#scrollTo=kHt6u-utpvYf). Learn and ask questions in [Discussions for use and development of NeqSim](https://github.com/equinor/neqsim/discussions).

conda/bld.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
"%PYTHON%" -m pip install . -vv --no-deps --no-build-isolation
3+
if errorlevel 1 exit 1

conda/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
${PYTHON} -m pip install . -vv --no-deps --no-build-isolation

conda/conda_build_config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Conda build configuration for neqsim
2+
python:
3+
- "3.9"
4+
- "3.10"
5+
- "3.11"
6+
- "3.12"

conda/meta.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{% set name = "neqsim" %}
2+
{% set version = "3.1.5" %}
3+
4+
package:
5+
name: {{ name|lower }}
6+
version: {{ version }}
7+
8+
source:
9+
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
10+
sha256: d97992e030c400291615ee84c06f4be5a783111ab6f69a4e9aeef880e1102321
11+
12+
build:
13+
number: 0
14+
noarch: python
15+
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
16+
17+
requirements:
18+
host:
19+
- python >=3.9
20+
- pip
21+
- poetry-core
22+
run:
23+
- python >=3.9
24+
- jpype1 >=1.5.0
25+
- numpy >1.25.2
26+
- pandas >=2.0.3
27+
- openjdk >=11
28+
29+
test:
30+
imports:
31+
- neqsim
32+
commands:
33+
- pip check
34+
requires:
35+
- pip
36+
37+
about:
38+
home: https://github.com/Equinor/neqsim-python
39+
summary: NeqSim is a tool for thermodynamic and process calculations
40+
description: |
41+
NeqSim Python is a Python interface to the NeqSim Java library for
42+
estimation of fluid behavior and process design for oil and gas production.
43+
It provides toolboxes like thermoTools and processTools to streamline
44+
the use of NeqSim in Python.
45+
license: Apache-2.0
46+
license_family: Apache
47+
license_file: LICENSE
48+
doc_url: https://github.com/equinor/neqsim-python/wiki
49+
dev_url: https://github.com/Equinor/neqsim-python
50+
51+
extra:
52+
recipe-maintainers:
53+
- EvenSol

environment.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# NeqSim Conda Environment
2+
# Install with: conda env create -f environment.yml
3+
# Activate with: conda activate neqsim-env
4+
5+
name: neqsim-env
6+
channels:
7+
- conda-forge
8+
- defaults
9+
dependencies:
10+
- python>=3.9
11+
- openjdk>=11
12+
- jpype1>=1.5.0
13+
- numpy>1.25.2
14+
- pandas>=2.0.3
15+
# Optional for interactive use
16+
- matplotlib>=3.7.0
17+
- jupyter>=1.0.0
18+
- tabulate>=0.9.0
19+
# Install neqsim from PyPI until conda-forge package is available
20+
- pip
21+
- pip:
22+
- neqsim

0 commit comments

Comments
 (0)