Skip to content

Commit 5f6f179

Browse files
authored
Merge pull request #694 from amoffat/develop
2.0.5 release
2 parents adb0af3 + e117fd8 commit 5f6f179

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3590
-402
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
9393
- name: Run tests
9494
run: |
95-
SH_TESTS_RUNNING=1 SH_TESTS_USE_SELECT=${{ matrix.use-select }} LANG=${{ matrix.lang }} poetry run coverage run -a -m unittest
95+
SH_TESTS_RUNNING=1 SH_TESTS_USE_SELECT=${{ matrix.use-select }} LANG=${{ matrix.lang }} poetry run coverage run -a -m pytest
9696
9797
- name: Store coverage
9898
uses: actions/upload-artifact@v2

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ __pycache__/
66
/.venv/
77
/build
88
/dist
9+
/docs/build
10+
/TODO.md
11+
/htmlcov/

.readthedocs.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.10"
13+
jobs:
14+
post_create_environment:
15+
- pip install poetry
16+
- poetry config virtualenvs.create false
17+
post_install:
18+
- poetry install
19+
- pip install -e .
20+
21+
# Build documentation in the "docs/" directory with Sphinx
22+
sphinx:
23+
configuration: docs/source/conf.py
24+
# Optional but recommended, declare the Python requirements required
25+
# to build your documentation
26+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
27+
python:
28+
install:
29+
- requirements: docs/requirements.txt

.vscode/tasks.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Doc builder",
8+
"type": "shell",
9+
"command": "source ${workspaceFolder}/.venv/bin/activate && find source/ | entr -s 'make clean && make html'",
10+
"options": {
11+
"cwd": "${workspaceFolder}/docs"
12+
},
13+
"problemMatcher": [],
14+
"group": {
15+
"kind": "build"
16+
},
17+
"isBackground": true,
18+
"presentation": {
19+
"echo": true,
20+
"reveal": "always",
21+
"focus": true,
22+
"panel": "dedicated",
23+
"showReuseMessage": false,
24+
"clear": true,
25+
"close": true
26+
}
27+
}
28+
]
29+
}

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Changelog
22

3+
## 2.0.5 - 8/7/23
4+
5+
- Allow nested `with` contexts [#690](https://github.com/amoffat/sh/issues/690)
6+
- Call correct asyncio function for getting event loop [#683](https://github.com/amoffat/sh/issues/683)
7+
38
## 2.0.4 - 5/13/22
49

5-
- Allow `ok_code` to be used with `fg` [#655](https://github.com/amoffat/sh/pull/655)
10+
- Allow `ok_code` to be used with `fg` [#665](https://github.com/amoffat/sh/pull/665)
611
- Make sure `new_group` never creates a new session [#675](https://github.com/amoffat/sh/pull/675)
712

813
## 2.0.2 / 2.0.3 (misversioned) - 2/13/22

MIGRATION.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,28 @@ Previously, if the first argument of a sh command was an instance of `RunningCom
8080
it was automatically fed into the process's STDIN. This is no longer the case and you
8181
must explicitly use `_in=`.
8282

83+
```python
84+
from sh import wc,ls
85+
86+
print(wc(ls("/home/<user>", "-l"), "-l"))
87+
```
88+
89+
Becomes:
90+
91+
```python
92+
from sh import wc,ls
93+
94+
print(wc("-l", _in=ls("/home/<user>", "-l")))
95+
```
96+
97+
Or:
98+
99+
```python
100+
from sh import wc,ls
101+
102+
print(wc("-l", _in=ls("/home/<user>", "-l", _return_cmd=True)))
103+
```
104+
83105
### Workaround
84106

85107
None

README.rst

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515
.. image:: https://img.shields.io/pypi/pyversions/sh.svg?style=flat-square
1616
:target: https://pypi.python.org/pypi/sh
1717
:alt: Python Versions
18-
.. image:: https://img.shields.io/travis/amoffat/sh/master.svg?style=flat-square
19-
:target: https://travis-ci.org/amoffat/sh
20-
:alt: Build Status
2118
.. image:: https://img.shields.io/coveralls/amoffat/sh.svg?style=flat-square
2219
:target: https://coveralls.io/r/amoffat/sh?branch=master
2320
:alt: Coverage Status
2421

2522
|
2623
27-
sh is a full-fledged subprocess replacement for Python 3.8 - 3.10, PyPy and PyPy3
24+
sh is a full-fledged subprocess replacement for Python 3.8 - 3.11, and PyPy
2825
that allows you to call *any* program as if it were a function:
2926

3027
.. code:: python
@@ -37,7 +34,7 @@ sh is *not* a collection of system commands implemented in Python.
3734
sh relies on various Unix system calls and only works on Unix-like operating
3835
systems - Linux, macOS, BSDs etc. Specifically, Windows is not supported.
3936

40-
`Complete documentation here <https://amoffat.github.io/sh>`_
37+
`Complete documentation here <https://sh.readthedocs.io/>`_
4138

4239
Installation
4340
============
@@ -55,11 +52,6 @@ Support
5552
Developers
5653
==========
5754

58-
Updating the docs
59-
-----------------
60-
61-
Check out the `gh-pages <https://github.com/amoffat/sh/tree/gh-pages>`_ branch and follow the ``README.rst`` there.
62-
6355
Testing
6456
-------
6557

@@ -76,7 +68,7 @@ Coverage
7668

7769
First run all of the tests::
7870

79-
$> SH_TESTS_RUNNING=1 coverage run --source=sh -m unittest
71+
$> SH_TESTS_RUNNING=1 coverage run --source=sh -m pytest
8072

8173
This will aggregate a ``.coverage``. You may then visualize the report with::
8274

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?= -a -W
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
toml==0.10.2

docs/source/conf.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
3+
from pathlib import Path
4+
5+
import toml
6+
7+
_THIS_DIR = Path(__file__).parent
8+
_REPO = _THIS_DIR.parent.parent
9+
_PYPROJECT = _REPO / "pyproject.toml"
10+
11+
pyproject = toml.load(_PYPROJECT)
12+
nitpicky = True
13+
14+
nitpick_ignore = [
15+
("py:class", "Token"),
16+
("py:class", "'Token'"),
17+
]
18+
19+
nitpick_ignore_regex = [
20+
("py:class", r".*lark.*"),
21+
]
22+
23+
version = pyproject["tool"]["poetry"]["version"]
24+
release = version
25+
26+
# -- Project information
27+
28+
project = "sh"
29+
copyright = "2023, Andrew Moffat"
30+
author = "Andrew Moffat"
31+
32+
# -- General configuration
33+
34+
extensions = [
35+
"sphinx.ext.duration",
36+
"sphinx.ext.doctest",
37+
"sphinx.ext.autodoc",
38+
"sphinx.ext.autosummary",
39+
"sphinx.ext.intersphinx",
40+
"sphinx.ext.todo",
41+
]
42+
43+
intersphinx_mapping = {
44+
"python": ("https://docs.python.org/3/", None),
45+
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
46+
"lark": ("https://lark-parser.readthedocs.io/en/latest/", None),
47+
"jinja2": ("https://jinja.palletsprojects.com/en/latest/", None),
48+
}
49+
intersphinx_disabled_domains = ["std"]
50+
51+
templates_path = ["_templates"]
52+
53+
# -- Options for HTML output
54+
55+
html_theme = "sphinx_rtd_theme"
56+
57+
# -- Options for EPUB output
58+
epub_show_urls = "footnote"
59+
60+
autodoc_typehints = "both"
61+
62+
add_module_names = False

0 commit comments

Comments
 (0)