Metadata-Version: 2.4
Name: fxy
Version: 0.8.2
Summary: Reusable computational namespaces for Python.
Author-email: Mindey <mindey@mindey.com>
Project-URL: Homepage, https://github.com/mindey/fxy
Project-URL: Repository, https://github.com/mindey/fxy
Project-URL: Issues, https://github.com/mindey/fxy/issues
Keywords: cas,scientific-computing,sympy,jupyter,ipython
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.8
Description-Content-Type: text/x-rst
License-File: LICENSE
Dynamic: license-file

fxy
===

Reusable computational namespaces for Python.

``fxy`` is a small way to name, share, inspect, and reuse the imports that make a
Python session feel like a particular mathematical or scientific language.

Instead of repeating setup cells across notebooks::

    import sympy as sp
    from sympy import symbols, Eq, solve, diff, integrate
    from mpmath import mp

a profile can make that vocabulary explicit::

    import fxy
    fxy.use("mindey/cas")

The interpreter stays ordinary Python.  The same profile can be used from
CPython, IPython, Jupyter, QtConsole, scripts, or another Python host.

Quick start
-----------

Install the zero-runtime-dependency core::

    pip install fxy

The core is pure Python and uses only the standard library. It can inspect,
cache, and resolve profiles without installing a numerical stack::

    import fxy

    fxy.available()
    # ('calc/v1', 'cas/v1', 'lab/v1')

    fxy.describe("mindey/cas")

Install any vocabulary through the same profile API::

    fxy.install("cas", approve=True)
    fxy.use("cas/v1")

    fxy.install("mindey/cas", approve=True)
    fxy.use("mindey/cas")

Unversioned built-in names are aliases for their current profile::

    fxy.use("cas")          # currently cas/v1

A profile can also be pinned to a Git ref::

    fxy.use("mindey/cas@main")
    fxy.use("mindey/cas@44e0c10f778d8564fa4ff884b5a22ed651f368a5")

The last form pins an immutable Git commit and is preferable when a notebook must
be reproducible.

What a profile is
-----------------

A profile is a computational vocabulary: a set of imports plus optional
dependency declarations.

Built-in profiles are registered by ``fxy`` itself.  GitHub-hosted profiles use
a declarative ``fxy.py`` at the repository root, for example::

    __fxy_profile__ = 1
    __requires__ = [
        "sympy>=1.13",
        "mpmath>=1.3",
    ]

    import sympy as sp
    from sympy import symbols, Eq, solve, diff, integrate
    from mpmath import mp

The profile file is parsed, not executed.  Schema version 1 permits import
statements and literal ``fxy`` metadata; arbitrary statements such as function
calls are rejected.  Imported Python packages retain their normal import-time
behavior.

This keeps two decisions separate:

1. **Which names should exist in this computational vocabulary?**
2. **Which packages may be installed into this Python environment?**

Dependency installation
-----------------------

Installing a profile's declared dependencies is always explicit::

    fxy.install("mindey/cas", approve=True)

For an interactive session, this is the equivalent one-step form::

    fxy.use("mindey/cas", install_missing=True)

Without approval, a missing dependency raises an error showing what the profile
declared rather than silently modifying the environment.

Profiles are cached under the user's cache directory.  Pass ``refresh=True`` to
``use()``, ``namespace()``, or ``describe()`` when you intentionally want to
refetch an unpinned branch or tag.

Inspecting profiles
-------------------

Profiles are inspectable without changing the current namespace::

    fxy.names("cas/v1")
    fxy.describe("cas/v1")
    fxy.diff("cas/v1", "lab/v1")

To materialize a profile as a dictionary instead of injecting it::

    ns = fxy.namespace("mindey/cas")
    ns["solve"](...)

Built-in profiles
-----------------

``calc/v1``
    The historical lightweight calculator vocabulary, centered on ``mpmath`` and
    ``eday``.

``cas/v1``
    The historical symbolic vocabulary, centered on SymPy and ``mpmath``.

``lab/v1``
    The historical numeric/data/scientific vocabulary.

The ``v1`` profiles intentionally preserve the legacy import-selection semantics.
Because the historical modules conditionally import optional dependencies, the
exact names realized by a ``v1`` profile can still depend on what is installed.

Future profile versions can be curated and dependency-declared without silently
changing notebooks that explicitly requested ``v1``.

Installing profile requirements
-------------------------------

The default installation has no runtime dependencies::

    pip install fxy

This is intentionally suitable for small Python environments, including
terminal/mobile environments such as Termux: the resolver itself does not pull
in NumPy, SymPy, mpmath, plotting libraries, or Jupyter.

A profile owns the declaration of the packages needed to realize its vocabulary.
Built-in and GitHub-hosted profiles use the same operation and approval boundary::

    fxy.install("calc", approve=True)
    fxy.install("cas/v1", approve=True)
    fxy.install("mindey/cas", approve=True)

There is deliberately no parallel ``fxy[...]`` installer namespace.
Profile requirements have one source of truth.

A GitHub-hosted profile does not need its own PyPI package merely to define a
vocabulary. Its repository can declare the packages it needs.

Publishing a profile
--------------------

For a simple public profile:

1. Create a public GitHub repository, for example ``alice/cas``.
2. Put a schema-1 ``fxy.py`` at its root.
3. Use it as ``fxy.use("alice/cas")``.
4. Pin a tag or commit when reproducibility matters.

This deliberately follows the familiar ``owner/repo[@ref]`` convention used by
many plugin ecosystems.  A future registry can therefore remain a thin discovery
layer mapping short names to Git sources rather than becoming a second package
repository.

Why profiles instead of predefined environments?
-------------------------------------------------

A predefined Jupyter kernel, shell environment, or QtConsole profile couples a
vocabulary to one execution surface.

``fxy`` instead makes the vocabulary reusable.  A notebook and a terminal REPL
can share the same profile while keeping their own interpreter, kernel,
environment manager, and user interface.

That separation is the main design direction of ``fxy`` 0.8+.

Portability
-----------

The core package targets Python 3.8+ and has zero runtime dependencies. The
wheel is platform-independent (``py3-none-any``). Platform-specific or compiled
requirements belong to the profile or optional extra that actually needs them,
not to the resolver itself.

This is deliberate: ``fxy`` should remain cheap to install even when the
scientific environment it can describe is large.

Legacy compatibility
--------------------

The older interfaces remain available for compatibility::

    from fxy.calc import *
    from fxy.cas import *
    from fxy.lab import *
    from fxy.plot import *

and the historical ``fxy`` launcher options (including the CAS/LAB and QtConsole
presets) continue to work.

For new notebooks and reusable code, these environment-style star imports and
launcher presets are **deprecated as the primary interface**.  Prefer
``fxy.use(...)`` or ``fxy.namespace(...)`` so the vocabulary is named,
inspectable, shareable, and optionally version-pinned.

There is no removal date for the legacy interfaces in the 0.x series; they are
kept as compatibility surfaces and may receive maintenance fixes.

Command-line calculator
-----------------------

The historical calculator command is optional. Install its profile
requirements through the same API::

    python -c "import fxy; fxy.install('calc', approve=True)"

Then::

    fxy
    python -m fxy "pi**2"

Without those profile requirements, the command exits with an actionable
message instead of silently opening a partial calculator.

The deprecated IPython/QtConsole launchers are execution frontends rather than
computational vocabularies; their third-party frontend packages are intentionally
not represented as ``fxy`` profile dependencies.

Links
-----

- Source: https://github.com/mindey/fxy
- PyPI: https://pypi.org/project/fxy/
- Example external profile: https://github.com/mindey/cas
