From 40f5eea840d553ac07c93f74a8e2999e5480390d Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Sat, 15 Jun 2024 09:28:00 +0200 Subject: [PATCH 1/3] devguide: fix knight vs snail pic (#5502) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Before image ### After image ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** Co-authored-by: a <1@1.1> --- CONTRIBUTING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index ade1f4250..1fdee2507 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -3,7 +3,7 @@ ================= Developer's Guide ================= -.. image:: docs/_static/knight-vs-snail.jpg +.. image:: _static/knight-vs-snail.jpg :width: 80 % :alt: knight-vs-snail :align: center From f9d2842fb1a0c8b30cd92493bede982694ca8b3a Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Sat, 15 Jun 2024 18:31:50 +0200 Subject: [PATCH 2/3] docs: move section "Use the Nix Package manager with Xonsh" from rc to platform tips and tricks (#5503) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit subj ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> --- docs/platform-issues.rst | 30 ++++++++++++++++++++++++++++++ docs/xonshrc.rst | 31 ------------------------------- news/docs_nix.rst | 23 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 news/docs_nix.rst diff --git a/docs/platform-issues.rst b/docs/platform-issues.rst index d2fe7ccf1..b16556b46 100644 --- a/docs/platform-issues.rst +++ b/docs/platform-issues.rst @@ -30,6 +30,36 @@ lines to your ``~/.bashrc file``: unset module unset scl +Use the Nix Package manager with Xonsh +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +To users of the `Nix Package Manager `_ these few lines might be life-savers: + +.. code-block:: xonshcon + + import os.path + if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"): + $NIX_REMOTE="daemon" + $NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER + $NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile" + $NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" + $NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels" + $PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"] + +Btw. a hacky solution to install xontribs that do not yet ship with ``nixpkgs`` is: + +.. code-block:: xonshcon + + for p in map(lambda s: str(s.resolve()), p"~/.local/lib/".glob("python*/site-packages")): + if p not in sys.path: + sys.path.append(p) + + $PYTHONPATH = "$USER/.local/lib/python3.7/site-packages" + + python -m ensurepip --user + xonsh + python -m pip install --user -U pip xontrib-z xonsh-direnv + +Just run the last three lines, do not put them in your `xonshrc`! MacOS, OSX ---------- diff --git a/docs/xonshrc.rst b/docs/xonshrc.rst index e9b9c22d8..3a086e391 100644 --- a/docs/xonshrc.rst +++ b/docs/xonshrc.rst @@ -249,34 +249,3 @@ For a compact shell prompts, some people prefer a very condensed time format. Bu get_shelldate.fulldate = 0 $PROMPT_FIELDS['shelldate'] = get_shelldate - -Use the Nix Package manager with Xonsh -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -To users of the `Nix Package Manager `_ these few lines might be life-savers: - -.. code-block:: xonshcon - - import os.path - if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"): - $NIX_REMOTE="daemon" - $NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER - $NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile" - $NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" - $NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels" - $PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"] - -Btw. a hacky solution to install xontribs that do not yet ship with ``nixpkgs`` is: - -.. code-block:: xonshcon - - for p in map(lambda s: str(s.resolve()), p"~/.local/lib/".glob("python*/site-packages")): - if p not in sys.path: - sys.path.append(p) - - $PYTHONPATH = "$USER/.local/lib/python3.7/site-packages" - - python -m ensurepip --user - xonsh - python -m pip install --user -U pip xontrib-z xonsh-direnv - -Just run the last three lines, do not put them in your `xonshrc`! diff --git a/news/docs_nix.rst b/news/docs_nix.rst new file mode 100644 index 000000000..7090d2442 --- /dev/null +++ b/news/docs_nix.rst @@ -0,0 +1,23 @@ +**Added:** + +* Added section "Use the Nix Package manager with Xonsh" to "Platform-specific tips and tricks". + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From d30d0a5446237dda391e6623137cdc8dd0aa0154 Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Sat, 15 Jun 2024 18:32:32 +0200 Subject: [PATCH 3/3] docs: more links to xonshrc article (#5505) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After #5099 #5491 we need more links to xonshrc article in our docs. So I've added them. ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> --- docs/customization.rst | 2 +- docs/packages.rst | 2 +- docs/platform-issues.rst | 2 +- docs/tutorial_history_backend.rst | 2 +- docs/tutorial_xontrib.rst | 7 +++---- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docs/customization.rst b/docs/customization.rst index 8dfe3ca78..d056699b0 100644 --- a/docs/customization.rst +++ b/docs/customization.rst @@ -201,7 +201,7 @@ The problem might be: - Your locale is not set to utf-8, to check this you can set the content of the environment variable ``LC_TYPE`` - Your locale is correctly set but **after** xonsh started. This is typically - the case if you set your ``LC_TYPE`` inside your ``.xonshrc`` and xonsh is + the case if you set your ``LC_TYPE`` inside your `xonshrc `_ and xonsh is your default/login shell. To fix this you should see the documentation of your operating system to know how to correctly setup environment variables before the shell start (``~/.pam_environment`` for example) diff --git a/docs/packages.rst b/docs/packages.rst index 0963e71ef..8e6187b9b 100644 --- a/docs/packages.rst +++ b/docs/packages.rst @@ -84,7 +84,7 @@ or highlight syntax or set process title, respectively. If it does not find ``prompt-toolkit`` package, it will use the Python ``readline`` module (which reads configuration file ``.inputrc`` in a manner compatible with ``GNU readline``). To ensure xonsh uses ``readline`` even if ``prompt-toolkit`` is installed, configure this in your -``.xonshrc`` file: +`xonshrc `_ (e.g. ``~/.xonshrc``) file: .. code-block:: xonshcon diff --git a/docs/platform-issues.rst b/docs/platform-issues.rst index b16556b46..9c5184ce0 100644 --- a/docs/platform-issues.rst +++ b/docs/platform-issues.rst @@ -267,7 +267,7 @@ typing and avoid the ambiguity altogether: >>> aliases['d'] = ['cmd', '/c', 'dir'] -You can add aliases to your ``~/.xonshrc`` to have it always +You can add aliases to your `xonshrc `_ to have it always available when xonsh starts. diff --git a/docs/tutorial_history_backend.rst b/docs/tutorial_history_backend.rst index 25c7d090f..56459d019 100644 --- a/docs/tutorial_history_backend.rst +++ b/docs/tutorial_history_backend.rst @@ -39,7 +39,7 @@ content above into it. Now we need to tell xonsh to use it as the history backend. To do this we need xonsh to be able to find our file and this ``CouchDBHistory`` class. -Putting the following code into ``~/.xonshrc`` file can achieve this. +Putting the following code into `xonshrc `_ file can achieve this. .. code-block:: none diff --git a/docs/tutorial_xontrib.rst b/docs/tutorial_xontrib.rst index 945f61d87..cfbe8985e 100644 --- a/docs/tutorial_xontrib.rst +++ b/docs/tutorial_xontrib.rst @@ -104,12 +104,11 @@ create the layout for your xontrib package. Loading Xontribs ================ -Xontribs may be loaded in a few different ways: from the config file -(e.g. ``~/.config/xonsh/rc.xsh``), dynamically at runtime with -the ``xontrib`` command, or its Python API. +Xontribs may be loaded in a few different ways: from the `xonshrc `_ file +(e.g. ``~/.xonshrc``), dynamically at runtime with the ``xontrib`` command, or its Python API. Extensions are loaded via the ``xontrib load`` command. -This command may be run from anywhere in a xonshrc file or at any point +This command may be run from anywhere in a `xonshrc `_ file or at any point after xonsh has started up. .. code-block:: xonsh