Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/CorrelAid/pystatis into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoHuebner committed Oct 28, 2023
2 parents 1a26bb5 + 5813fb0 commit df34e46
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 32 deletions.
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,31 @@ Contributions to this project are highly appreciated! You can either contact the
4. Push to remote (`git push origin feature/<descriptive-name>`)
5. Open a Pull Request to be merged with dev

## Developer information
## Contributor information

To contribute to this project, please follow these steps:

1. Create a new virtual environment, for example with [conda](https://docs.conda.io/en/latest/) or the standard [venv](https://docs.python.org/3/library/venv.html) and make sure your Python version matches the minimum version for this project.
2. Install [poetry](https://python-poetry.org/docs/) inside your venv. You can do so either with `conda install poetry` or `pip install poetry`, depending on your package manager.
3. Clone the repository via git.
4. Change into the project root directory.
5. Run `poetry install` to create the virtual environment within `poetry`'s cache folder (run `poetry env info` to see the details of this new virtual environment). Run `poetry install --with dev` to receive all additional developer dependencies. `poetry` has installed all dependencies for you, as well as the package `pystatis` itself.
6. Install pre-commit: `poetry run pre-commit install`. This will activate the pre-commit hooks that will run prior every commit to ensure code quality.
7. Do your changes.
8. Run `poetry run pytest` to see if all existing tests still run through. It is important to use `poetry run` to call `pytest` so that `poetry` uses the created virtual environment and not the system's default Python interpreter. Alternatively, you can run `poetry shell` to let `poetry` activate the virtual environment for the current session. Afterwards, you can run `pytest` as usual without any prefix. You can leave the poetry shell with the `exit` command.
9. Add new tests depending on your changes.
10. Run `poetry run pytest` again to make sure your tests are also passed.
11. Commit your changes. This will trigger all pre-commit hooks as defined in `.pre-commit-config.yaml`. If any of these pre-hooks fails, your commit is declined and you have to fix the issues first.
12. Push your changes.
13. Create a PR.
### Dev env setup

1. Install [miniforge](https://github.com/conda-forge/miniforge).
2. Create a new virtual environment using `conda`: Run `conda create -n pystatis python=3.11`. You can choose another Python version as long as it is supported by this package, see the pyproject.toml for supported Python versions.
3. Install [poetry](https://python-poetry.org/docs/) inside your conda environment: Run `conda install poetry`.
4. Clone the repository via git.
5. Change into the project root directory.
6. Run `poetry install` to install all dependencies into the current conda environment (run `poetry env info` to see the details of the current environment). Run `poetry install --with dev` to receive all additional developer dependencies. `poetry` has installed all dependencies for you, as well as the package `pystatis` itself.
7. Install pre-commit: Run `poetry run pre-commit install`. This will activate the pre-commit hooks that will run prior every commit to ensure code quality.

### Workflow

1. Check out the `dev` branch and make sure it is up to date by running `git pull`.
2. Create a new branch by running `git checkout -b <new-branch>` or `git switch -c <new-branch>`. If possible, add an issue number to the branch name.
3. Do your changes.
4. Run `poetry run pytest` to see if all existing tests still run through. It is important to use `poetry run` to call `pytest` so that `poetry` uses the created virtual environment and not the system's default Python interpreter. Alternatively, you can run `poetry shell` to let `poetry` activate the virtual environment for the current session. Afterwards, you can run `pytest` as usual without any prefix. You can leave the poetry shell with the `exit` command.
5. Add new tests depending on your changes.
6. Run `poetry run pytest` again to make sure your tests are also passed.
7. Commit your changes. This will trigger all pre-commit hooks as defined in `.pre-commit-config.yaml`. If any of these pre-hooks fails, your commit is declined and you have to fix the issues first.
8. Before you create a PR make sure that you have the latest changes from dev. Run `git switch dev`, run `git pull`, switch back to your branch with `git switch -` and either do a `git rebase -i dev` or `git merge dev` to get the latest changes in your current working branch. Solve all merge conflicts.
9. Push your final changes.
10. Create a new PR, always against `dev` as target.

To learn more about `poetry`, see [Dependency Management With Python Poetry](https://realpython.com/dependency-management-python-poetry/#command-reference) by realpython.com.
50 changes: 32 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ safety = "^2.0.0"
flake8 = "^3.0"
jupyter = "^1.0.0"
pytest-mock = "^3.8.2"
python-dotenv = "^1.0.0"

[tool.black]
line-length = 80
Expand Down

0 comments on commit df34e46

Please sign in to comment.