You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 19, 2021. It is now read-only.
* Add dependencies for formatting/styling
Added flake8-bugbear, pre-commit and black.
Contributing.py will have to be updated to reflect new command
to install the deps: `pipenv install -d --pre`
* Add Flake8 config file
This is so that team members can use the same Flake8 configuration
with their editor, before trying to commit.
Setting up their editor to lint with Flake8 should save on some
headaches when trying to commit.
* Add pre-commit config file
This is the file that sets up the pre-commit formatting and linting.
To install, team members will have to run `pre-commit install` once.
* Exclude __init__.py files from Flake8 for now
Some of the __init__.py files are used for imports.
Flake8 raises an unused import error for these and also complains
if the import was a * import.
The unused import error can be resolved by putting the name of the
class or function being imported into __all__, but there will still
be an error if a * import is used.
Since we are still actively creating fixtures and other tests that
might be imported through these __init__ files, I think we should
leave the files be for now and just have Flake8 skip over them during
the pre-commit check.
* Add pre-commit instructions to Contributing.md
* Add custom pipenv script for installing dev deps
Now you can run `pipenv run dev-install` instead of
`pipenv install -d --pre`
- Note: It is not necessary to install python before installing pipenv.
78
78
- Please install pipenv according to their docs for your OS.
79
-
3. Install dependencies `pipenv install -d`
79
+
3. Install dependencies `pipenv run dev-install`
80
80
- Note: Pipenv may prompt you to install Python if it cannot find the correct version on your system. You should select Yes.
81
81
- Note: If you get the error `ImportError: cannot import name 'Feature' from 'setuptools'`, your setuptools version might be at 46 or later. You may be able to get it to work using version 45 (e.g. `pip3 install setuptools==45`)
82
-
4. copy the contents of the `.env.example` to a new file called `.env`
82
+
4. Install our pre-commit hook:
83
+
- Run: `pipenv run pre-commit install`
84
+
5. copy the contents of the `.env.example` to a new file called `.env`
83
85
-`cp .env.example .env`
84
-
5. Create and Seed the database
86
+
6. Create and Seed the database
85
87
- Run: `pipenv run flask db create`
86
88
87
89
- Some other userful commands are:
88
90
- To re-seed the database from scratch run: `pipenv run flask db recreate`
89
91
- To find other database set-up commands run: `pipenv run flask db --help`
90
92
- To drop the database run: `pipenv run flask db drop`
91
-
6. Start the server using the flask environment (required every time the project is re-opened):
93
+
7. Start the server using the flask environment (required every time the project is re-opened):
92
94
- Run: `pipenv run flask run`
93
95
- Run and restart the server on changes: `pipenv run flask run --reload`
94
-
7. Test the server and view coverage reports. Use of coverage reporting is recommended to indicate test suite completeness and to locate defunct code in the code base.
96
+
8. Test the server and view coverage reports. Use of coverage reporting is recommended to indicate test suite completeness and to locate defunct code in the code base.
95
97
- Run all the tests: `pipenv run pytest --cov .`
96
98
- Run tests in a particular directory: `pipenv run pytest --cov [path to directory]`
97
99
- Example: Just the integration tests: `pipenv run pytest --cov tests/integration`
@@ -127,19 +129,19 @@ If you don't see something similar, you may have several versions of Python inst
127
129
128
130
### Database migrations.
129
131
130
-
Database migrations are not used for development. Please ignore do not use migrations during development.
132
+
Database migrations are not used for development. Please ignore do not use migrations during development.
131
133
132
-
Database migrations are managed through [Alembic](https://alembic.sqlalchemy.org/en/latest/index.html). After making a change to a model, a database migration is necessary.
134
+
Database migrations are managed through [Alembic](https://alembic.sqlalchemy.org/en/latest/index.html). After making a change to a model, a database migration is necessary.
133
135
134
136
- The first step is to create a revision: `pipenv run alembic revision --autogenerate -m "message"`
135
137
- The second step is to upgrade: `pipenv run alembic upgrade head`
136
138
137
-
To return to a previous version, a downgrade is necessary. Run:
139
+
To return to a previous version, a downgrade is necessary. Run:
138
140
`pipenv run alembic downgrade -n` where n is the number of versions to downgrade.
139
141
140
-
To downgrade to the very beginning run: `pipenv run alembic downgrade base`
142
+
To downgrade to the very beginning run: `pipenv run alembic downgrade base`
141
143
142
-
The reversion are maintained as Python files in ``./migrations/versions/`
144
+
The reversion are maintained as Python files in ``./migrations/versions/`
143
145
144
146
### Contributing
145
147
@@ -160,6 +162,12 @@ How to contribute to this project.
160
162
161
163
(Step #3 creates a new branch titled <nameofbranch> and navigates you to that branch)
162
164
165
+
4. Commit your changes (and resolve commit errors)
166
+
- Our pre-commit hook is designed to be strict in order to ensure all code being committed to the codebase is as clean and uniform as possible. Commit errors are a good thing, and completely expected!
167
+
- The pre-commit hook will check your code every time you try to commit. If your code needs re-formatting, that will happen automatically. If you have non-formatting errors in your code, these will be printed to the terminal with the error, filename and line number. You will need to resolve these yourself.
168
+
- After your code has been reformatted and/or you have resolved other errors, you will need to add and commit those files again (because they have been modified).
169
+
- Successful commits can then be pushed to your remote branch like normal.
170
+
163
171
#### Updating development branch
164
172
165
173
To update your development branch with the latest changes:
@@ -172,7 +180,7 @@ To update your development branch with the latest changes:
172
180
-`git pull origin development`
173
181
174
182
3. After pulling fresh copy it is a good habit to install any new deps and rebuild the database. Run the following two commands:
175
-
-`pipenv run install -d`
183
+
-`pipenv run dev-install`
176
184
-`pipenv run flask db recreate`
177
185
178
186
4. Finally - run the tests to ensure everything is passing.
0 commit comments