-
Notifications
You must be signed in to change notification settings - Fork 2
Install package locally #76
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
Open
codeinthehole
wants to merge
2
commits into
main
Choose a base branch
from
cc-backports
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| SHELL=/bin/bash | ||
|
|
||
|
|
||
| .PHONY:dev | ||
| dev: install_python_packages | ||
|
|
||
|
|
||
| .PHONY:install_python_packages | ||
| install_python_packages: requirements.txt | ||
| # Install the `timezone_tools` package (in editable mode) and the development dependencies. | ||
| python3 -m pip install -r requirements.txt -e . | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Am not wedded to having a makefile if you'd prefer to have this command in
CONTRIBUTING.mdinstead. But I think it's probably a good idea to keep commonly-used commands in a makefile (or invoke tasks if we get there) to make contributors' lives easier. Especially once the command has a few options in it.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.
We can change the command in the contributing guide -- I have no particular objection to that.
Although, I'm not sure I understand why everybody should need to install
-e .. That does seem like something that's needed for a specific personal workflow. (again, not getting in your way there)I would object to using GNU
makeas a task runner, though. I think it makes it less obvious what's going on, because contributors need to dig through theMakefileand it's funny syntax (what does "phony" mean? what is the indirection doing here? etc) to understand that the requirements are just inrequirements.txtand if they have a preferred tool for managing their virtual environments, they just need to install that.Uh oh!
There was an error while loading. Please reload this page.
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.
To trace a parallel... When I am working on django-pg-migration-tools I can use
noxto test. However, it takes too much time to runnoxas it goes through the test matrix for all the permutations of Django and Python. It takes a lot of time even in parallel as I have more permutations than cores to run them.The alternative is to run
python -m pytestusing the virtual environment on my local machine (no testing matrix, thus faster). It's nice to be able to do so when I am experimenting and want a quick feedback. Without installing the package in edit mode I'd have to do apip install .every time I change a file I'm experimenting with before I run tests.That said, I am not sure what the current situation for this package is. It looks smaller from a testing matrix perspective and number of tests - CI takes 5s to run the testing matrix. If that is tolerable then devs could run that locally and it might not be that big of a deal.
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.
That isn't the case for this project:
Even without
-p:Oh, if we're installing the project then I understand why we'd want an editable install, rather than a static one, I just don't understand why it would be necessary to install it at all.
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 suppose this boils down to whether running
pytestin the local (non-tox) virtualenv is a common or recommended practice that we should make possible with the standard installation process.My instinct is that running
pytestin this way is a more common practice than doing everything viatox.While
toxis fast in a small repo like this, it's still significantly slower. On my machinepytesttakes 200-300ms to run the test suite whiletox -e py312takes 1-2 seconds. That's noticeable when doing TDD.But crucially, does it do harm to have the package installed in editable mode?
It doesn't get in the way of people who only want to run tests via
toxright? But not doing it is inconvenient for people who want to use the localpytestapproach.Plus it's inline with our how our CookieCutter repos are set-up, lowering the barrier to contributing to this repo for other devs.
That's what I think we should install the package locally.