Clean up initial blacklist download on install
#14
Merged
reinhard-mueller
merged 1 commits from clean-setup
into master
3 years ago
Loading…
Reference in New Issue
There is no content yet.
Delete Branch 'clean-setup'
Deleting a branch is permanent. It CANNOT be undone. Continue?
I guess you are already tired of the whole issue around setuptools and the initial download of the blacklist :-/. However, if some day you have some fresh energy you might want to have a look at this patch, it might be the clean and straightforward solution that you may have been looking for.
I have made two essential changes to the process of initially downloading the blacklist at install time, allowing the removal of a number of hacks and workarounds:
Download the files after populating the build directory instead of before. Thus, the files don't have to be included in MANIFEST.in, and following from that,
setup.py sdist
needn't be tricked into not including them in the source distribution.Only import the updater module instead of the full validate_email package, so
setup.py install
and friends don't depend on all the requirements of the library.As usual, any kind of feedback is always appreciated!
Feeling sedulous?
You might want to check travis, because stuff is failing ...
... and when you arrive to the same conclusions I did, you'll realize why I spent a day with this stuff, and why it is the way it is :)
Like I said: python packaging (distutils/setuptools) is a mess. Nevertheless, feel free to play around with it and see if you can find a solution to putting the data directory in at install time, that is better than mine.
@ -12,12 +12,11 @@ python:
install:
Nope!
The point here is to install the package as if it were installed from pypi.
setup.py develop
is not the way of doing it!@ -12,12 +12,11 @@ python:
install:
Okay, understood!
@ -106,4 +90,4 @@
def _process(self, force: bool = False):
'Start optionally updating the blacklist.txt file, while locked.'
if not force and not self._is_old:
This here serves a purpose, an edge case.
If the preinstalled file path doesn't exist (for example at install time), it should return
True
so that the updater will start an update. Besides, your updated version does returnNone
, which is not a strictbool
just boolish.@ -106,4 +90,4 @@
def _process(self, force: bool = False):
'Start optionally updating the blacklist.txt file, while locked.'
if not force and not self._is_old:
Yes, right, there's a "return True" at the end of my version missing. In practice, this should never happen (this code is not run at install time any more), but I absolutely agree that it's better to have it there.
Sorry about the initial mess in the travis checks, I'm fairly new to travis. I think it should be ok now.
Could you merge master into this?
Sure, done!
I will have to look into this somewhat deeper because I think your changes are taking out details I intentionally built in. I'll check back on you.
Sure, take your time, and don't hesitate to send me questions, comments or criticism!
Please correct the mentioned things, other than that, seems good to me.
Seems like a fresh set of eyes can bring improvement on this. It still boggles my mind how complicated the setup process is.
@ -81,0 +46,4 @@
store it into the build directory. A subsequent 'install' step will
copy the full contents of the build directory to the install
target, thus including the blacklist.
"""
Please store and restore the original value of
dont_write_bytecode
, in order to not interfere with other installers.The dependencies of this package (idna, dnspython, filelock) are missing upon installation. Try and install the sdist package in a new venv, and you'll see them being not installed. You removed the dependencies from here.
I'd call this
_install
, signifying it's only intended for internal use.@ -18,3 +16,4 @@
- python -Wd -m pip install -v dist/py3-validate-email-*.tar.gz
# command to run tests
script:
-I
isolates the user environment (~/.local/lib...
under linux), not the virtual env you intended, I think. Even if there's no venv in the case of travis tests, it makes no difference in isolating python here. The point of theInstallTest.test_datadir_is_in_place
is to not use the locally deployedvalidate_email
directory, hence thesys.path.remove("")
in the test.Okay.
Do you have a tool to check the completeness of type annotations, or are you just so attentive? I really try to pay attention but I seem to forget this at least in one place for each of my commits :-/
@ -81,0 +46,4 @@
store it into the build directory. A subsequent 'install' step will
copy the full contents of the build directory to the install
target, thus including the blacklist.
"""
Okay.
Sorry, I was tricked by the fact that in .travis.yml, the dependencies were explicitly installed. This is because previously, the install process itself depended on them, which is no longer the case, so I'll remove that one line.
Does this leave any reason to keep requirements.txt at all, or would it be preferrable to have the dependency list directly in setup.py? The latter seems to be what most libraries do, AFAICT.
One could use mypy for that, I don't because I couldn't set it up properly with Django.
I use python-language-server with sublime, and that will show completions for function input parameters only if the type is specified there. So basically it's grown to be a habit for me.
I don't remember why I put it into requirements.txt, but it's fine to specify them in setup.py.
All the changes should be done now.
@karolyi I recommend that before doing a release you make sure you delete the directory py3-validate-email.egg-info because that contains some information which now is not correct any more.
Regarding the requirements, I moved them to setup.py as they were. I'm not sure whether there is a specific reason to have the exact versions there (with ==), I guess users of the library would be happier if it was >=.
Please let me know whether I should squash into a single commit again before you merge.
@ -87,3 +54,4 @@
run_initial_updater(Path(self.build_lib))
setup(
Hey,
I made some changes regarding version usage and travis output, please squash and we're good to go.
Squash done! Thank you for your additional improvements!
Reviewers
79e59ee4b7
.Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Gitea.