Code Monkey home page Code Monkey logo

bmi-python's People

Contributors

bschilperoort avatar dependabot[bot] avatar mcflugen avatar mdpiper avatar mwtoews avatar visr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bmi-python's Issues

Mistake in type hints for tuples

The type hints of the Bmi class have a couple of return types as tuple[str]. For example:

def get_input_var_names(self) -> tuple[str]:

However, in python's typing system this means a tuple containing a single string. For a tuple of strings the correct type hint is:

    def get_input_var_names(self) -> tuple[str, ...]: 

To quote the Python documentation on this:

To denote a tuple which could be of any length, and in which all elements are of the same type T, use tuple[T, ...].

Too many dependencies

This package, in my opinion, has too many unnecessary dependencies. It think we should use argparse instead of click and make black an optional dependency.

set_value argument name: src or values

I just noticed in

bmi-python/bmipy/bmi.py

Lines 394 to 407 in 0fcca44

def set_value(self, name: str, values: np.ndarray) -> None:
"""Specify a new value for a model variable.
This is the setter for the model, used to change the model's
current state. It accepts, through *src*, a new value for a
model variable, with the type, size and rank of *src*
dependent on the variable.
Parameters
----------
var_name : str
An input or output variable name, a CSDMS Standard Name.
src : array_like
The new value for the specified variable.

That the argument name values does not match the src in the docstring and the src on the BMI website.

Since in Python these are not strictly positional but can be addressed as keyword arguments as well, I didn't just want to change it.

Bmi class is typed, but `py.typed` file is missing

To allow others to use the type hints provided in the bmipy/bmi.py:Bmi class, a py.typed file is required in the bmipy folder.
See the PEP-0561 info.

Without this file, type checkers cannot make use of the type hints, and mypy will return the following error:

error: Skipping analyzing "bmipy": module is installed, but missing library stubs or py.typed marker  [import]

Error importing bmipy-render output on Windows

On Windows, an error is thrown when attempting to import from a file created by bmipy-render. To reproduce it, try these steps:

  1. Clone the bmi-python repo and install bmipy from source.
  2. From the command line (I used the Git Bash shell), use bmipy-render to create a new file for a MyBmi class:
$ bmipy-render MyBmi > mybmi.py
  1. Try to import the class from the module:
$ python -c "from mybmi import MyBmi"

The result is an error, with message

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Mark\projects\bmi-python\mybmi.py", line 539
    """
       ^
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x93 in position 483: invalid start byte

New release?

A new release on PyPI should be published, since the most recent is 2.0 from December 2019. This will resolved a pip warning:

DEPRECATION: bmipy is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change.

This was already resolved by #12

Add CLI docs

We should add documentation on how to use bmipy-render.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.