-
Notifications
You must be signed in to change notification settings - Fork 46
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
Switch to setup.cfg from setup.py. #129
Conversation
I tested running |
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.
Thanks for making a good example. I think it paints a good picture.
test_require=[ | ||
"matrix-synapse", | ||
], |
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 don't see this having been copied over, but I think that's fine because this is only part of python setup.py test
from what I can tell?
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 should have mentioned that, good catch!
As far as I can tell this was for python setup.py test
, but I don't think that would work properly with the Twisted bits anyway.
In tox we run via trial
, but seem to missing docs on how to run tests manually.
@@ -1,5 +1,6 @@ | |||
[tox] | |||
envlist = packaging, pep8, py35, py36, py37, py38 | |||
isolated_build = True |
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.
For onlookers who didn't know what this meant (me!):
Activate isolated build environment. tox will use a virtual environment to build a source distribution from the source tree. For build tools and arguments use the pyproject.toml file as specified in PEP-517 and PEP-518. To specify the virtual environment Python version define use the isolated_build_env config section.
— tox
version = attr: ldap_auth_provider.__version__ | ||
description = An LDAP3 auth provider for Synapse | ||
long_description = file: README.rst |
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'm really liking attr:
and file:
rather than our (nice, but not really belonging in a config file) exec_file
and read_file
.
(I also believe I read somewhere that setuptools doesn't actually execute the code, it reads it from the AST.)
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.
Yes, this is the main improvement IMO.
Actually I might request a change because of this:
I think this means we need to add a stub as from setuptools import setup
setup() That does the job for me. Am I missing a workaround? |
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 above (or workaround needed, preferably documented)
Hm, actually, before posting that, I only upgraded Can we perhaps get into a habit of documenting that this command is the first one that you want to run in your venv: I note that, although it seems to install, pip reports this:
(emphasis mine) I don't know if that's cause for concern (probably not; it's not in red or anything), but thought it was worth noting. |
Yep. You need pip 21.1 (2021-04-24) for editable installs in projects with only setup.cfg files, or pip 21.3 (2021-10-11) for standardized, PEP 660 support for editable installs for any project that uses pyproject.toml and a compatible build backend. |
I usually upgrade pip every time it yells at me for being out of date FWIW... |
I don't even know how to get pip to yell at me for being out of date. I just tried installing a package and it didn't mention that pip was old. (I was not on the latest pip at the time. :/) I think it's worth dropping a line in with that upgrade command? I think that should catch everything. |
It happens automatically for me, I get a message like:
We don't have directions anywhere to install it as editable, so I don't think there's a place to include this. The normal installation instructions should be fine without upgrading pip and I do not wish to complicate them. |
Hm, I haven't seen that.
That's a shame, but OK, we'll figure it out when we cross it.
If I don't upgrade Pip, I get this very unhelpful error:
|
@reivilibre I'm unsure if there are changes you'd like me to make or not now! I agree that's an unhelpful error, but I'm not sure many people will be installing this in edit-mode. |
The above error is for non-editable mode. I think it would be worth at least mentioning a minimum supported Pip version? I know this isn't exactly our main project, but these kinds of weird errors are tricky for Python strangers and especially since we're aware of them, 6 words along the line of 'Pip x.y or newer is needed.' (in the bullet point where we mention installing into a virtualenv) might just be what someone needs to figure this out. |
Yes, that makes sense. It wasn't clear to me that this was for a normal install. |
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.
Thank you!
setup.cfg
(which we were already using for flake8) to include the metadata fromsetup.py
.pyproject.toml
.build
(and uploadwheels
).