From 2221e03868526b8f0376c92a22feb24c302c7707 Mon Sep 17 00:00:00 2001 From: Robert <49005401+Gitznik@users.noreply.github.com> Date: Sun, 14 Jan 2024 19:59:05 +0100 Subject: [PATCH] Introduce towncrier (#1201) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Introduce towncrier with basic configuration * Format changelog according to keep a changelog * Add pre-commit hook * Add changelog entry * Update PR template * Switch to default fragment types * Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: chrysle * Update news contribution docs * Update bump changelog workflow * Remove redundant news fragments * Add empty gitignore file to make sure changelog.d folder is tracked * Apply suggestions from code review Co-authored-by: chrysle * Add changelog entry * Build changelog during `build_docs` nox command * Moved towncrier changelog entry to docs block * Stop adding version number to top of changelog via mkdocs script * Render current newsfragments cleanly during build docs * Remove extra stdout lines from towncrier build step * Add draft changelog file to gitignore * Add upcoming changes to prod changelog * Remove draft changelog in site after build * Create news fragment for current dev changelog --------- Co-authored-by: Bernát Gábor Co-authored-by: chrysle --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/tests.yml | 2 +- .gitignore | 1 + CHANGELOG.md | 251 +++++++++++++++++++------------ CONTRIBUTING.md | 36 +++++ changelog.d/.gitignore | 1 + changelog.d/1161.doc.md | 1 + changelog.d/1198.doc.md | 1 + mkdocs.yml | 1 + noxfile.py | 25 ++- pyproject.toml | 9 ++ scripts/gen_doc_pages.py | 5 - 12 files changed, 234 insertions(+), 101 deletions(-) create mode 100644 changelog.d/.gitignore create mode 100644 changelog.d/1161.doc.md create mode 100644 changelog.d/1198.doc.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 72d0e0e3d3..7156958400 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ -- [ ] I have added an entry to `docs/changelog.md` +- [ ] I have added a news fragment under `changelog.d/` (if the patch affects the end users) ## Summary of changes diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 595ae2965c..e17ddb7e87 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -139,7 +139,7 @@ jobs: - name: Create pull request branch run: git switch -c "bump-changelog-for-${RELEASE_VERSION}" - name: Update changelog - run: echo -e "## dev\n\n## $RELEASE_VERSION\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md + run: pipx run towncrier build --yes --version $RELEASE_VERSION - name: Commit and push change run: | git config --global user.name 'github-actions[bot]' diff --git a/.gitignore b/.gitignore index 3389d5f368..de63dbc458 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ __pycache__ build *.whl /pipx.1 +/docs/_draft_changelog.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f1e9aa4ea..31450ee066 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,139 +1,204 @@ -## dev +# Changelog -- [docs] Add workaround for using pipx applications in shebang under macOS +All notable changes to this project will be documented in this file. -## 1.4.2 +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +This project uses [*towncrier*](https://towncrier.readthedocs.io/) for keeping the changelog. DO NOT commit any changes to this file. +{% include '_draft_changelog.md' ignore missing %} + + + +## [1.4.2](https://github.com/pypa/pipx/tree/1.4.2) + +### Features - Allow skipping maintenance tasks during list command - Raise more user friendly error when provided `--python` version is not found - Update `pipx run` on scripts using `/// script` and no `run` table following the updated version of PEP 723 (#1180) -- Avoid repeated exception logging in a few rare cases (#1192) + +### Bugfixes + - Include `tomli` into `pipx.pyz` (zipapp) so that it can be executed with Python 3.10 or earlier (#1142) - Fix resolving the python executable path on linux - `pipx run`: Verify whether the script name provided is a file before running it +- Avoid repeated exception logging in a few rare cases (#1192) -## 1.4.1 +## [1.4.1](https://github.com/pypa/pipx/tree/1.4.1) + +### Bugfixes - Set default logging level to WARNING, so debug log messages won't be shown without passing additional flags such as `--verbose` -## 1.4.0 +## [1.4.0](https://github.com/pypa/pipx/tree/1.4.0) + +### Features -- Delete directories directly instead of spawning rmdir on Windows -- Fix "Failed to delete" error when using Microsoft Store Python -- Fix "No pyvenv.cfg file" error when using Microsoft Store Python (#1164) - Add `--quiet` and `--verbose` options for the `pipx` subcommands -- [docs] Add Scoop installation instructions - Add ability to install multiple packages at once +- Delete directories directly instead of spawning rmdir on Windows + +### Improved Documentation + +- Add Scoop installation instructions + +### Bugfixes -## 1.3.3 +- "Failed to delete" error when using Microsoft Store Python +- "No pyvenv.cfg file" error when using Microsoft Store Python (#1164) -- [docs] Make the logo more visible in dark mode +## [1.3.3](https://github.com/pypa/pipx/tree/1.3.3) -## 1.3.2 +### Improved Documentation + +- Make the logo more visible in dark mode + +## [1.3.2](https://github.com/pypa/pipx/tree/1.3.2) + +### Features - The project version number is now dynamic and generated from the VCS at build time -- [docs] Add additonal example for --pip-args option, to docs/examples.md -## 1.3.1 +### Improved Documentation + +- Add additonal example for --pip-args option, to docs/examples.md + +## [1.3.1](https://github.com/pypa/pipx/tree/1.3.1) + +### Bugfixes - Fix combining of --editable and --force flag -## 1.3.0 +## [1.3.0](https://github.com/pypa/pipx/tree/1.3.0) + +### Features +- Allow running `pip` with `pipx run` +- Add `--with-suffix` for `pipx inject` command +- `pipx install`: emit a warning when `--force` and `--python` were passed at the same time +- Add explicit 3.12 support +- Make usage message in `pipx run` show `package_or_url`, so extra will be printed out as well +- Use the py launcher, if available, to select Python version with the `--python` option +- add pre-commit hook support +- Add `pipx install --preinstall` to support preinstalling build requirements +- Return an error message when directory can't be added to PATH successfully +- Expose manual pages included in an application installed with `pipx install` - Check whether pip module exists in shared lib before performing any actions, such as `reinstall-all`. - 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 [inline script metadata](https://packaging.python.org/en/latest/specifications/inline-script-metadata/) 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 - Support including requirements in scripts run using `pipx run` (#916) - Pass `pip_args` to `shared_libs.upgrade()` - Fallback to user's log path if the default log path (`$PIPX_HOME/logs`) is not writable to aid with pipx being used for multi-user (e.g. system-wide) installs of applications -- Fix wrong interpreter usage when injecting local pip-installable dependencies into venvs -- add pre-commit hook support - Don't show escaped backslashes for paths in console output - Move `pipx` paths to ensure compatibility with the platform-specific user directories -- [docs] Add more examples for `pipx run` -- [docs] Add subsection to make README easier to read -- Add `pipx install --preinstall` to support preinstalling build requirements - 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 -- Expose manual pages included in an application installed with `pipx install` -- Add explicit 3.12 support -## 1.2.1 +### Improved Documentation + +- Add more examples for `pipx run` +- Add subsection to make README easier to read + +### Deprecations and Removals + +- Drop support for Python 3.7 + +### Bugfixes + +- Fix wrong interpreter usage when injecting local pip-installable dependencies into venvs +- Fix program name in generated manual page + +## [1.2.1](https://github.com/pypa/pipx/tree/1.2.1) + +### Bugfixes - 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 +## [1.2.0](https://github.com/pypa/pipx/tree/1.2.0) + +### Features -- Add test for pip module in `pipx reinstall` to fix an issue with `pipx reinstall-all` (#935) - Add `pipx uninject` command (#820) -- [docs] Fix `pipx run` examples and update Python versions used by `pipx install` examples -- [docs] Add an example for installation from source with extras -- Match pip's behaviour when package name ends with archive extension (treat it as a path) - Ship a [zipapp](https://docs.python.org/3/library/zipapp.html) of pipx +- Match pip's behaviour when package name ends with archive extension (treat it as a path) - Change the program name to `path/to/python -m pipx` when running as `python -m pipx` - Improve the detection logic for MSYS2 to avoid entering infinite loop (#908) (#938) - Remove extra trailing quote from exception message - Fix EncodingWarning in `pipx_metadata_file`. -## 1.1.0 +### Improved Documentation + +- Add an example for installation from source with extras +- Fix `pipx run` examples and update Python versions used by `pipx install` examples + +### Bugfixes + +- Add test for pip module in `pipx reinstall` to fix an issue with `pipx reinstall-all` (#935) + +## [1.1.0](https://github.com/pypa/pipx/tree/1.1.0) + +### Features -- Fix encoding issue on Windows when pip fails to install a package -- Improve the behaviour of `shlex.split` on Windows, so paths on Windows can be handled properly when they are passed in - `--pip-args`. (#794) - Add `pipx environment` command (#793) - Add `list --short` option to list only package names (#804) -- [docs] Fix the command for - [installing development version](https://pipx.pypa.io/stable/installation/#install-pipx-development-versions). (#801) -- [docs] Fix test status badge in readme file -- [docs] Add more examples +- Improve the behaviour of `shlex.split` on Windows, so paths on Windows can be handled properly when they are passed in + `--pip-args`. (#794) - [dev] Change github action job names -- [docs] Add additional examples for installation from git repos +- Add additional examples for installation from git repos - [packaging] Switch to [PEP 621](https://www.python.org/dev/peps/pep-0621/) - Add a CACHEDIR.TAG to the cache directory to prevent it from being included in archives and backups. For more information about cache directory tags, see https://bford.info/cachedir -## 1.0.0 +### Bugfixes + +- Fix encoding issue on Windows when pip fails to install a package + +### Improved Documentation + +- Add more examples +- Fix the command for + [installing development version](https://pipx.pypa.io/stable/installation/#install-pipx-development-versions). (#801) +- Fix test status badge in readme file + +## [1.0.0](https://github.com/pypa/pipx/tree/1.0.0) + +### Features - Support [argcomplete 2.0.0](https://pypi.org/project/argcomplete/2.0.0) (#790) - Include machinery to build a manpage for pipx with [argparse-manpage](https://pypi.org/project/argparse-manpage/). - Add better handling for 'app not found' when a single app is present in the project, and an improved error message (#733) + +### Bugfixes + - Fixed animations sending output to stdout, which can break JSON output. (#769) - Fix typo in `pipx upgrade-all` output -## 0.17.0 +## [0.17.0](https://github.com/pypa/pipx/tree/0.17.0) - Support `pipx run` with version constraints and extras. (#697) -## 0.16.5 +## [0.16.5](https://github.com/pypa/pipx/tree/0.16.5) - Fixed `pipx list` output phrasing to convey that python version displayed is the one with which package was installed. - Fixed `pipx install` to provide return code 0 if venv already exists, similar to pip’s behavior. (#736) - [docs] Update ansible's install command in [Programs to Try document](https://pipx.pypa.io/stable/programs-to-try/#ansible) to work with Ansible 2.10+ (#742) -## 0.16.4 +## [0.16.4](https://github.com/pypa/pipx/tree/0.16.4) - Fix to `pipx ensurepath` to fix behavior in user locales other than UTF-8, to fix #644. The internal change is to use userpath v1.6.0 or greater. (#700) - Fix virtual environment inspection for Python releases that uses an int for its release serial number. (#706) - Fix PermissionError in windows when pipx manages itself. (#718) -## 0.16.3 +## [0.16.3](https://github.com/pypa/pipx/tree/0.16.3) - Organization: pipx is extremely pleased to now be a project of the Python Packaging Authority (PyPA)! Note that our github URL has changed to [pypa/pipx](https://github.com/pypa/pipx) @@ -151,14 +216,14 @@ * Colorama is now only installed on Windows. (#691) -## 0.16.2.1 +## [0.16.2.1](https://github.com/pypa/pipx/tree/0.16.2.1) - Changed non-venv-info warnings and notices from `pipx list` to print to stderr. This especially prevents `pipx list --json` from printing invalid json to stdout. (#680) - Fixed bug that could cause uninstall on Windows with injected packages to uninstall too many apps from the local binary directory. (#679) -## 0.16.2.0 +## [0.16.2.0](https://github.com/pypa/pipx/tree/0.16.2.0) - Fixed bug #670 where uninstalling a venv could erroneously uninstall other apps from the local binary directory. (#672) @@ -171,7 +236,7 @@ binaries for suffixed-venvs. (#653) - Changed venv minimum python version to 3.6, removing python 3.5 which is End of Life. (#666) -## 0.16.1.0 +## [0.16.1.0](https://github.com/pypa/pipx/tree/0.16.1.0) - Introduce the `pipx.run` entry point group as an alternative way to declare an application for `pipx run`. - Fix cursor show/hide to work with older versions of Windows. (#610) @@ -184,7 +249,7 @@ - For `reinstall-all`, fixed bug where missing python executable would cause error. (#634) - Fix regression which prevented pipx from working with pythonloc (and `__pypackages__` folder). (#636) -## 0.16.0.0 +## [0.16.0.0](https://github.com/pypa/pipx/tree/0.16.0.0) - New venv inspection! The code that pipx uses to examine and determine metadata in an installed venv has been made faster, better, and more reliable. It now uses modern python libraries like `packaging` and `importlib.metadata` to @@ -225,7 +290,7 @@ - pipx error, warning, and other messages now word-wrap so words are not split across lines. Their appearance is also now more consistent. -## 0.15.6.0 +## [0.15.6.0](https://github.com/pypa/pipx/tree/0.15.6.0) - [docs] Update license - [docs] Display a more idiomatic command for registering completions on fish. @@ -236,12 +301,12 @@ among other uses. - [bugfix] Fixed bug where extras were ignored with a PEP 508 package specification with a URL. -## 0.15.5.1 +## [0.15.5.1](https://github.com/pypa/pipx/tree/0.15.5.1) - [bugfix] Fixed regression of 0.15.5.0 which erroneously made installing from a local path with package extras not possible. -## 0.15.5.0 +## [0.15.5.0](https://github.com/pypa/pipx/tree/0.15.5.0) - pipx now parses package specification before install. It removes (with warning) the `--editable` install option for any package specification that is not a local path. It also removes (with warning) any environment markers. @@ -258,20 +323,20 @@ - [feature] `--suffix` option for `install` to allow multiple versions of same tool to be installed (#445) - [feature] pipx can now be used with the Windows embeddable Python distribution -## 0.15.4.0 +## [0.15.4.0](https://github.com/pypa/pipx/tree/0.15.4.0) - [feature] `list` now has a new option `--include-injected` to show the injected packages in the main apps - [bugfix] Fixed bug that can cause crash when installing an app -## 0.15.3.1 +## [0.15.3.1](https://github.com/pypa/pipx/tree/0.15.3.1) - [bugfix] Workaround multiprocessing issues on certain platforms (#229) -## 0.15.3.0 +## [0.15.3.0](https://github.com/pypa/pipx/tree/0.15.3.0) - [feature] Use symlinks on Windows when symlinks are available -## 0.15.2.0 +## [0.15.2.0](https://github.com/pypa/pipx/tree/0.15.2.0) - [bugfix] Improved error reporting during venv metadata inspection. - [bugfix] Fixed incompatibility with pypy as venv interpreter (#372). @@ -283,30 +348,30 @@ - [bugfix] Ignore system shared libraries when installing shared libraries pip, wheel, and setuptools. This also fixes an incompatibility with Debian/Ubuntu's version of pip (#386). -## 0.15.1.3 +## [0.15.1.3](https://github.com/pypa/pipx/tree/0.15.1.3) - [bugfix] On Windows, pipx now lists correct Windows apps (#217) - [bugfix] Fixed a `pipx install` bug causing incorrect python binary to be used when using the optional --python argument in certain situations, such as running pipx from a Framework python on macOS and specifying a non-Framework python. -## 0.15.1.2 +## [0.15.1.2](https://github.com/pypa/pipx/tree/0.15.1.2) - [bugfix] Fix recursive search of dependencies' apps so no apps are missed. - `upgrade-all` now skips editable packages, because pip disallows upgrading editable packages. -## 0.15.1.1 +## [0.15.1.1](https://github.com/pypa/pipx/tree/0.15.1.1) - [bugfix] fix regression that caused installing with --editable flag to fail package name determination. -## 0.15.1.0 +## [0.15.1.0](https://github.com/pypa/pipx/tree/0.15.1.0) - Add Python 3.8 to PyPI classifier and travis test matrix - [feature] auto-upgrade shared libraries, including pip, if older than one month. Hide all pip warnings that a new version is available. (#264) - [bugfix] pass pip arguments to pip when determining package name (#320) -## 0.15.0.0 +## [0.15.0.0](https://github.com/pypa/pipx/tree/0.15.0.0) Upgrade instructions: When upgrading to 0.15.0.0 or above from a pre-0.15.0.0 version, you must re-install all packages to take advantage of the new persistent pipx metadata files introduced in this release. These metadata files store pip @@ -337,7 +402,7 @@ by running `pipx reinstall-all` or `pipx uninstall-all`, then reinstalling manua - Use threads on OS's without support for semaphores - Stricter parsing when passing `--` argument as delimiter -## 0.14.0.0 +## [0.14.0.0](https://github.com/pypa/pipx/tree/0.14.0.0) - Speed up operations by using shared venv for `pip`, `setuptools`, and `wheel`. You can see more detail in the 'how pipx works' section of the documentation. (#164, @pfmoore) @@ -347,22 +412,22 @@ by running `pipx reinstall-all` or `pipx uninstall-all`, then reinstalling manua - If `--force` is passed, remove existing files in PIPX_BIN_DIR - Move animation to start of line, hide cursor when animating -## 0.13.2.3 +## [0.13.2.3](https://github.com/pypa/pipx/tree/0.13.2.3) - Fix regression when installing a package that doesn't have any entry points -## 0.13.2.2 +## [0.13.2.2](https://github.com/pypa/pipx/tree/0.13.2.2) - Remove unnecessary and sometimes incorrect check after `pipx inject` (#195) - Make status text/animation reliably disappear before continuing - Update animation symbols -## 0.13.2.1 +## [0.13.2.1](https://github.com/pypa/pipx/tree/0.13.2.1) - Remove virtual environment if installation did not complete. For example, if it was interrupted by ctrl+c or if an exception occurred for any reason. (#193) -## 0.13.2.0 +## [0.13.2.0](https://github.com/pypa/pipx/tree/0.13.2.0) - Add shell autocompletion. Also add `pipx completions` command to print instructions on how to add pipx completions to your shell. @@ -373,12 +438,12 @@ by running `pipx reinstall-all` or `pipx uninstall-all`, then reinstalling manua - swap out of order logic in order to correctly recommend --include-deps (@joshuarli) - [dev] Migrate from tox to nox -## 0.13.1.1 +## [0.13.1.1](https://github.com/pypa/pipx/tree/0.13.1.1) - Do not raise bare exception if no binaries found (#150) - Update pipsi migration script -## 0.13.1.0 +## [0.13.1.0](https://github.com/pypa/pipx/tree/0.13.1.0) - Deprecate `ensurepath` command. Use `userpath append ~/.local/bin` - Support redirects and proxies when downloading python files (i.e. `pipx run http://url/file.py`) @@ -387,34 +452,34 @@ by running `pipx reinstall-all` or `pipx uninstall-all`, then reinstalling manua - Use mkdocs for documentation - Change default cache duration for `pipx run` from 2 to 14 days -## 0.13.0.1 +## [0.13.0.1](https://github.com/pypa/pipx/tree/0.13.0.1) - Fix upgrade-all and reinstall-all regression -## 0.13.0.0 +## [0.13.0.0](https://github.com/pypa/pipx/tree/0.13.0.0) - Add `runpip` command to run arbitrary pip commands in pipx-managed virtual environments - Do not raise error when running `pipx install PACKAGE` and the package has already been installed by pipx (#125). This is the cause of the major version change from 0.12 to 0.13. - Add `--skip` argument to `upgrade-all` and `reinstall-all` commands, to let the user skip particular packages -## 0.12.3.3 +## [0.12.3.3](https://github.com/pypa/pipx/tree/0.12.3.3) - Update logic in determining a package's binaries during installation. This removes spurious binaries from the installation. (#104) - Improve compatibility with Debian distributions by using `shutil.which` instead of `distutils.spawn.find_executable` (#102) -## 0.12.3.2 +## [0.12.3.2](https://github.com/pypa/pipx/tree/0.12.3.2) - Fix infinite recursion error when installing package such as `cloudtoken==0.1.84` (#103) - Fix windows type errors (#96, #98) -## 0.12.3.1 +## [0.12.3.1](https://github.com/pypa/pipx/tree/0.12.3.1) - Fix "WindowsPath is not iterable" bug -## 0.12.3.0 +## [0.12.3.0](https://github.com/pypa/pipx/tree/0.12.3.0) - Add `--include-deps` argument to include binaries of dependent packages when installing with pipx. This improves compatibility with packages that depend on other installed packages, such as `jupyter`. @@ -423,7 +488,7 @@ by running `pipx reinstall-all` or `pipx uninstall-all`, then reinstalling manua - More aggressive cache directory removal when `--no-cache` is passed to `pipx run` - [dev] Move inline text passed to subprocess calls to their own files to enable autoformatting, linting, unit testing -## 0.12.2.0 +## [0.12.2.0](https://github.com/pypa/pipx/tree/0.12.2.0) - Add support for PEP 582's `__pypackages__` (experimental). `pipx run BINARY` will first search in `__pypackages__` for binary, then fallback to installing from PyPI. `pipx run --pypackages BINARY` will raise an error if the binary is not @@ -431,7 +496,7 @@ by running `pipx reinstall-all` or `pipx uninstall-all`, then reinstalling manua - Fix regression when installing with `--editable` flag (#93) - [dev] improve unit tests -## 0.12.1.0 +## [0.12.1.0](https://github.com/pypa/pipx/tree/0.12.1.0) - Cache and reuse temporary Virtual Environments created with `pipx run` (#61) - Update binary discovery logic to find "scripts" like awscli (#91) @@ -441,54 +506,54 @@ by running `pipx reinstall-all` or `pipx uninstall-all`, then reinstalling manua at `$PIPX_HOME`. - [dev] refactor into multiple files, add more unit tests -## 0.12.0.4 +## [0.12.0.4](https://github.com/pypa/pipx/tree/0.12.0.4) - Fix parsing bug in pipx run -## 0.12.0.3 +## [0.12.0.3](https://github.com/pypa/pipx/tree/0.12.0.3) - list python2 as supported language so that pip installs with python2 will no longer install the pipx on PyPI from the original pipx owner. Running pipx with python2 will fail, but at least it will not be as confusing as running the pipx package from the original owner. -## 0.12.0.2 +## [0.12.0.2](https://github.com/pypa/pipx/tree/0.12.0.2) - forward arguments to run command correctly #90 -## 0.12.0.1 +## [0.12.0.1](https://github.com/pypa/pipx/tree/0.12.0.1) - stop using unverified context #89 -## 0.12.0.0 +## [0.12.0.0](https://github.com/pypa/pipx/tree/0.12.0.0) - Change installation instructions to use `pipx` PyPI name - Add `ensurepath` command -## 0.11.0.2 +## [0.11.0.2](https://github.com/pypa/pipx/tree/0.11.0.2) - add version argument parsing back in (fixes regression) -## 0.11.0.1 +## [0.11.0.1](https://github.com/pypa/pipx/tree/0.11.0.1) - add version check, command check, fix printed version update installation instructions -## 0.11.0.0 +## [0.11.0.0](https://github.com/pypa/pipx/tree/0.11.0.0) - Replace `pipx BINARY` with `pipx run BINARY` to run a binary in an ephemeral environment. This is a breaking API change so the major version has been incremented. (Issue #69) - upgrade pip when upgrading packages (Issue #72) - support --system-site-packages flag (Issue #64) -## 0.10.4.1 +## [0.10.4.1](https://github.com/pypa/pipx/tree/0.10.4.1) - Fix version printed when `pipx --version` is run -## 0.10.4.0 +## [0.10.4.0](https://github.com/pypa/pipx/tree/0.10.4.0) - Add --index-url, --editable, and --pip-args flags - Updated README with pipsi migration instructions -## 0.10.3.0 +## [0.10.3.0](https://github.com/pypa/pipx/tree/0.10.3.0) - Display python version in list - Do not reinstall package if already installed (added `--force` flag to override) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e74e3a9ed..48bf888e44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,6 +3,42 @@ Thanks for your interest in contributing to pipx! Everyone who interacts with the pipx project via codebase, issue tracker, chat rooms, or otherwise is expected to follow the [PSF Code of Conduct](https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md). + +## Submitting changes + +1. Fork [the GitHub repository](https://github.com/pypa/pipx). +2. Make a branch off of `main` and commit your changes to it. +3. Add a changelog entry. +4. Submit a pull request to the `main` branch on GitHub, referencing an + open issue. + +### Changelog entries + +The `CHANGELOG.md` file is built by +[towncrier](https://pypi.org/project/towncrier/) from news fragments in the +`changelog.d/` directory. To add an entry, create a news fragment in that directory +named `{number}.{type}.md`, where `{number}` is the issue number, +and `{type}` is one of `feature`, `bugfix`, `doc`, `removal`, or `misc`. + +For example, if your issue number is 1234 and it's fixing a bug, then you +would create `changelog.d/1234.bugfix.md`. PRs can span multiple +categories by creating multiple files: if you added a feature and +deprecated/removed an old feature for issue #5678, you would create +`changelog.d/5678.feature.md` and `changelog.d/5678.removal.md`. + +A changelog entry is meant for end users and should only contain details +relevant to them. In order to maintain a consistent style, please keep +the entry to the point, in sentence case, shorter than 80 characters, +and in an imperative tone. An entry should complete the sentence "This +change will ...". If one line is not enough, use a summary line in an +imperative tone, followed by a description of the change in one or more +paragraphs, each wrapped at 80 characters and separated by blank lines. + +You don't need to reference the pull request or issue number in a +changelog entry, since towncrier will add a link using the number in the +file name. Similarly, you don't need to add your name to the entry, +since that will be associated with the pull request. + ## Running pipx For Development To develop `pipx`, either create a [developer environment](#creating-a-developer-environment), or perform an editable diff --git a/changelog.d/.gitignore b/changelog.d/.gitignore new file mode 100644 index 0000000000..f935021a8f --- /dev/null +++ b/changelog.d/.gitignore @@ -0,0 +1 @@ +!.gitignore diff --git a/changelog.d/1161.doc.md b/changelog.d/1161.doc.md new file mode 100644 index 0000000000..cdc0861a6b --- /dev/null +++ b/changelog.d/1161.doc.md @@ -0,0 +1 @@ +Introduce towncrier for managing the changelog diff --git a/changelog.d/1198.doc.md b/changelog.d/1198.doc.md new file mode 100644 index 0000000000..f76733e0c4 --- /dev/null +++ b/changelog.d/1198.doc.md @@ -0,0 +1 @@ +Add workaround for using pipx applications in shebang under macOS diff --git a/mkdocs.yml b/mkdocs.yml index 964fed6c6f..3e465aaf42 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -47,3 +47,4 @@ plugins: - gen-files: scripts: - scripts/gen_doc_pages.py + - macros diff --git a/noxfile.py b/noxfile.py index 2a09c7b927..d5dfc8853d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,3 +1,4 @@ +import shutil import subprocess import sys from pathlib import Path @@ -6,7 +7,7 @@ PYTHON_ALL_VERSIONS = ["3.12", "3.11", "3.10", "3.9", "3.8"] PYTHON_DEFAULT_VERSION = "3.12" -DOC_DEPENDENCIES = ["jinja2", "mkdocs", "mkdocs-material", "mkdocs-gen-files"] +DOC_DEPENDENCIES = ["jinja2", "mkdocs", "mkdocs-material", "mkdocs-gen-files", "mkdocs-macros-plugin", "towncrier"] MAN_DEPENDENCIES = ["argparse-manpage[setuptools]"] TEST_DEPENDENCIES = ["pytest", "pypiserver[passlib]", 'setuptools; python_version>="3.12"', "pytest-cov"] # Packages whose dependencies need an intact system PATH to compile @@ -55,6 +56,22 @@ def tests_with_options(session: nox.Session, *, net_pypiserver: bool) -> None: session.notify("cover") +def create_upcoming_changelog(session: nox.Session) -> Path: + draft_changelog_content = session.run("towncrier", "build", "--version", "Upcoming", "--draft", silent=True) + draft_changelog = Path("docs", "_draft_changelog.md") + if draft_changelog_content and "No significant changes" not in draft_changelog_content: + lines_to_keep = draft_changelog_content.split("\n") + changelog_start = 0 + for i, line in enumerate(lines_to_keep): + if line.startswith("##"): + changelog_start = i + break + lines_to_keep[changelog_start] = "## Planned for next release" + clean_changelog_content = "\n".join(lines_to_keep[changelog_start:]) + draft_changelog.write_text(clean_changelog_content) + return draft_changelog + + @nox.session(python=PYTHON_ALL_VERSIONS) def tests(session: nox.Session) -> None: """Tests using local pypiserver only""" @@ -112,13 +129,19 @@ def build_docs(session: nox.Session) -> None: site_dir = session.posargs or ["site/"] session.install(*DOC_DEPENDENCIES, ".") session.env["PIPX__DOC_DEFAULT_PYTHON"] = "typically the python used to execute pipx" + upcoming_changelog = create_upcoming_changelog(session) session.run("mkdocs", "build", "--strict", "--site-dir", *site_dir) + upcoming_changelog.unlink(missing_ok=True) + for site in site_dir: + shutil.rmtree(Path(site, "_draft_changelog")) @nox.session(python=PYTHON_DEFAULT_VERSION) def watch_docs(session: nox.Session) -> None: session.install(*DOC_DEPENDENCIES, ".") + upcoming_changelog = create_upcoming_changelog(session) session.run("mkdocs", "serve", "--strict") + upcoming_changelog.unlink(missing_ok=True) @nox.session(python=PYTHON_DEFAULT_VERSION) diff --git a/pyproject.toml b/pyproject.toml index c21467cc53..23255bd5f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,15 @@ lint.mccabe.max-complexity = 15 [tool.pytest.ini_options] markers = ["all_packages: test install with maximum number of packages"] +[tool.towncrier] +directory = "changelog.d" +filename = "CHANGELOG.md" +start_string = "\n" +underlines = ["", "", ""] +title_format = "## [{version}](https://github.com/pypa/pipx/tree/{version}) - {project_date}" +issue_format = "[#{issue}](https://github.com/pypa/pipx/issues/{issue})" +package = "pipx" + [[tool.mypy.overrides]] module = ["pipx.version", "pycowsay.*"] ignore_missing_imports = true diff --git a/scripts/gen_doc_pages.py b/scripts/gen_doc_pages.py index d8e6f1388c..ecab566b14 100644 --- a/scripts/gen_doc_pages.py +++ b/scripts/gen_doc_pages.py @@ -46,8 +46,3 @@ def get_help(cmd: Optional[str]) -> str: with mkdocs_gen_files.open("docs.md", "wt") as file_handler: file_handler.write(env.get_template("docs.md").render(**params)) file_handler.write("\n") - -with mkdocs_gen_files.open("changelog.md", "rt") as file_handler: - text = file_handler.read() -with mkdocs_gen_files.open("changelog.md", "wt") as file_handler: - file_handler.write(f"## {__version__}" + text[len("## dev") :])