Skip to content

Commit

Permalink
Merge branch 'shared-libs-drop-setuptools-wheel' of github.com:chrysl…
Browse files Browse the repository at this point in the history
…e/pipx into shared-libs-drop-setuptools-wheel
  • Loading branch information
chrysle committed Dec 1, 2023
2 parents 51a010b + e886f18 commit df0efad
Show file tree
Hide file tree
Showing 37 changed files with 272 additions and 189 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create_tests_package_lists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/exhaustive_package_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: |
nox --error-on-missing-interpreters --non-interactive --session build
- name: Publish to Test PyPi
uses: pypa/[email protected].7
uses: pypa/[email protected].11
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
32 changes: 0 additions & 32 deletions .github/workflows/publish_docs.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- os: windows-latest
python-version: "3.11"
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
run: |
nox --error-on-missing-interpreters --non-interactive --session build
- name: Publish to PyPi
uses: pypa/[email protected].7
uses: pypa/[email protected].11
with:
user: __token__
password: ${{ secrets.pypi_password }}
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: check-added-large-files
- id: trailing-whitespace
- id: check-yaml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.254
rev: v0.1.3
hooks:
- id: ruff
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.10.1
hooks:
- id: black
# mypy args:
Expand All @@ -27,7 +27,7 @@ repos:
# cannot use --warn-unused-ignores because it conflicts with
# --ignore-missing-imports
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.6.1
hooks:
- id: mypy
args: ['--warn-unused-ignores', '--strict-equality','--no-implicit-optional']
Expand Down
11 changes: 11 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"
commands:
- pip install nox
- nox --session build_docs -- "${READTHEDOCS_OUTPUT}"/html
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
- Drop `setuptools` and `wheel` from the shared libraries. This results in less time consumption when the libraries are
automatically upgraded.
- Allow running `pip` with `pipx run`
- Support PEP 723 run requirements in `pipx run`.
- Imply `--include-apps` when running `pipx inject --include-deps`
- Add `--with-suffix` for `pipx inject` command
- `pipx install`: emit a warning when `--force` and `--python` were passed at the same time
- Drop support for Python 3.7
- Make usage message in `pipx run` show `package_or_url`, so extra will be printed out as well
- Add `--force-reinstall` to pip arguments when `--force` was passed
- Use the py launcher, if available, to select Python version with the `--python` option
Expand All @@ -19,6 +24,11 @@ automatically upgraded.
- Pass `--no-input` to pip when output is not piped to parent stdout
- Fix program name in generated manual page
- Print all environment variables in `pipx environment`
- Return an error message when directory can't be added to PATH successfully

## 1.2.1

- Fix compatibility to packaging 23.2+ by removing reliance on packaging's requirement validation logic and detecting a URL-based requirement in pipx. (#1070)

