django-celery-beat icon indicating copy to clipboard operation
django-celery-beat copied to clipboard

Running setup.py directly is deprecated

Open cclauss opened this issue 1 year ago • 12 comments

Running python3 setup.py directly as a script is deprecated.

  • https://setuptools.pypa.io/en/latest/deprecated/commands.html
  • https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html#summary

Let's use python3 -m build and python3 -m pip install instead of directly running setup.py.

cclauss avatar Feb 22 '24 12:02 cclauss

~This PR is draft because I need to do Makefile but will do that in the next few hours.~

cclauss avatar Feb 25 '24 10:02 cclauss

OK... This is now ready for review. The only thing I am unclear about is the Makefile lines 69 and 71 but we will need to debug them to make the release process happen. Let me know if you want an extra pair of eyes for the release process.

cclauss avatar Feb 27 '24 10:02 cclauss

I went to look into setuptools' changelog what these register and upload --sign commands that I never saw before were, and setuptools tells us you can forget about them and just do with twine https://github.com/pypa/setuptools/pull/1898. So I think you can just remove these two lines. If you want, you can test locally that it still work as you expect by making twine point to the test version of PyPI: https://test.pypi.org/

deronnax avatar Feb 27 '24 13:02 deronnax

I went to look into setuptools' changelog what these register and upload --sign commands that I never saw before were, and setuptools tells us you can forget about them and just do with twine https://github.com/pypa/setuptools/pull/1898. So I think you can just remove these two lines. If you want, you can test locally that it still work as you expect by making twine point to the test version of PyPI: https://test.pypi.org/

I like this idea although I've never used the test pypi index before. @cclauss I'm up for testing it if you're interested and if it works deploy to normal pypi afterwards.

Nusnus avatar Feb 27 '24 15:02 Nusnus

Even with the above fixes, the steps in the README do not work for me locally:

 => [base] exporting to image                                                                                                                                                  0.0s
 => => exporting layers                                                                                                                                                        0.0s
 => => writing image sha256:5fe8d8101eb68554633bd1a71f3197d691c35206b3fe0a4bf7254a8fe3a3d0ab                                                                                   0.0s
 => => naming to docker.io/library/django-celery-beat-base                                                                                                                     0.0s
 => [celery-beat internal] load .dockerignore                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                0.0s
 => [celery-beat internal] load build definition from Dockerfile                                                                                                               0.1s
 => => transferring dockerfile: 325B                                                                                                                                           0.0s
 => ERROR [celery-beat internal] load metadata for docker.io/library/django-celery-beat_base:latest                                                                            2.4s
 => [django internal] load .dockerignore                                                                                                                                       0.0s
 => => transferring context: 2B                                                                                                                                                0.0s
 => [django internal] load build definition from Dockerfile                                                                                                                    0.1s
 => => transferring dockerfile: 315B                                                                                                                                           0.0s
 => [celery-beat auth] library/django-celery-beat_base:pull token for registry-1.docker.io                                                                                     0.0s
------
 > [celery-beat internal] load metadata for docker.io/library/django-celery-beat_base:latest:
------
failed to solve: django-celery-beat_base: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

However, this is also true on the main branch as well as v2.5.0 at this point, so I am unsure what the best path forward would be.

amweiss avatar Feb 28 '24 14:02 amweiss

What you are posting is seemingly a docker error, and there is no docker in the Makefile, so I am not sure how you got it. For the Makefile, I was able to have make release to work, that's what interests us here.

Regarding the docker error, it's something trivially wrong in the dockerfiles: the Dockerfiles ask for a tagged base image that is never generated, hence the error. It probably never worked.

deronnax avatar Feb 28 '24 14:02 deronnax

@deronnax

I was able to have make release work, that's interests us here. [ ... ] [Docker] probably never worked.

@Nusnus I agree with these statements and am ready to proceed with this PR as-is.

cclauss avatar Feb 28 '24 14:02 cclauss

What you are posting is seemingly a docker error, and there is no docker in the Makefile, so I am not sure how you got it. For the Makefile, I was able to have make release to work, that's what interests us here.

Regarding the docker error, it's something trivially wrong in the dockerfiles: the Dockerfiles ask for a tagged base image that is never generated, hence the error. It probably never worked.

This PR changed the Dockerfile, so I wanted to see what it did. However, it seems like it's never worked.

amweiss avatar Feb 28 '24 15:02 amweiss

as the oldest maintainer of the project, I would like to review it in detail before merging. hope you are OK with it.

auvipy avatar Feb 29 '24 12:02 auvipy

@auvipy

as the oldest maintainer of the project, I would like to review it in detail before merging. hope you are OK with it.

Please be aware that the release for Django 5 support is blocked on this PR: #680

From my understanding this PR is also ready already, even if not everything is perfect.

Many are expecting a release soon, IMHO I believe we should proceed - let me know what I can do to accelerate the merge, how may I help?

P.S I'm up for a zoom session or anything online to work together - let me know bro 🤙

Nusnus avatar Mar 02 '24 06:03 Nusnus

Many are expecting a release soon, IMHO I believe we should proceed - let me know what I can do to accelerate the merge, how may I help?

I also agree that a new release with Django 5.0 support is needed, but I don't think this PR is a blocker.

ulgens avatar Mar 02 '24 06:03 ulgens

I also agree that a new release with Django 5.0 support is needed, but I don't think this PR is a blocker.

Makes sense actually, reviewing again the changes of this PR.

If you agree @cclauss, we can move forward and continue with the PR after @auvipy gives us his feedback to proceed in both paths.

Nusnus avatar Mar 02 '24 07:03 Nusnus

Looks good to me. Migrating the setup.py to a declarative form could be the next step, wdyt?

deronnax avatar Jul 04 '24 09:07 deronnax

With these changes in place, if you want to make the README work correctly or the docker compose actions work, the following changes are still needed. Add the following lines:

      tags:
        - django-celery-beat_base:latest

below https://github.com/cclauss/django-celery-beat/blob/bc4684b174d6d5c766dffc3a6f74241e9ca113f7/docker-compose.yml#L10-L11

so the base definition looks like the following:

  base:
    build:
      context: .
      dockerfile: docker/base/Dockerfile
      tags:
        - django-celery-beat_base:latest
    command: ["sleep", "inf"]

After that, the docker-compose up --build command will work as it's stated in the README.

amweiss avatar Jul 08 '24 17:07 amweiss

This sat un-reviewed to too long until setuptools changes brokesetup test in

  • #771
  • #772

Let's get some maintainers reviews on this please.

cclauss avatar Jul 29 '24 06:07 cclauss

While this is fresh in everyone's head, would now be a good time to make a new release? The change in setuptools was reverted, but it's been deprecated for years, so it will be removed at some point in... Would be nice to give plenty of time for upgrading.

Thanks!

browniebroke avatar Jul 30 '24 10:07 browniebroke

😉 https://github.com/celery/django-celery-beat/pull/749#issuecomment-2256346238

cclauss avatar Jul 30 '24 10:07 cclauss