Skip to content

chore(dev): changes for developer ergonomics #10816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 23, 2022

Conversation

miketheman
Copy link
Member

I found myself needing to set/reset these changes to be able to develop effectively.

Each commit has further description and context to explain more - happy to discuss further!

When running `make tests`, the current expectation is that the user has
executed `make serve` and the database container is running in already.

This brings in all the other runtime dependencies, when all the tests
need is a running database instance.

Setting the `depends_on` flag tells docker-compose to start the db
container first, any time we run a `web` container, and saves us the
step of starting it ourselves in another shell.

Signed-off-by: Mike Fiedler <[email protected]>
The current settings for the elasticsearch container place the started
node in "production, single node cluster" mode.
This performs boostrap tests, one of which tests for virtual memory via
the `sysctl` setting of `vm.max_map_count`.

In certain Docker-in-Docker development environments, the end user may
not have access to the underlying host settings, and cannot modify this
setting.
An alternative is to set the `discovery-type` to a single node, placing
the service in "development mode", turning any bootstrap checks from
errors to warnings.

Refs: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/system-config.html#dev-vs-prod
Refs: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/bootstrap-checks.html

Originally reported in #1511, related to pypi#4370

Signed-off-by: Mike Fiedler <[email protected]>
coverage.py version 5.0 introduced the notion of measurement contexts.
This adds details to the report to show:

- how many times a given line was executed
- which context executed a given line

Enabling dynamic context measurement during the test execution adds
test class/function contexts to the coverage data to be displayed on
a given report output.

Refs: https://coverage.readthedocs.io/en/6.3.2/contexts.html#dynamic-contexts

Signed-off-by: Mike Fiedler <[email protected]>
Creating a port under 1024 often requires superuser privileges.
In some environments this is disallowed.
By using the built-in behavior from Docker Compose, a user can now set:

    WEB_PORT=8080 make serve

and the web application will be made availabel on port 8080.

The default remains port 80.

Signed-off-by: Mike Fiedler <[email protected]>
@ewdurbin
Copy link
Member

supersedes #10265

@di di merged commit c57752e into pypi:main Feb 23, 2022
@di
Copy link
Member

di commented Feb 23, 2022

Thanks for the improvements and really detailed commit messages!

@miketheman miketheman deleted the miketheman/devx-ergonomics branch February 23, 2022 16:33
domdfcoding pushed a commit to domdfcoding/warehouse that referenced this pull request Jun 7, 2022
* chore(dev): set web to depend on db

When running `make tests`, the current expectation is that the user has
executed `make serve` and the database container is running in already.

This brings in all the other runtime dependencies, when all the tests
need is a running database instance.

Setting the `depends_on` flag tells docker-compose to start the db
container first, any time we run a `web` container, and saves us the
step of starting it ourselves in another shell.

Signed-off-by: Mike Fiedler <[email protected]>

* chore(dev): set elasticsearch to single-node

The current settings for the elasticsearch container place the started
node in "production, single node cluster" mode.
This performs boostrap tests, one of which tests for virtual memory via
the `sysctl` setting of `vm.max_map_count`.

In certain Docker-in-Docker development environments, the end user may
not have access to the underlying host settings, and cannot modify this
setting.
An alternative is to set the `discovery-type` to a single node, placing
the service in "development mode", turning any bootstrap checks from
errors to warnings.

Refs: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/system-config.html#dev-vs-prod
Refs: https://www.elastic.co/guide/en/elasticsearch/reference/7.10/bootstrap-checks.html

Originally reported in pypi#1511, related to pypi#4370

Signed-off-by: Mike Fiedler <[email protected]>

* chore: enable context reporting in coverage

coverage.py version 5.0 introduced the notion of measurement contexts.
This adds details to the report to show:

- how many times a given line was executed
- which context executed a given line

Enabling dynamic context measurement during the test execution adds
test class/function contexts to the coverage data to be displayed on
a given report output.

Refs: https://coverage.readthedocs.io/en/6.3.2/contexts.html#dynamic-contexts

Signed-off-by: Mike Fiedler <[email protected]>

* chore(dev): enable web port to be set via env var

Creating a port under 1024 often requires superuser privileges.
In some environments this is disallowed.
By using the built-in behavior from Docker Compose, a user can now set:

    WEB_PORT=8080 make serve

and the web application will be made availabel on port 8080.

The default remains port 80.

Signed-off-by: Mike Fiedler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants