Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyproject: port build to pyproject.toml #156

Merged
merged 13 commits into from
Aug 7, 2024
Merged

Conversation

woodruffw
Copy link
Collaborator

@woodruffw woodruffw commented Jul 26, 2022

WIP.

Two years later, and every version of pip that pip-api supports is now new enough to also support pyproject.toml 🙂

Signed-off-by: William Woodruff william@trailofbits.com

Signed-off-by: William Woodruff <william@trailofbits.com>
@di
Copy link
Owner

di commented Jul 26, 2022

Hmm, so since we're currently testing against some very old pip versions we might not be ready to adopt this.

@woodruffw
Copy link
Collaborator Author

Yeah...I was thinking we could maybe pre-build the sdist or wheel using python -m build and then downgrade the environment to the appropriate version of pip to test with, but I'm not familiar enough with tox to know how to do that off the top of my head.

@woodruffw
Copy link
Collaborator Author

Separately, I'm not sure I understand the current CI failure:

ERROR: invocation failed (exit code 1), logfile: /home/runner/work/pip-api/pip-api/.tox/py37-pip1921/log/py37-pip1921-2.log
================================== log start ===================================
ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: /home/runner/work/pip-api/pip-api
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)
WARNING: You are using pip version 19.2.1, however version 22.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

=================================== log end ====================================
___________________________________ summary ____________________________________
ERROR:   py37-pip[19](https://github.com/di/pip-api/runs/7523371831?check_suite_focus=true#step:5:20)21: InvocationError for command /home/runner/work/pip-api/pip-api/.tox/py37-pip1921/bin/python -m pip install --exists-action w -e . (exited with code 1)

(I don't see an invocation that forces editable installs anywhere in tox.ini, but that might again be because I don't understand it too well.)

@di
Copy link
Owner

di commented Jul 26, 2022

I think it's this: https://github.com/di/pip-api/blob/master/tox.ini#L10

Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw
Copy link
Collaborator Author

Alright, now it fails due to the ancient pips, as expected:

Processing ./.tox/.tmp/package/1/pip_api-0.0.30.tar.gz
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/opt/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-req-build-y74h3gsq/setup.py'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-y74h3gsq/
You are using pip version [18](https://github.com/di/pip-api/runs/7524008455?check_suite_focus=true#step:5:19).1, however version [22](https://github.com/di/pip-api/runs/7524008455?check_suite_focus=true#step:5:23).2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

@woodruffw
Copy link
Collaborator Author

(Another missing thing: we need to embed everything that's currently specified via MANIFEST.in, since pyproject.toml-based builds don't respect that file.)

@di
Copy link
Owner

di commented Oct 25, 2022

Might be good to figure out at which point we can drop support for the ancient pip versions (i.e., when we only support Python versions that they predate). But given the relative newness of pyproject.toml support, this might be a long while.

Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
pyproject.toml Outdated Show resolved Hide resolved
Signed-off-by: William Woodruff <william@trailofbits.com>
@woodruffw woodruffw marked this pull request as ready for review August 5, 2024 21:17
@woodruffw woodruffw self-assigned this Aug 5, 2024
@woodruffw woodruffw requested a review from di August 5, 2024 21:29
pip_api/_parse_requirements.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
Signed-off-by: William Woodruff <william@trailofbits.com>
Signed-off-by: William Woodruff <william@trailofbits.com>
pyproject.toml Outdated Show resolved Hide resolved
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
@di di merged commit d83552d into di:master Aug 7, 2024
173 checks passed
@di
Copy link
Owner

di commented Aug 7, 2024

Thanks for following through on this!

@woodruffw woodruffw deleted the ww/pyproject branch August 7, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants