regro / rever

Releaser of Versions
https://regro.github.io/rever-docs/
BSD 3-Clause "New" or "Revised" License
74 stars 33 forks source link

GH release deprecation notice #239

Closed hadim closed 3 years ago

hadim commented 3 years ago

I receive this email from github:

On November 5th, 2020 at 15:55 (UTC) you or an application you used recently accessed the deprecated Authorizations endpoint on the GitHub API with the useragent github3.py/1.3.0.

We will remove the Authorizations API endpoint on November 13, 2020. If you accessed the API via password authentication, then we recommend you use the web flow to authenticate. Please check that your app uses the web flow for authentication https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow

You can learn more about these changes by visiting our developer blog https://github.blog/2020-07-30-token-authentication-requirements-for-api-and-git-operations/

Are you aware of that?

scopatz commented 3 years ago

OK we'll have to address that soon, then

asmeurer commented 3 years ago

This no longer works. You need to use something like the device authorization flow. You can reuse the GitHub_login() function from here https://github.com/drdoctr/doctr/pull/373.

sbillinge commented 3 years ago

Hi @scopatz et al. @hadim thanks for the issue. We are now bumping into this also. Is there a resolution how to update the rever files to get this working again? Thanks so much for this awesome software.

asmeurer commented 3 years ago

It may be possible to generate a token manually to use with rever.

scopatz commented 3 years ago

I just did a release today with rever. I am not sure what the fix is. @asmeurer do you have a link?

asmeurer commented 3 years ago

See the links at https://github.com/drdoctr/doctr/issues/369. There are three options. I have an implementation at https://github.com/drdoctr/doctr/pull/373 that you should feel free to copy for the device authorization flow (just this function, basically).

hadim commented 3 years ago

In case it can be useful, this GH python lib looks nice: https://ghapi.fast.ai/#How-to-use---Python

rjkoch commented 3 years ago

Hey, so it seems like in order to use the approach in the doctr fix, we would need a Device Authorization Grant, as per this page: https://docs.github.com/en/developers/apps/authorizing-oauth-apps#device-flow

I am happy to do this if you all would like.

hadim commented 3 years ago

Yes please @rjkoch go ahead!

rjkoch commented 3 years ago

Cool, I've done this successfully. I can transfer the ownership of the app to a github username or organization. I certainly don't mind holding it, but users may feel more comfortable authorizing a more known user/org than myself.

I think I've got a functional fix in place and I'm working on testing things locally.

hadim commented 3 years ago

I haven't test #243 but if it fixes the issue, can someone release a new version of rever?

rjkoch commented 3 years ago

We're working on it, but test_appimage.py is failing during the release when testing in a docker container. I will put in a PR today to reproduce the issue and confirm this also happens in CI. @anki-code I believe this is your feature. If the test can't be fixed we will likely remove the AppImage feature.

anki-code commented 3 years ago

remove the AppImage feature.

The AppImage feature is used by xonsh and then xonsh.AppImage is used by another products like xxh. I suggest to think twice about removing this.

How I can review the error?

As I know you released the rever before without any errors (0.4.8). What is you changed that the test is not working now?

rjkoch commented 3 years ago

The changelog is in the news documents. Nothing regarding AppImage has been changed. Only how rever interacts with GitHub has been changed.

To reproduce the error, clone/fork the repo and try to run rever -a pytest

anki-code commented 3 years ago

I'll take a look. This could be probably the upstream error.

anki-code commented 3 years ago

I've created the upstream issue - https://github.com/niess/python-appimage/issues/31

anki-code commented 3 years ago

I've fixed the upstream issue in the Pull Requests https://github.com/niess/python-appimage/pull/32 https://github.com/niess/python-appimage/pull/33 - waiting for merge now.

The issue in the upstream package was related to the PyPi deprecation error:

DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default. pip 21.3 will remove support for this functionality. You can find discussion regarding this at pypa/pip#7555.

@rjkoch

anki-code commented 3 years ago

@rjkoch the upstream PRs were merged and released, try to run rever tests again ;)

rjkoch commented 3 years ago

@anki-code rever -a pytest 0.50 still fails in circleCI and locally for me. The offending test is still the AppImage one.

See this PR.

rjkoch commented 3 years ago

@anki-code To be clear, the test only fails when we attempt to run it in a docker container

