Skip to content

Commit

Permalink
Add common DS & ML packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Hassan Abedi authored and habedi committed Aug 5, 2024
1 parent 41b8d26 commit 54b8db7
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 39 deletions.
13 changes: 8 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@
# Top-most EditorConfig file
root = true

# Python specific settings, complying with PEP 8 style guide
# Python specific settings, complying with PEP 8 style guide, except for the line length
[*.py]
indent_size = 4
max_line_length = 79
max_line_length = 120

# Markdown files
[*.md]
trim_trailing_whitespace = false

# Bash scripts
[*.sh]
indent_size = 4
indent_size = 2

# SQL files
[*.sql]
indent_size = 4
indent_size = 2

# YAML files
[*.yaml]
[*.yml]
indent_size = 2

# JSON files
[*.json]
indent_size = 2

43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests

on:
workflow_dispatch: # Only enable manual runs for now

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
# Define the Python versions to test against
python-version: [ "3.9", "3.10", "3.11" ]

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set Up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

# Install Poetry and Dependencies and run tests with coverage and upload test results and coverage reports as artifacts
- name: Install Poetry and Dependencies
run: |
pip install poetry
poetry install
- name: Run Tests with Coverage
run: |
poetry run pytest tests/ --doctest-modules --cov=src --cov-report xml --cov-report html \
--junitxml=junit/test-results-${{ matrix.python-version }}.xml
continue-on-error: false

- name: Upload Test Results and Coverage Reports
uses: actions/upload-artifact@v2
with:
name: test-results-and-coverage
path: |
junit/test-results-${{ matrix.python-version }}.xml
htmlcov/
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ tmp/
# Dependency lock files (uncomment to ignore)
poetry.lock

# Miscellaneous files
# Add any additional file patterns to ignore specific to your project down here
# Miscellaneous files and directories to ignore
# Add any additional file patterns a directory names that should be ignored down here


16 changes: 0 additions & 16 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Hassan Abedi
Copyright (c) 2024 Hassan Abedi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
# Template Repository for Python Projects
# Template for Python Projects

[![Tests](https://github.com/habedi/template-python-project-repo/actions/workflows/tests.yml/badge.svg)](https://github.com/habedi/template-python-project-repo/actions/workflows/tests.yml)
[![Made with Love](https://img.shields.io/badge/Made%20with-Love-red.svg)](https://github.com/habedi/template-python-project-repo)

This repository is as a template for starting Python projects with the following features:

- [Poetry](https://python-poetry.org/) for dependency management
- [pytest](https://docs.pytest.org/en/stable/) for testing
- [Pylint](https://www.pylint.org/) for code linting

It is mainly intended for my personal use to start machine learning data science projects but feel free to use it as a starting point for your own projects.

## Prerequisites
It is mainly intended for my personal use when starting machine learning data science projects, but feel free to use it
as a starting point for your own projects.

Before you can use this template, make sure you have Python installed on your system. We are going to use [Poetry](https://python-poetry.org/) for dependency management, which needs Python 3.7 or newer.
## Installing Poetry

`pip install poetry`
We need to install [Poetry](https://python-poetry.org/) to get started. You can install
Poetry by running the following command in the shell.

To initiate the Poetry environment and install the dependency packages, run the following commands in the shell in the root folder of this repository after downloading it.
```bash
pip install poetry
```

`poetry update && poetry init`
When the installation is finished, run the following command in the shell in the root folder of this repository to
install the dependencies, and create a virtual environment for the project.

After that, enter the Poetry environment by invoking the poetry's shell using the following command:
```bash
poetry install
```

`poetry shell`
After that, enter the Poetry environment by invoking the poetry shell command.

Edit the `pyproject.toml` file to update the project name, description, and other metadata.
```bash
poetry shell
```

## Structure

Expand All @@ -39,8 +49,7 @@ The repository has the following structure:
- `README.md`: project information and instructions

Feel free to modify the structure to fit your needs.



## License

Files in this repository are licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[tool.poetry]
name = "template-python-project-repo"
version = "0.1.0"
description = ""
description = "A template for a data science or machine learning project in Python."
authors = ["Hassan Abedi <hassan.abedi.t@gmail.com>"]
readme = "README.md"
packages = [{include = "template_python_project_repo"}]
packages = [{ include = "template_python_project_repo" }]

[tool.poetry.dependencies]
python = "^3.11"
pylint = "^3.0.3"
pytest = "^8.0.1"
jupyter = "^1.0.0"
polars = "^0.20.17"
seaborn = "^0.13.2"
pandas = "^2.2.1"


[build-system]
Expand Down

0 comments on commit 54b8db7

Please sign in to comment.