-
Notifications
You must be signed in to change notification settings - Fork 31
Rewrite project build and metadata using pyproject.toml #88
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
Conversation
bde2993
to
ec8fc6a
Compare
This patch rewrites the project build configuration using pyproject.toml, which is now the de-facto standard in Python. This single configuration file supersedes setup.py, tox.ini, mypy.ini, etc. I checked the contents of the generated package and made sure they matched exactly (that caught a few issues where I originally excluded some data files). This patch is careful not to change the version of dependencies. In pyproject.toml, we specify minimum package versions for the tool to work, and we provide a requirements.txt file that pins down specific versions for use by end-users. Currently, a few tests are failing if we don't pin exact versions when running them, so we're still pinning exact versions when we run tests via tox. The same holds for the type checker. In the future, we could upgrade towards a proper lockfile instead of manually constructed requirements.txt files. Fixes llvm#77
acce046
to
07fddd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, everything got moved over. Any improvements or corrections from the original information to be considered later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, include the readme changes if you like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work: looks good as initial step.
Just a minor suggestion.
Some of those TODOs can be resolved with uv.
Thanks for the review! I think the TODOs are actually things where we need to fix our tests. For example, |
COPY . /var/src/lnt | ||
|
||
COPY requirements*.txt setup.py . | ||
# setup.py uses lnt.__version__ etc. | ||
COPY lnt/__init__.py lnt/__init__.py | ||
# we build the cperf extension during install | ||
COPY lnt/testing/profile lnt/testing/profile | ||
WORKDIR /var/src/lnt | ||
|
||
RUN pip3 install -r requirements.server.txt \ | ||
&& apk --purge del .build-deps \ | ||
&& mkdir /var/log/lnt | ||
|
||
COPY . . | ||
COPY docker/docker-entrypoint.sh docker/wait_db /usr/local/bin/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we remove the individual COPYs? This will cause unnecessary layers to be invalidated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you just replace the original COPY requirements*.txt setup.py .
with COPY requirements*.txt pyproject.toml .
we should still be able to avoid reinstalling all the requirements on every build
This patch rewrites the project build configuration using pyproject.toml, which is now the de-facto standard in Python. This single configuration file supersedes setup.py, tox.ini, mypy.ini, etc.
I checked the contents of the generated package and made sure they matched exactly (that caught a few issues where I originally excluded some data files).
This patch is careful not to change the version of dependencies. In pyproject.toml, we specify minimum package versions for the tool to work, and we provide a requirements.txt file that pins down specific versions for use by end-users.
Currently, a few tests are failing if we don't pin exact versions when running them, so we're still pinning exact versions when we run tests via tox. The same holds for the type checker.
In the future, we could upgrade towards a proper lockfile instead of manually constructed requirements.txt files.
Fixes #77