This will be updated with uv
. This approach is not recommended anymore
- With poetry installed (
pip install poetry
), and in the folder where you wish to store your project, create a new project with:
poetry new --src [project-name]
cd [project-name] # or potentially `code [project-name]` if using vscode
- Install
ruff
to the dev group. This will use ruff for the development of the project, but not include it in the final package.:
poetry add ruff pre-commit --group dev
-
Copy the
.pre-commit-config.yaml
and.gitignore
file from this repo to the root of your project. In the future, remember to actively edit the.gitignore
file if the need arises in order to prevent repo clutter. -
Create a new repo in the ReLU-NTNU organisation on GitHub. You do not need to add a license,
.gitignore
, orREADME.md
. Then, copy the URL of the repo which should appear after creating the repo. This should look something likehttps://github.com/ReLU-NTNU/solution-seeker.git
. Then, set up git for your project with these commands:
git init
git remote add origin [url]
git branch -M main
git add .
git commit -m "initial commit"
git push -u origin main
- Lastly, run this to install the pre-commit hooks:
poetry shell
pre-commit install
- When a new developer clones the repository, they will need to do a few things. Assuming
python
,pip
andpoetry
are installed, they need to run:
poetry install # this installs the dependencies and creates a virtual environment
poetry shell # this activates the virtual environment in the terminal
pre-commit install # this installs the pre-commit hooks
-
pre-commit
will now run every time the user tries to commit changes to the repository. If the pre-commit hooks fail, the user will not be able to commit the changes. This is to maintain main branch protection and code quality. Tests hooks could also be added here, but that is not included in this repo. The pre-commit hooks should fix the files it found an error with, so if the developer stages the file again with for examplegit add [file-name]
, the pre-commit hooks should pass. -
It is recommended to get a basic understanding of how to use
poetry
. Especially, you have to add dependencies in the right way usingpoetry add [package-name]
andpoetry add [package-name] --dev
for development dependencies. -
Remember to create a
scripts/
andnotebooks/
folder when you need to store scripts and notebooks.