Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
unyts
I saw the opportunity to use a digraph network to build a units converter able to convert from any units to any units without the need to populate an endless table of possible conversions. Powered by the Breadth First Search, or BFS, algorithm to search through the network, this converter can find conversions from a particular Unit (or ratio of units) to any other Unit (or ratio) as long as a path connecting them exists.
This package is under development and is regularly updated. Back compatibility is intended to be maintained when possible.
This package is intended to be used in three ways:
units()
to define instances of the Units class, that holds values associated to units, or, quantities.convert()
to explicitly make conversion of numeric variables and instances.From an OS terminal or console, execute python -m unyts
In the interface, simpy type in the units to convert and the value to be converted and click the convert button or hit Enter key.
convert()
:from unyts import convert
convert(value, from_units, to_units)
where:
units()
function:from unyts import units
variable = units(value, units)
int
, float
, numpy.array
, etc)Then simply operate with the Unit instances or the variables related to them:
In: units(6, 'in') + units(1, 'ft')
Out: 18_in
Unit
class:from unyts import Unit
Unit
class is not intended to be used to create Unit instances, but to allow checking if other object isinstance
of Unit: i.e.: isinstance(variable, Unit)
units()
function as it will return the appropriate Unit subclass.For further examples of use, the following Jupyter notebook unyts_demo intends to be a guide on how to use this converter and units classes.
Install it from the pypi.org repository:
pip install unyts
or upgrade to the latest version:
pip install --upgrade unyts
The main functionalities are purely Python powered and does not require any other package to work but, if present, some commonly known packages are used to improve the operability of unyts
:
NumPy
to be able to deal with iterables not of nparray type, like (list of values)Pandas
to be able to recognize Series and DataFramescloudpickle
to be able to save internal dictionaries and network to cache file, for faster loadingopenpyxl
if willing to export the units network to a pandas DataFrameFAQs
an unit converter based on graph network and classes to operate with units.
We found that unyts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.