Skip to content
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

Add information for developers to deal with CI linting failures. #844

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions README_developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ conda env create -n <env_name> environment.yml
conda activate <env_name>
python -m pip install --no-deps -e .
```
Note the use of `--no-deps`. Indeed the `environment.yml` already instructs conda to install all the necessary package dependencies. We therefore prevent `setup.py` from overwriting them with the pip-equivalent packages, which might not be compatible with conda.
Note the use of `--no-deps`. Indeed the `environment.yml` already instructs conda to install all the necessary package dependencies. We therefore prevent `setup.py` from overwriting them with the pip-equivalent packages, which might not be compatible with conda.

This creates a new environment with name `<env_name>` with all the necessary library dependencies.
Then it activates the new environment.
Expand Down Expand Up @@ -80,12 +80,12 @@ For example, we can anticipate updating `pyEPR-quantum` to enable Ansys interact
To update your local install, simply execute the metal package install command
```sh
conda env update -n <env_name_exist> environment.yml
```
```
Alternatively, you can remove your conda environment by executing the commands below and later re-create a new environment following the original install instructions in section 1.
```sh
conda env list
conda env remove -n <env_name_exist>
```
```
Notice that using the `conda env update` command might introduce inconsistencies in your virtual environment, and render it unusable. This occurs in general when using conda install commands after any number of pip install commands.

### Setup without conda: in a virtual environment (alternative setup)
Expand Down Expand Up @@ -115,23 +115,30 @@ Here are some things to consider when setting up a development environment:
* Library errors when activating conda environments, or initializing jupyter notebook/lab, might indicate a conflict between python libraries in the base and sub environments. Go ahead and manually delete the library from the base environment `site-packages` folder, shown in the error message. You might need to reinstall them in the sub environment, or create a new one.
* If Jupyter notebook has trouble finding a dll for a package that works in the new environment outside of Jupyter, then try opening Jupyter notebook from the new environment instead of from `base`

### Other Common Issues
# Other Common Issues

For other common installation issues, please refer to the [FAQ](https://qiskit.org/documentation/metal/faq.html)

### Additional steps for developers
## Additional steps for developers

If you are planning to develop the qiskit metal codebase, you need extra packages, which you can install by running the following command instead of (or after) the previous one:
```
python -m pip install -r requirements-dev.txt
```
You may also want to also use these instructions to [setup user environment](/docs/NEW_DEVELOPER_SETUP.md)

#### Setting up precommit hooks
## Setting up precommit hooks

If are planning on committing, you can run the following in the root of your project to link the available precommit hooks.
```
./hook_setup
```
Please make sure the command is run from the same shell you plan on using to commit. If running on Windows, please make sure that this script is run from git-bash or another Linux-style shell. Currently, the precommit hook will check for yapf formatting.

## Get more information when you commit code and CI gives linting error(s)

If are planning on committing, code and get a linting error. Sometimes the log does not have enough details to fix the error.
```
yapf --diff --recursive --style .style.yapf qiskit_metal
```
Go to directory with qiskit-metal/.style.yapf file and run the above command to lint locally. This may give more meaningful feedback for linting failure.