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.
.. |isympy| replace:: isympy
Imports and command fxy
with parameters to import libraries often used in research to emulate CAS software, or LAB software.
R
, love that you can start quickly using it as a CALCulator,Maple
, Mathematica
have isympy
, that is narrowly focused,Matlab
and R
may find that Python
requires quite a few imports just to do equivalent computing in Python.This package fxy
is a shorthand to do the imports packages to approximate these domains (CALC, CAS, and LAB) you've got a command fxy
, that starts Python with needed packages pre-imported: so, you can start using Python like a calculator right away.
pip install fxy
to get the import shortcuts.$ fxy
(pass, -i
for IPython)
from fxy.calc import *
for quick CALC - basic mpmath
calculator, and eday
for timefrom fxy.cas import *
for basic CAS software ("Symbolic") emulationfrom fxy.lab import *
for LAB software ("Numeric") emulationfrom fxy.plot import *
for plotting imports.The package defines the fxy
command, if you just want Python with something, run:
$ fxy --calc
starts Python with CALC imports (basic mpmath
calculator)$ fxy --cas
(or -x
) starts Python with CAS (Computer Algebra System) imports (to emulate Maple, Matematica,..)$ fxy --lab
(or -y
) starts Python with LAB (Linear AlgeBra system) imports (to emulate MATLAB, R,...)$ fxy --plot
(or -p
) for plotting importsSo, for example, if you want LAB imports with plotting and in IPython, then you'd:
$ fxy -ip --lab
You can also run the equivalent of --calc
environment, that imports mpmath
and eday
, like this:
python -m fxy "pi**2"
The following are usage examples.
::
>>> from fxy.calc import *
>>> pi
<pi: 3.14159~>
>>> mp.dps = 250
>>> print(pi)
>>> from fxy.plot import *
>>> plt.plot([1, 2, 3, 4])
>>> plt.ylabel('some numbers')
>>> plt.show()
::
>>> from fxy.cas import *
>>> f = x**4 - 4*x**3 + 4*x**2 - 2*x + 3
>>> f.subs([(x, 2), (y, 4), (z, 0)])
-1
>>> plot(f)
>>> plot3d(x**2-y**2)
::
>>> from fxy.lab import *
>>> df = pandas.DataFrame({'x': numpy.arange(10), 'y': np.random.random(10)})
>>> df.sum()
x 45.000000
y 4.196558
dtype: float64
>>> X = [[0], [1], [2], [3]]
>>> y = [0, 0, 1, 1]
>>> neigh = sklearn.neighbors.KNeighborsClassifier(n_neighbors=3)
>>> neigh.fit(X, y)
>>> print(neigh.predict([[1.1]]))
[0]
>>> print(neigh.predict_proba([[0.9]]))
[[0.66666667 0.33333333]]
If you envy R
users being able to start their 'calculator' with just one key, add something like the below to your ~/.zshrc
:
::
# Basic Calculaor
function f() {
. ~/.venv/bin/activate
fxy "$@"
}
# Computer Algebra System
function F() {
. ~/.venv/bin/activate
fxy --qt --cas
}
Aliasing fxy
as f
command as simplest generic, and commonly used specific as F
command makes it possible to:
f
to start Python with just mpmath
for fastest scientific calculations without IPython
.F
to start Python with some specific other pre-configuration that you often use (e.g., f -ix
emulates isympy
)... _isympy: https://linux.die.net/man/1/isympy
FAQs
Convenience imports and scientific functions.
We found that fxy 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.