Commit Graph

28 Commits

Author SHA1 Message Date
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
Matthew Planchard
d0694d9e15
Switch to GH actions (#361)
* Switch to GH actions

Removes the travis config and adds a GH actions config. Resolves #360.

As part of this:

- only runs the README check once, instead of for each python version
- only runs mypy once, removing it from tox
- unifies the pypy and cpython tests in tox by separating dev and test
  requirements, and only installing the latter for running tests in tox

* Update README w/badge & link to GH actions tests
2020-11-15 20:08:58 -06:00
Matthew Planchard
15d81147ac
Add python 3.9 testing (#351)
* Add python 3.9 testing

* Add 3.9 proper

According to this, it's available now: https://travis-ci.community/t/python-3-9-0-build/10091/18
2020-10-28 07:11:06 -05:00
Matthew Planchard
c668b1814a
Use argparse config throughout app (#349)
This PR is a pretty substantial refactor of the entrypoints of pypiserver (`__main__` and `__init__`) to use the argparse-based config added in #339.

- Updated `RunConfig` and `UpdateConfig` classes to have exclusive init kwargs, instead of taking an namespace. This turned out to be much easier when working with the library-style app initialization in `__init__`, both for direct instantiation and via paste config
- Added an `iter_packages()` method to the `RunConfig` to iterate over packages specified by the configuration (note @elfjes, I think that replacing this with e.g. a `backend` reference will be a nice way to tie in #348)
- Added a general-purpose method to map legacy keyword arguments to the `app()` and `paste_app_factory()` functions to updated forms
- Refactored the `paste_app_factory()` to not mutate the incoming dictionary
- Removed all argument-parsing and config-related code from `__main__` and `core`
- Moved `_logwrite` from `__init__` to `__main__`, since that was the only place it was being used after the updates to `core`
- Updated `digest_file` to use `hashlib.new(algo)` instead of `getattr(hashlib, algo)`, because the former supports more algorithms
- Updated `setup.py` to, instead of calling `eval()` on the entirety of `__init__`, to instead just evaluate the line that defines the version
- Assigned the config to a `._pypiserver_config` attribute on the `Bottle` instance to reduce hacky test workarounds
- Fixed the tox config, which I broke in #339 

* Config: add auth & absolute path resolution

* Config: check pkg dirs on config creation

* Instantiate config with kwargs, not namespace

* WIP: still pulling the threads

* Init seems to be working

* tests passing locally, still need to update cache

* Fix tox command

* unused import

* Fix typing

* Be more selective in exec() in setup.py

* Require accurate casing for hash algos

* Remove old comment

* Comments, minor updates and simplifications

* move _logwrite to a more reasonable place

* Update config to work with cache

* Type cachemanager listdir in core

* Update config module docstring, rename method

* Add more comments re: paste config

* Add comments to main, remove unneded check

* Remove commented code

* Use {posargs} instead of [] for clarity in tox

* Add dupe check for kwarg updater

* Remove unused references on app instance

* Fix typo

* Remove redundancy in log level parsing
2020-10-25 18:48:28 -05:00
Matthew Planchard
0594c33e53
Backwards-compatible argparse config (not yet in use) (#339)
Adds an argparse config that, while adding subcommands (`pypi-server run` and `pypi-server update`), retains full commandline backwards compatibility with the existing config parsing logic.

There's a bit of hackery required to do this, so this also issues a warning if using the non-subcommand arguments, allowing us to potentially remove support for the old form in our next next major version bump (i.e. 3.0).

Also adds a `.pyproject.toml` with a black config, and a mypy config block to `setup.cfg`.

`mypy` is now called in `tox`, currently only for `config.py`, because nothing else typechecks successfully.

----

* WIP: argparse config

* Complete config

* Test all the config options

* Another test and a note re: being unused

* mypy config, call mypy in tox

* No mypy on pypy

* Fix tox config

* Add venv to black ignore

* fix tox config (again)

* Fix formatting, simplify error handling

* FMT: Run black on changed files
2020-10-08 19:37:39 -05:00
Matthew Planchard
4ab210c82b
MAINT: drop standalone, drop py 2.7 and 3.5 (#338) 2020-10-03 22:25:14 -05:00
Matthew Planchard
b1bf1ed248
Drop support for Python 3.4 (#321)
* Drop support for Python 3.4

Python 3.4 is no longer supported. Even pyenv is failing to install it
for me, because apparently the currnet version of `ensurepip` bombs for
3.4. Pypiserver may still work on 3.4, but testing on it has becomes
more of a hassle than it's worth.

* Fix @mplanchard's email address

Just realized my email address in the authors' file has been wrong for
pretty much forever.

* Remove GL CI

GitLab CI is nice, but doesn't support forks, and so isn't going to be
viable for this project.
2020-07-09 22:39:01 -05:00
Matthew Planchard
98958cf2f8
ENH: Officially support python 3.8 (#292) 2020-01-11 23:53:13 -06:00
Matthew Planchard
972f1616dd
Use GitLab as CI Provider (#269)
* Add gitlab CI

* minmor updates to readme in /bin

* no autodeploy; less scary
2019-09-17 20:44:15 -05:00
Matthew Planchard
4c92fafb4f Pin twine for tests to 1.11, add py37 to test suite 2018-11-09 16:58:45 -06:00
Matthew Planchard
8639ad3d40 Provide Prerelease Testing for Twine
Resolves #203
Related to pypa/twine#314

This commit adds an ``sh -c`` call, whose argument is the value of the
environment variable ``PYPISERVER_SETUP_CMD``, or ``true`` if that
variable is not set. This was specifically added to enable the
``pre_twine`` environment, which is provided to automatically test
pre-releases of twine, both for our use (e.g. #203) and for the use of
the twine maintainers (pypa/twine#314).

The capacity to specify an arbitrary setup command via an environment
variable may also wind up being useful in other cases in the future.

In addition, the envlist is updated to include only Python versions we
actually support.

This commit also alphabetizes the ``dev.pip`` requirements and rmeoves
specific requirements for testing using Python 2.5 (which we do not test
against anymore).
2018-03-06 20:08:14 -06:00
Matthew Planchard
1770f3cf93 Updated Tests
In addition to including tests from @jameshiebert with slight
updates, I have also resolved an issue with newer versions of twine,
which require an extra parameter in the calls to `upload` and
`register`.
2017-11-14 11:02:44 -06:00
Matthew Planchard
4a299ec40b Added python3.5 support to setup.py and tests for #108
- Added wheel to dev requirements
2016-01-20 23:30:22 +01:00
Kostis Anagnostopoulos
0c4c27fa5c v1.2.0.dev1 (<--1.1.10): Stop supporting py<2.7 & py<3.3 (#107). 2016-01-20 20:05:47 +01:00
Kostis Anagnostopoulos
cee248110b TravisCI: Stop testing on py3.2; too old! 2016-01-20 19:21:52 +01:00
Kostis Anagnostopoulos
c07dbd6b11 FIX Requirements.
+ Have `tox` read from requirements-file.
+ Add forgotten 'passlib' dep in `setup.py'!
2015-09-18 18:24:33 +02:00
Kostis Anagnostopoulos
6635d4dd74 test-server: Pin twine to 1.6.0.
+ Update centodep-TC with monkeypatch for `twine<1.6.0`.
2015-09-17 20:20:14 +02:00
Kostis Anagnostopoulos
e32ca3425b Add test_server TCs with twine<-->real process.
+ TC for #82 uploading `dentodeps` package with 200 deps.
2015-09-17 20:04:00 +02:00
Kostis Anagnostopoulos at STUW025
1fd5653317 FIX #55: Allow unauthenticated uploads with -P . option.
+ Add `mock` lib into test-dependencies for py2.
+ travis: Use new containers.
2015-09-11 16:08:13 +02:00
Kostis Anagnostopoulos, Yoga-2
e5857c211e Tox-test also on py34 2015-02-15 22:43:28 +01:00
Ralf Schmitt
8ca376fadc add buildout config/bootstrap 2013-01-04 02:09:11 +01:00
Ralf Schmitt
be52ec1c40 fix .travis.yml, tox.ini
python 2.5 needs an older webob version. so, we add the dependency in
tox.ini. we use tox to run the tests on travis.

remove python 3.3 from travis.yml as it's not there yet.
2012-12-02 02:35:50 +01:00
Ralf Schmitt
2c22237541 add python 3.2 and 3.3 to tox envlist 2012-12-02 01:21:57 +01:00
Ralf Schmitt
6989d316c5 use webtest instead of twill
webtest works with python 3.

we now also get rid of paste and pastedeploy and use
bottle.Bottle.mount instead.
2012-12-02 01:17:55 +01:00
Ralf Schmitt
2f2eeee593 use new pytest.fixture functionality 2012-11-26 22:25:30 +01:00
Ralf Schmitt
e7cf0e1d7f use paste to test non-root installations 2012-04-03 22:59:01 +02:00
Ralf Schmitt
baa2936217 add some tests for the WSGI app 2011-08-30 03:38:59 +02:00
Ralf Schmitt
9e4b3ec32f toxify 2011-08-30 02:37:25 +02:00