## 1.2.0

Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ _For comparison to other tools including pipsi, see [Comparison to Other Tools](

## Install pipx

> [!NOTE]
> It is not recommended to install `pipx` via `pipx`. If you'd like
> to do this anyway, take a look at the
> [`pipx-in-pipx`](https://github.com/mattsb42-meta/pipx-in-pipx) project and
> read about the limitations there.
### On macOS

```
Expand All @@ -35,7 +41,17 @@ pipx ensurepath

Upgrade pipx with `brew update && brew upgrade pipx`.

### On Linux, install via pip (requires pip 19.0 or later)
### On Linux

- Ubuntu 23.04 or above

```
sudo apt update
sudo apt install pipx
pipx ensurepath
```

- Ubuntu 22.04 or below

```
python3 -m pip install --user pipx
Expand All @@ -47,8 +63,8 @@ Upgrade pipx with `python3 -m pip install --user --upgrade pipx`.
### On Windows, install via pip (requires pip 19.0 or later)

```
# If you installed python using the app-store, replace `python` with `python3` in the next line.
python -m pip install --user pipx
# If you installed python using Microsoft Store, replace `py` with `python3` in the next line.
py -m pip install --user pipx
```

It is possible (even most likely) the above finishes with a WARNING looking similar to this:
Expand All @@ -67,9 +83,9 @@ Enter the following line (even if you did not get the warning):
This will add both the above mentioned path and the `%USERPROFILE%\.local\bin` folder to your search path.
Restart your terminal session and verify `pipx` does run.

Upgrade pipx with `python3 -m pip install --user --upgrade pipx`.
Upgrade pipx with `py -m pip install --user --upgrade pipx`.

### Via zipapp
### Using pipx without installing (via zipapp)

You can also use pipx without installing it.
The zipapp can be downloaded from [Github releases](https://github.com/pypa/pipx/releases) and you can invoke it with a Python 3.7+ interpreter:
Expand Down
24 changes: 15 additions & 9 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You also need to have `pip` installed on your machine for `python3`. Installing

pipx works on macOS, linux, and Windows.

## Install pipx
## Installing pipx

On macOS:

Expand All @@ -18,8 +18,8 @@ pipx ensurepath
On Windows (requires pip 19.0 or later):

```
py -3 -m pip install --user pipx
py -3 -m pipx ensurepath
py -m pip install --user pipx
py -m pipx ensurepath
```

Otherwise, install via pip (requires pip 19.0 or later):
Expand All @@ -29,18 +29,24 @@ python3 -m pip install --user pipx
python3 -m pipx ensurepath
```

Or via zipapp:
!!!caution
It is not recommended to install `pipx` via `pipx`. If you'd like
to do this anyway, take a look at the
[`pipx-in-pipx`](https://github.com/mattsb42-meta/pipx-in-pipx) project and
read about the limitations there.

You can also use pipx without installing it.

### Using pipx without installing (via zipapp)
The zipapp can be downloaded from [Github releases](https://github.com/pypa/pipx/releases) and you can invoke it with a Python 3.7+ interpreter:

```
python pipx.pyz ensurepath
```

<a name="pre-commit"></a>Or use with pre-commit:
### <a name="pre-commit"></a> Using pipx with pre-commit

Pipx has [pre-commit](https://pre-commit.com/) support. This lets you run applications:

* That can be run using `pipx run` but don't have native pre-commit support.
* Using its prebuilt wheel from pypi.org instead of building it from source.
* Using pipx's `--spec` and `--index-url` flags.
Expand All @@ -58,7 +64,7 @@ Example configuration for use of the code linter [yapf](https://github.com/googl
types: ['python']
```
### Installation Options
## Installation Options
The default binary location for pipx-installed apps is `~/.local/bin`. This can be overridden with the environment variable `PIPX_BIN_DIR`.

Expand All @@ -82,8 +88,8 @@ sudo PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin pipx install PACKAGE
| `~/.local/pipx/venvs` | `platformdirs.user_data_dir()/pipx/venv` |
| `~/.local/pipx/.cache` | `platformdirs.user_cache_dir()/pipx` |
| `~/.local/pipx/logs` | `platformdirs.user_log_dir()/pipx/log` |
`user_data_dir()`, `user_cache_dir()` and `user_log_dir()` resolve to appropriate platform-specific user data, cache and log directories.

`user_data_dir()`, `user_cache_dir()` and `user_log_dir()` resolve to appropriate platform-specific user data, cache and log directories.
See the [platformdirs documentation](https://platformdirs.readthedocs.io/en/latest/api.html#platforms) for details.

## Upgrade pipx
Expand Down
33 changes: 19 additions & 14 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,23 @@ rm -rf test_venv

## Pipx files not in expected locations according to documentation

The default PIPX_HOME is `~/.local/pipx`, prior to the adoption of the XDG base
directory specification after version 1.2.0. To maintain compatibility with older
versions, pipx will automatically detect the old paths and use them accordingly.
For a map of old and new paths, See [Installation](installation.md#installation-options)

To migrate from the old path to the new path, you can remove the `~/.local/pipx` directory and
reinstall all packages.

For example, on Linux systems, you could read out `pipx`'s package information in JSON via `jq` (which you might need to install first):

```
packages=($(pipx list --json | jq '.venvs | keys[]' -r))
rm -rf ~/.local/pipx
for p in ${packages[@]}; do pipx install "$p"; done
Pipx versions after 1.2.0 adopt the XDG base directory specification for
the location of `PIPX_HOME` and the data, cache, and log directories.
Version 1.2.0 and earlier use `~/.local/pipx` as the default `PIPX_HOME`
and install the data, cache, and log directories under it. To maintain
compatibility with older versions, pipx will automatically use this old
`PIPX_HOME` path if it exists. For a map of old and new paths, see
[Installation](installation.md#installation-options).

If you have a `pipx` version later than 1.2.0 and want to migrate from
the old path to the new paths, you can move the `~/.local/pipx`
directory to the new location (after removing cache, log, and trash
directories which will get recreated automatically) and then reinstall
all packages. For example, on Linux systems, `PIPX_HOME` moves from
`~/.local/pipx` to `~/.local/share/pipx` so you can do this:

```
rm -rf ~/.local/pipx/{.cache,logs,trash}
mkdir -p ~/.local/share && mv ~/.local/pipx ~/.local/share/
pipx reinstall-all
```
19 changes: 6 additions & 13 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

import nox # type: ignore

PYTHON_ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
PYTHON_ALL_VERSIONS = ["3.8", "3.9", "3.10", "3.11"]
PYTHON_DEFAULT_VERSION = "3.11"
DOC_DEPENDENCIES = [".", "jinja2", "mkdocs", "mkdocs-material"]
MAN_DEPENDENCIES = [".", "argparse-manpage[setuptools]"]
LINT_DEPENDENCIES = [
"black==22.8.0",
"mypy==1.1.1",
"black==23.10.1",
"mypy==1.6.1",
"packaging>=20.0",
"ruff==0.0.254",
"ruff==0.1.3",
"types-jinja2",
]
# Packages whose dependencies need an intact system PATH to compile
Expand Down Expand Up @@ -193,21 +193,14 @@ def publish(session):

@nox.session(python=PYTHON_DEFAULT_VERSION)
def build_docs(session):
site_dir = session.posargs or ["site/"]
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install(*DOC_DEPENDENCIES)
session.env[
"PIPX__DOC_DEFAULT_PYTHON"
] = "typically the python used to execute pipx"
session.run("python", "scripts/generate_docs.py")
session.run("mkdocs", "build", "--strict")


@nox.session(python=PYTHON_DEFAULT_VERSION)
def publish_docs(session):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install(*DOC_DEPENDENCIES)
build_docs(session)
session.run("mkdocs", "gh-deploy", "--strict")
session.run("mkdocs", "build", "--strict", "--site-dir", *site_dir)


@nox.session(python=PYTHON_DEFAULT_VERSION)
Expand Down
Loading

0 comments on commit df0efad

Please sign in to comment.