Skip to main content

Python bindings for the Java library NeqSim (via JPype), with python stubs

Project description

jNeqSim

PyPI version License

Python interface for the NeqSim java package, with stubs. Java interface is created with jpype, and stubs are generated with stubgenj

PYPI

https://pypi.org/project/jneqsim/

[!NOTE] JNeqSim mirrors NeqSims versions

Demo

demo.gif

Example

from jneqsim import neqsim


def pressurize_gas():
    inlet_fluid = neqsim.thermo.system.SystemSrkEos()
    neqsim.thermo.system.SystemSrkEos()
    thermo_ops = neqsim.thermodynamicOperations.ThermodynamicOperations(inlet_fluid)
    inlet_fluid.addComponent("methane", 100.0)

    inlet_fluid.setTemperature(10, "C")
    inlet_fluid.setPressure(20, "bara")
    inlet_fluid.setMultiPhaseCheck(True)
    inlet_fluid.setSolidPhaseCheck("methane")

    thermo_ops.TPflash()
    thermo_ops.bubblePointTemperatureFlash()

    inlet_fluid.initProperties()
    enthalpy = inlet_fluid.getEnthalpy()

    inlet_fluid.setPressure(1.0, "bara")
    thermo_ops.PHflash(enthalpy)

Dependencies

Version Management

jneqsim uses a controlled release process to ensure compatibility:

  • Pinned Versions: Each jneqsim release is pinned to a specific, tested NeqSim JAR version
  • Automated Updates: The nightly CI workflow automatically checks for new NeqSim releases and publishes updated jneqsim packages when available
  • No Auto-Updates: Applications using jneqsim will not automatically download newer NeqSim versions - they use the tested version that comes with their installed jneqsim package
  • Cache Management: Downloaded JARs are cached locally in ~/.jneqsim/cache for faster subsequent usage

Development

Running Tests

The project uses pytest with custom markers to categorize tests. Test dependencies are already included in the development dependencies.

# Install development dependencies (includes pytest and pytest-mock)
poetry install

# Run unit tests (fast, excludes tests marked as slow)
pytest -v -m "not slow" tests/

# Run all tests (may download JARs for integration tests)
pytest -v tests/

# Run with coverage (requires pytest-cov)
poetry add --group dev pytest-cov
poetry run pytest --cov=jneqsim --cov-report=html tests/

Test markers:

  • slow: Tests that may download files or take longer to run
  • integration: Integration tests that require external dependencies
  • unit: Fast unit tests (default)

:+1: Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jneqsim-3.11.0rc0.tar.gz (2.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jneqsim-3.11.0rc0-py3-none-any.whl (702.3 kB view details)

Uploaded Python 3

File details

Details for the file jneqsim-3.11.0rc0.tar.gz.

File metadata

  • Download URL: jneqsim-3.11.0rc0.tar.gz
  • Upload date:
  • Size: 2.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jneqsim-3.11.0rc0.tar.gz
Algorithm Hash digest
SHA256 7793d25f5cf9651410d35c6de8feb343f3615007a3d4d0a78120ff3a80583787
MD5 e5c2c212e8d7c9d801ec91f53d0f4471
BLAKE2b-256 bb05521ac97c7546f1f0c5d68ea6359be2c10a273591c85aff294b750958dc60

See more details on using hashes here.

File details

Details for the file jneqsim-3.11.0rc0-py3-none-any.whl.

File metadata

  • Download URL: jneqsim-3.11.0rc0-py3-none-any.whl
  • Upload date:
  • Size: 702.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jneqsim-3.11.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccd3f597ea32c99f7448cbfc7f6cc15c62b9ef8ef16705fc2fd2dc5ce4e7574c
MD5 8140feeed1f3b150e609a0ff25f89b69
BLAKE2b-256 ffddc3b7b60abe45c751d5883d3e44a2c42fda84477311e71a1f0877ab2ec180

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page