A template for DL python projects with fastai/pytorch, jupyter notebooks and a standard repository structure. IT also has pre-commit hooks, poetry, mypy and pytest
- a standard repository structure
.gitignore
- for python, pycharm and vscode filespoetry
- for dependency management and virtual environmentpytest
setup for successmypy
for type checkingpre-commit
hooks:isort
- to sortimport
statementsruff
- for linting and static analysisblack
- for source code formattingdocformatter
- for formatting docstringsmypy
- for typechecking
/
├── README.md # edit this file to write your own readme
├── pyproject.toml # edit this file to setup the name and authors of your project
├── .gitignore # preconfigured ignores for python, pycharm and vscode files
├── src/ # place your source files and packages here
│ ├── your_module.py
│ ├── your_package/
│ │ ├── ...
│ ├── ...
├── notebooks/ # place your jupyter notebooks here
│ ├── your_notebook.ipynb
│ ├── ...
├── tests/ # place your pytest files here
│ ├── test_your_stuff.py # example
│ ├── ...
├── .pre-commit-config.yaml # preconfigured pre-commit hooks
- Fork this repository as the basis of your own project
- Clone the repository to your own computer
- Follow the setup steps
- edit the
name
/description
/version
/author
fields inpyproject.toml
make sure you have poetry installed by running
poetry --version
-
if you don't, visit https://python-poetry.org/docs/#installing-with-the-official-installer
-
next , install all tools and dependencies using poetry
poetry install
-
this will also install
pre-commit
for you
-
-
now you can use the poetry virutal environment to run all your tools
poetry shell
-
inside the poetry shell you have jupyter lab available
jupyter lab
- now run
pre-commit
to setup all your toolspoetry run pre-commit run --all-files
- install your pre-commit hooks into the repository
poetry run pre-commit install
- run all hooks
poetry run pre-commit run --all-files
- run tests
poetry run pytest