Skip to content

Commit

Permalink
Merge branch 'master' into dispatch_typing_strict_optional
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw authored Jul 5, 2024
2 parents 1044c4a + 0da8fa1 commit ce8c711
Show file tree
Hide file tree
Showing 31 changed files with 966 additions and 326 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ body:
* [Check the documentation](https://docs.locust.io/en/stable/)
* [Check the FAQ in the wiki](https://github.com/locustio/locust/wiki/FAQ)
* [Check the Github Discussions](https://github.com/orgs/locustio/discussions)
* Search [Stack Overflow](https://stackoverflow.com/questions/tagged/locust), or [ask there](https://stackoverflow.com/questions/ask) yourself. If you tag your question with `locust` we will see it.
* Ask on [Locust's slack](https://locustio.slack.com) [(sign up here)](https://communityinviter.com/apps/locustio/locust)
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ body:
* [Check the documentation](https://docs.locust.io/en/stable/)
* [Check the FAQ in the wiki](https://github.com/locustio/locust/wiki/FAQ)
* [Check the Github Discussions](https://github.com/orgs/locustio/discussions)
* Search [Stack Overflow](https://stackoverflow.com/questions/tagged/locust), or [ask there](https://stackoverflow.com/questions/ask) yourself. If you tag your question with `locust` we will see it.
* Ask on [Locust's slack](https://locustio.slack.com) [(sign up here)](https://communityinviter.com/apps/locustio/locust)
Expand Down
58 changes: 42 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,45 @@ jobs:
- { name: "3.9", python: "3.9", os: ubuntu-latest, tox: py39 }

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Update pip
- name: Install poetry
run: |
python -m pip install poetry
- name: Configure poetry
run: |
python -m poetry config virtualenvs.in-project true
- name: Cache the virtualenv
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ hashFiles('pyproject.toml') }}
- name: Install poetry plugin
run: python -m poetry self add "poetry-dynamic-versioning[plugin]"
# Install test dependencies (tox) to the root (non-package install)
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('pyproject.toml') }}
python -m poetry install --no-root --only test
- name: set full Python version in PY env var
# See https://pre-commit.com/#github-actions-example
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- run: python -m pip install tox
- run: python -m tox -e ${{ matrix.tox }}
# Install node and yarn in order to build the front end during packaging
- name: Set Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Yarn
run: npm install -g yarn
# Build and install the package if it's Windows, to service shell-based tests
- if: ${{ matrix.os }} == "windows-latest"
run: |
python -m poetry build
pip install --find-links=dist locust
- run: python -m poetry run tox -e ${{ matrix.tox }}

lint_typecheck_test_webui:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -145,10 +165,13 @@ jobs:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip build
python -m pip install --upgrade pip poetry
python -m poetry config virtualenvs.create false
python -m poetry self add "poetry-dynamic-versioning[plugin]"
- name: Build + set TAG env var for later use
run: |
python -m build
python -m poetry build
./rename-wheel.sh
echo "TAG=${GITHUB_REF#refs/*/}" | tee -a $GITHUB_ENV
- name: Publish tagged version to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down Expand Up @@ -183,11 +206,14 @@ jobs:
- name: Install dependencies
if: ${{ env.NOT_MERGE_COMMIT == '' }}
run: |
python -m pip install --upgrade pip build
python -m pip install --upgrade pip poetry
python -m poetry config virtualenvs.create false
python -m poetry self add "poetry-dynamic-versioning[plugin]"
- name: Build
if: ${{ env.NOT_MERGE_COMMIT == '' }}
run: |
python -m build
python -m poetry build
./rename-wheel.sh
- name: Publish prerelease version to PyPI
if: ${{ env.NOT_MERGE_COMMIT == '' }}
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ yarn-error.log
.venv
.DS_Store
.python-version
poetry.lock
locust/webui/dist/**
12 changes: 6 additions & 6 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
post_create_environment:
- python -m pip install poetry
- python -m poetry self add "poetry-dynamic-versioning[plugin]"
post_install:
- SKIP_PRE_BUILD=true VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Stage 1: Build web front end
FROM node:18.0.0-alpine as webui-builder

ADD locust/webui locust/webui
ADD package.json .

# long yarn timeout necessary in certain network environments
RUN yarn webui:install --production --network-timeout 60000

RUN yarn webui:build

# Stage 2: Build Locust package
FROM python:3.11-slim as base

FROM base as builder
Expand All @@ -15,12 +17,20 @@ RUN apt-get update && apt-get install -y git
RUN if [ -n "$(arch | grep 'arm64\|aarch64')" ]; then apt install -y --no-install-recommends gcc python3-dev; fi
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
ENV SKIP_PRE_BUILD="true"
COPY . /build
RUN pip install /build/
WORKDIR /build
# bring in the prebuilt front-end before package installation
COPY --from=webui-builder locust/webui/dist locust/webui/dist
RUN pip install poetry && \
poetry config virtualenvs.create false && \
poetry self add "poetry-dynamic-versioning[plugin]" && \
poetry build -f wheel && \
pip install dist/*.whl

# Stage 3: Runtime image
FROM base
COPY --from=builder /opt/venv /opt/venv
COPY --from=webui-builder locust/webui/dist locust/webui/dist
ENV PATH="/opt/venv/bin:$PATH"
# turn off python output buffering
ENV PYTHONUNBUFFERED=1
Expand Down
41 changes: 32 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
test:
tox

build:
rm -f dist/* && python3 -m pip install --upgrade build && python3 -m build .
.PHONY: build
build: setup_dependencies
rm -rf dist/* && poetry build && ./rename-wheel.sh

install: setup_dependencies
poetry install --with dev

setup_dependencies: check-poetry check-yarn
poetry config virtualenvs.create false
poetry self add "poetry-dynamic-versioning[plugin]"

.SILENT:
.PHONY: check-poetry
check-poetry:
command -v poetry >/dev/null 2>&1 || { echo >&2 "Locust requires the poetry binary to be available in this shell to build the Python package.\nSee: https://docs.locust.io/en/stable/developing-locust.html#install-locust-for-development"; exit 1; }

.SILENT:
.PHONY: check-yarn
check-yarn:
command -v yarn >/dev/null 2>&1 || { echo >&2 "Locust requires the yarn binary to be available in this shell to build the web front-end.\nSee: https://docs.locust.io/en/stable/developing-locust.html#making-changes-to-locust-s-web-ui"; exit 1; }

frontend_build:
yarn webui:install && yarn webui:build

release: build
twine upload dist/*

build_docs:
setup_docs_dependencies:
poetry install --with docs

build_docs: setup_docs_dependencies
sphinx-build -b html docs/ docs/_build/

# This command can be used to serve the built documentation at http://localhost for
# easier offline viewing
.SILENT:
.PHONY: serve_docs
serve_docs:
echo "Serving docs at http://localhost:80"
python -m http.server 80 -d docs/_build

changelog:
@echo "Not supported any more. Run ./generate_changelog.py <version_number> instead!"

sass_watch:
sass --watch locust/static/sass:locust/static/css

sass_build:
sass --update locust/static/sass:locust/static/css
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Locust's code base is intentionally kept small and doesn't solve everything out

* Documentation: [docs.locust.io](https://docs.locust.io)
* Support/Questions: [StackOverflow](https://stackoverflow.com/questions/tagged/locust)
* Github Discussions: [Github Discussions](https://github.com/orgs/locustio/discussions)
* Chat/discussion: [Slack](https://locustio.slack.com) [(signup)](https://communityinviter.com/apps/locustio/locust)

## Authors
Expand Down
Loading

0 comments on commit ce8c711

Please sign in to comment.