Commit Graph

4 Commits

Author SHA1 Message Date
Mitja O 2f0a56c380
fix: support Python 3.12 (#539)
* chore: pin explicit Python 3.12

* chore: add a `test-python` for stable Python

* chore: empty commit

* chore: add some FIXMEs

* chore: add `packaging`

* chore(wip): replace `LegacyVersion` with `packaging`'s `parse`

* chore(wip): bypass `strtobool` usage

* chore(wip): `pkg_resources` are deprecated

* chore(wip): naive way to support Python <3.12

* chore(wip): swap import order

* chore(wip): try fixing version check

* chore: add a fixme

* chore(wip): reverse legacy pip check

* chore(wip): legacy pip  check for 9 or lower

* fix: fix the legacy pip check

* chore: small cleanup

* chore(wip): try the `importlib_resources`

* chore: add small comment

* chore(wip): avoid `setup.py` in fixtures

* chore(wip): version-compatible wheel build

* chore: install `build` for `3.8` too

* fix: mypy issues

* chore: fix comments

* fix: more formatting fixes

* fix: mdformat

* fix: pass wrong auth to `failed_auth` test

* chore: cleanup packages before and after test runs

* chore(wip): try to bypass test error

* chore: add a tech debt comment

* chore: undo too many changes

* chore(wip): small debug experiment

* chore(wip): skip some tests

* chore(wip): use nonsense code

* fix(chore): small fix to the nonsense code

* chore(wip): try `--force-reinstall`

* chore: finalize the docker tests
2024-04-01 21:30:02 +02:00
Dmitrii Orlov bbd2a47bae
fix: docker tests in cicd (#444)
* fix: bump gevent version to 21.12.0

* chore: few naming cleanings in test_docker

* chore: run black formatter
2022-09-06 18:41:25 +02:00
Matthew Planchard 8306de15db
Gunicorn/gevent docker, log fixes, cache busting (#371)
Updates the Docker configuration to use the gunicorn server with gevent
workers by default. Adds `waitress` to the docker container, so that if
no server is specified, we will fall back to that rather than `wsgiref`.

Making this happen brought a few other issues to light, which are also
addressed here.

- Docker log output not immediately being flushed to stdout (#358):
  resolved by setting the `PYTHONUNBUFFERED` env var to `t` in the
  docker container
- When the WSGIRef server is selected, its access logs are written
  directly to stderr, rather than going through the logging machinery:
  resolved by adding a new `WsgiHandler` class and passing in to
  bottle's `run()` method when running the wsgi server. This required a
  new `ServerCheck` class to determine whether the wsgi server is
  selected when the `auto` option is used
- When using `gunicorn` along with the watchdog cache, package uplaods
  were not being picked up by the watcher. Updated the `add_package`
  and `remove_package` methods on the `CachingFileBackend` to bust the
  cache
2021-02-07 17:04:06 -06:00
Matthew Planchard d868005e1f
Docker improvements (#365)
* Docker improvements

This addresses much of what was brought up in #359. Specifically, it:

- Significantly improves testing for the Docker image, adding a
  `docker/test_docker.py` file using the regular pytest machinery to
  set up and run docker images for testing
- Hopefully addresses a variety of permissions issues, by being explicit
  about what access pypiserver needs and asking for it, only erroring
  if that access is not available
  - Requires RX permissions on `/data` (R to read files, X to list files
    and to be able to cd into the directory. This is important since
    `/data` is the `WORKDIR`)
  - Requires RWX permissions on `/data/packages`, so that we can list
    packages, write packages, and read packages.
  - When running in the default configuration (as root on Linux or
    as the pypiserver-named rootish user on Mac), with no volumes
    mounted, these requirements are all satisfied
  - Volume mounts still must be readable by the pypiserver user (UID
    9898) in order for the container to run. However, we now error early
    if this is not the case, and direct users to a useful issue.
  - If the container is run as a non-root, non-pypiserver user (e.g.
    because someone ran `docker run --user=<user_id>`, we try to run
    pypiserver as that user). Provided that user has access to the
    necessary directories, it should run fine.
- Fixes issues with running help and similar commands
- Updates the Docker image to use `PYPISERVER_PORT` for port
  specification, while still falling back to `PORT` for backwards
  compatibility
- Moves some docker-related things into a `/docker` directory
- Adds a `Makefile` for building a test fixture package sdist and wheel,
  so that test code can call `make mypkg` and not need to worry about it
  potentially building multiple times

The only issue #359 raises that's not addressed here is the one of
running pypiserver in the Docker container using some non-default server
for performance. I would like to do some benchmarking before deciding on
what to do there.
2021-02-06 11:28:15 -06:00