Here is the traceback:

FAILED tests/test_appimage.py::test_appimage - SystemExit: 1
=================== 1 failed, 123 passed, 1 skipped in 9.75s ===================
activity-error:pytest:activity failed with exception:
Traceback (most recent call last):
  File "/home/circleci/miniconda/lib/python3.8/site-packages/rever/activity.xsh", line 83, in __call__
    self.func(*args, **kwargs)
  File "/home/circleci/miniconda/lib/python3.8/site-packages/rever/activities/pytest.xsh", line 27, in _func
    super()._func(code=command)
  File "/home/circleci/miniconda/lib/python3.8/site-packages/rever/activity.xsh", line 406, in _func
    rtn = docker.run_in_container(image, command, env=env, mounts=mounts)
  File "/home/circleci/miniconda/lib/python3.8/site-packages/rever/docker.xsh", line 450, in run_in_container
    ![docker run -t @(env_args) @(mount_args) @(image) @(command)]
  File "/home/circleci/miniconda/lib/python3.8/site-packages/xonsh/__amalgam__.py", line 20899, in subproc_captured_hiddenobject
    return xonsh.procs.specs.run_subproc(cmds, captured="hiddenobject", envs=envs)
  File "/home/circleci/miniconda/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 3497, in run_subproc
    command.end()
  File "/home/circleci/miniconda/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 907, in end
    self._end(tee_output=tee_output)
  File "/home/circleci/miniconda/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 926, in _end
    self._raise_subproc_error()
  File "/home/circleci/miniconda/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 1052, in _raise_subproc_error
    raise subprocess.CalledProcessError(rtn, spec.args, output=self.output)
subprocess.CalledProcessError: Command '['docker', 'run', '-t', '--env', 'VERSION=0.5.0', '--env', 'REVER_FORCED=False', '--env', 'PROJECT=rever', '--env', 'REVER_DIR=rever-tmp', '--env', 'ACTIVITIES=pytest', '--env', 'PYPI_SIGN=False', '--env', 'VERSION_BUMP_PATTERNS=[(\'rever/__init__.py\', \'__version__\\\\s*=.*\', "__version__ = \'$VERSION\'"), (\'setup.py\', \'version\\\\s*=.*,\', "version=\'$VERSION\',")]', '--env', 'CHANGELOG_FILENAME=CHANGELOG.rst', '--env', 'CHANGELOG_TEMPLATE=TEMPLATE.rst', '--env', 'PUSH_TAG_REMOTE=git@github.com:regro/rever.git', '--env', 'GITHUB_ORG=regro', '--env', 'GITHUB_REPO=rever', '--env', 'GHPAGES_REPO=git@github.com:regro/rever-docs.git', '--env', 'DOCKER_CONDA_DEPS=flake8,ruamel.yaml,coverage,prompt_toolkit,cloud_sptheme,pytest-cov,numpydoc,lazyasd,pytest-timeout,pytest,pprintpp,pytest-flake8,bibtexparser,codecov,xonsh>=0.9.20,github3.py,sphinx', '--env', 'DOCKER_APT_DEPS=file', '--env', 'DOCKER_INSTALL_COMMAND=git clean -fdx && ./setup.py install', '--env', 'DOCKER_GIT_NAME=rever', '--env', 'DOCKER_GIT_EMAIL=rever@example.com', '--env', 'RUNNING_ACTIVITIES=pytest', 'rever/rever-install', 'sh', '-c', 'pytest']' returned non-zero exit status 1.
rewinding to a7d7177268eb2232f5e326ee215394877b4f9305

Exited with code exit status 1
anki-code commented 3 years ago

@rjkoch I can repeat the error by this commands (it would be cool if you gave this to me at start):

cd /tmp
git clone https://github.com/regro/rever
cd rever
rever -a pytest 0.50
docker run -it --rm rever/rever-install bash
pytest tests/test_appimage.py
# RuntimeError: WARNING: Running pip as root

So, upstream PR is here - https://github.com/niess/python-appimage/pull/34 - waiting for the merge.

rjkoch commented 3 years ago

@anki-code Thanks, great for the PR, hopefully this resolves our issue.

anki-code commented 3 years ago

@rjkoch the upstream PR was merged, let's try again!

rjkoch commented 3 years ago

@anki-code Thanks, trying it now.