Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 authored Oct 23, 2024
2 parents 1a4b3fa + 4d04e9b commit b65571b
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 8 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/test-dist.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Test source distribution and pure-Python wheel.
name: test-dist

on:
push:
branches:
- "*"

jobs:
test-dist:
name: test-${{ matrix.build }}
runs-on: ubuntu-latest
strategy:
matrix:
build:
- sdist
- wheel

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Build dist
env:
FALCON_DISABLE_CYTHON: "Y"
run: |
pip install --upgrade pip
pip install --upgrade build
python -m build --${{ matrix.build }}
- name: Test sdist
if: matrix.build == 'sdist'
run: |
tools/test_dist.py dist/*.tar.gz
- name: Test pure-Python wheel
if: matrix.build == 'wheel'
run: |
tools/test_dist.py dist/*.whl
2 changes: 1 addition & 1 deletion .github/workflows/tox-sdist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
run_tox:
name: tox (default envlist on ${{matrix.python-version}})
name: tox (python${{ matrix.python-version }})
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
Expand Down
17 changes: 17 additions & 0 deletions docs/changes/4.0.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Changelog for Falcon 4.0.1
==========================

Summary
-------

This is a minor point release addressing a Python distribution issue in
Falcon 4.0.0.


Fixed
-----

- Installing Falcon 4.0.0 unexpectedly copies many unintended directories from the
source tree to the venv's ``site-packages``. This issue has been rectified, and
our CI has been extended with new tests (that verify what is actually installed
from the distribution) to make sure this regression does not resurface. (`#2384 <https://github.com/falconry/falcon/issues/2384>`__)
1 change: 1 addition & 0 deletions docs/changes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelogs
.. toctree::

4.1.0 <4.1.0>
4.0.1 <4.0.1>
4.0.0 <4.0.0>
3.1.3 <3.1.3>
3.1.2 <3.1.2>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ zip-safe = false
version = {attr = "falcon.version.__version__"}

[tool.setuptools.packages.find]
exclude = ["examples", "tests"]
include = ["falcon*"]

[tool.mypy]
exclude = [
Expand Down
33 changes: 27 additions & 6 deletions tools/test_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,43 @@
REQUIREMENTS = FALCON_ROOT / 'requirements' / 'cibwtest'
TESTS = FALCON_ROOT / 'tests'

EXPECTED_SCRIPTS = set({'falcon-bench', 'falcon-inspect-app', 'falcon-print-routes'})
EXPECTED_PACKAGES = set({'falcon'})


def test_package(package):
with tempfile.TemporaryDirectory() as tmpdir:
venv = pathlib.Path(tmpdir) / 'venv'
venv_bin = venv / 'bin'
venv_pip = venv_bin / 'pip'
subprocess.check_call((sys.executable, '-m', 'venv', venv))
logging.info(f'Created a temporary venv in {venv}.')

subprocess.check_call((venv / 'bin' / 'pip', 'install', '--upgrade', 'pip'))
subprocess.check_call((venv / 'bin' / 'pip', 'install', '-r', REQUIREMENTS))
subprocess.check_call((venv_pip, 'install', '--upgrade', 'pip'))
subprocess.check_call((venv_pip, 'install', '-r', REQUIREMENTS))
logging.info(f'Installed test requirements in {venv}.')
subprocess.check_call(
(venv / 'bin' / 'pip', 'install', package),
)

(venv_site_pkg,) = venv.glob('lib/python*/site-packages')
bin_before = {path.name for path in venv_bin.iterdir()}
pkg_before = {path.name for path in venv_site_pkg.iterdir()}

subprocess.check_call((venv_pip, 'install', package))
logging.info(f'Installed {package} into {venv}.')

subprocess.check_call((venv / 'bin' / 'pytest', TESTS), cwd=venv)
bin_after = {path.name for path in venv_bin.iterdir()}
assert bin_after - bin_before == EXPECTED_SCRIPTS, (
f'Unexpected scripts installed in {venv_bin} from {package}: '
f'{bin_after - bin_before - EXPECTED_SCRIPTS}'
)
pkg_after = {
path.name for path in venv_site_pkg.iterdir() if path.suffix != '.dist-info'
}
assert pkg_after - pkg_before == EXPECTED_PACKAGES, (
f'Unexpected packages installed in {venv_site_pkg} from {package}: '
f'{pkg_after - pkg_before - EXPECTED_PACKAGES}'
)

subprocess.check_call((venv_bin / 'pytest', TESTS), cwd=venv)
logging.info(f'{package} passes tests.')


Expand Down

0 comments on commit b65571b

Please sign in to comment.