gorilla-co / s3pypi

CLI tool for creating a Python Package Repository in an S3 bucket.
https://novemberfive.co/blog/opensource-pypi-package-repository-tutorial/
MIT License
324 stars 85 forks source link

Compatibility with tox #88

Closed jaustinpage closed 2 years ago

jaustinpage commented 2 years ago

I ran into an issue when trying to use s3pypi in a tox project.

Out of the box, s3pypi leans on shell expansion (dist/*) to upload multiple files to a s3 bucket. Tox does not seem to support this shell expansion, at least on ubuntu using bash.

I looked into ways to get tox to support this, and the answer is to do a "bash exec s3pypi" as your command in the Tox config, which feels kinda clunky.

Another option would be to have hard coded file paths in your tox config. Since the files themselves change names every time the version changes, you really dont want to hard code the file names in the tox config.

Ideally, if i have a tox "publish" command, i should just have to add it to the deps section, and execute s3pypi, pointing to my dist folder.

I am proposing the following changes: If an arg is a file, behavior is unchanged. If an arg is a directory, try to expand the args with all of the files in that directory, but, ignore errors, since some of the contents may not be a valid wheel or tar file.

It is also a goal to implement this in a way that does not require changes in the future if we discover more file types that need to be uploaded.

I will prep the pull request.

mdwint commented 2 years ago

This should do the trick, right?

sh -c 's3pypi dist/* ...'

I personally don't find that clunky at all.

jaustinpage commented 2 years ago

Hmm. The original reason I was using tox over other options was to have a cross-platform test environment that was not dependent on bash/shell/posix. I have to support a lot of windows developers. I must admit that sh -c 's3pypi dist/* ...' is not so bad.

jaustinpage commented 2 years ago

Closing. This is solved by https://github.com/gorilla-co/s3pypi/pull/90