rileyshahar / aga

aga grades assignments
MIT License
8 stars 2 forks source link

deprecated dependency specifiers #72

Open erblum opened 2 weeks ago

erblum commented 2 weeks ago

(Hi folks! I am the furthest thing from a developer so please excuse any accidental breaches of open source norms/etiquette.)

Summary

I have an older script from spring 2023 that worked at the time, but is now hitting an error when I try to rebuild on Gradescope. My best guess is that the dependency specifiers for types-toml, dacite, and toml need to be updated to conform to a newer specification. (More details below!)

Caveat: there is a non-zero chance that this is user error and the real problem is that I'm using an old version of aga. I noticed that the build output mentions aga 0.10.0, despite my best efforts to update to the latest version. Sorry in advance if that turns out to be the issue!

Details

Here is [what I think is] the relevant part of the build output from Gradescope for the broken problem (full output pasted in broken_output.txt, attached):

...
Obtaining file:///autograder/source
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Discarding file:///autograder/source: Requested aga==0.10.0 from file:///autograder/source has invalid metadata: Expected end or semicolon (after name and no valid version specifier)
    dacite>=^1.6.0
          ^
ERROR: Requested aga==0.10.0 from file:///autograder/source has invalid metadata: Expected end or semicolon (after name and no valid version specifier)
    dacite>=^1.6.0

The build error itself reads: The command '/bin/sh -c bash /gradescope/setup.sh' returned a non-zero code: 1

I went back to look at an untouched Gradescope problem (last built March 18 2024) to compare and noticed some deprecation warnings. Here is an excerpt from the build output from the untouched problem, starting at the same spot as the excerpt above from the broken problem. (Full output in working_output.txt)

...
Obtaining file:///autograder/source
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting dacite>=^1.6.0 (from aga==0.10.0)
  Downloading dacite-1.8.1-py3-none-any.whl.metadata (15 kB)
...
DEPRECATION: aga 0.10.0 has a non-standard dependency specifier dacite>=^1.6.0. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of aga or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
DEPRECATION: aga 0.10.0 has a non-standard dependency specifier toml>=^0.10.2. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of aga or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
DEPRECATION: aga 0.10.0 has a non-standard dependency specifier types-toml>=^0.10.8. pip 24.1 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of aga or contact the author to suggest that they release a version with a conforming dependency specifiers. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: gradescope-utils, typing-extensions, types-toml, toml, packaging, mypy-extensions, dill, dacite, click, typing-inspect, typer, marshmallow, dataclasses-json, aga
  Running setup.py develop for aga
Successfully installed aga-0.10.0 click-8.1.7 dacite-1.8.1 dataclasses-json-0.6.4 dill-0.3.8 gradescope-utils-0.5.0 marshmallow-3.21.1 mypy-extensions-1.0.0 packaging-24.0 toml-0.10.2 typer-0.9.0 types-toml-0.10.8.20240310 typing-extensions-4.10.0 typing-inspect-0.9.0
...
Successfully built 735dbd2a20c0
Successfully tagged gradescope/autograders:us-prod-docker_image-349767

Let me know if there's any other info that would be helpful for reproducing/debugging.

Attachments

broken_output.txt working_output.txt

FlickerSoul commented 2 weeks ago

Hi,

Thanks for getting in touch. What python version did you use to bundle the aga script and what python version did you use in gradescope?

It looks like pip may have updated their syntax for dependency management. It's not clear to me how to fix it at this moment but I'd love to help if you can provide me more information (such as Python version and the bundled autograder scripts).

erblum commented 2 weeks ago

I generated the .zip on my laptop, which has Python 3.11.5. (I know different Python versions on the same machine sometimes cause sneaky problems, so if there is a way to see/control which Python version is being used to generate, let me know and I'll try to find out for you.)

Looking at the build output, I see a line that says Setting up python3.11 (3.11.8-1+jammy2) ... so it looks like 3.11.8 is being used there.

Here is the bundled script (created by running aga gen --inject injection.py 2_collatz_length.py): collatz_length.zip

And a zip containing just the plain source files: src files.zip

jimfix commented 2 weeks ago

Hi, Larry! I faced this problem too. I think I had hoped to work around this by explicitly installing the needed Python packages in setup.sh with the lines below, and then maybe eliminating the install_requires. But it has been a week or so and can't remember if that was a working workaround.

python3.10 -m pip install dataclasses-json
python3.10 -m pip install dill
python3.10 -m pip install gradescope-utils
python3.10 -m pip install typer
python3.10 -m pip install dacite
python3.10 -m pip install toml
python3.10 -m pip install types-toml
FlickerSoul commented 2 weeks ago

A workaround can be removing the ^ in the install_requires in the generated setup.py. I can push an update a bit later.

FlickerSoul commented 2 weeks ago

Alright, the fix has been pushed. I cannot release the package to PyPI because there is some issue with Riley's account (her primary email is not verified). Until then, you can clone the repo and install locally. @jimfix @erblum

FlickerSoul commented 2 weeks ago

I took the idea of aga and built a new version here. The syntax is similar and you should be able to get started pretty quickly with the existing scripts.

erblum commented 2 weeks ago

Thanks so much, Larry! This is a huge help.