Skip to content

Commit 89a0d41

Browse files
author
Scaffolder
committed
initial commit
0 parents  commit 89a0d41

25 files changed

+617
-0
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Description of the goal of the PR
2+
3+
Description:
4+
5+
## Changes this PR introduces (fill it before implementation)
6+
7+
- [ ] : Change 1
8+
- [ ] : Change 2
9+
10+
## Checklist before requesting a review
11+
- [ ] I have commented my code, particularly in hard-to-understand areas
12+
- [ ] I have typed my code
13+
- [ ] I have created / updated the docstrings
14+
- [ ] I have updated the README, if relevant
15+
- [ ] I have updated the requirements files if a new package is used
16+
- [ ] I have tested my code
17+
- [ ] The CI pipeline passes
18+
- [ ] I have performed a self-review of my code

.github/workflows/ci.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
CI:
7+
name: Launching CI
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ['3.8', '3.9', '3.10']
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
20+
- name: Install requirements
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements-developer.txt
24+
- name: Run Pre commit hook (formatting, linting & tests)
25+
run: pre-commit run --all-files --hook-stage pre-push --show-diff-on-failure

.github/workflows/deploy_docs.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy MkDocs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy-docs:
10+
name: Deploy docs
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: "3.10"
18+
19+
- name: Install requirements
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements-developer.txt
23+
- name: Deploying MkDocs documentation
24+
run: |
25+
mkdocs build
26+
mkdocs gh-deploy --force
27+
28+

.gitignore

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
wheels/
22+
pip-wheel-metadata/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
local_settings.py
60+
db.sqlite3
61+
db.sqlite3-journal
62+
63+
# Flask stuff:
64+
instance/
65+
.webassets-cache
66+
67+
# Scrapy stuff:
68+
.scrapy
69+
70+
# Sphinx documentation
71+
docs/_build/
72+
73+
# PyBuilder
74+
target/
75+
76+
# Jupyter Notebook
77+
.ipynb_checkpoints
78+
79+
# IPython
80+
profile_default/
81+
ipython_config.py
82+
83+
# pyenv
84+
.python-version
85+
86+
# pipenv
87+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
88+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
89+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
90+
# install all needed dependencies.
91+
#Pipfile.lock
92+
93+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
94+
__pypackages__/
95+
96+
# Celery stuff
97+
celerybeat-schedule
98+
celerybeat.pid
99+
100+
# SageMath parsed files
101+
*.sage.py
102+
103+
# Environments
104+
.env
105+
.venv
106+
env/
107+
venv/
108+
ENV/
109+
env.bak/
110+
venv.bak/
111+
112+
# Spyder project settings
113+
.spyderproject
114+
.spyproject
115+
116+
# Rope project settings
117+
.ropeproject
118+
119+
# mkdocs documentation
120+
site/
121+
122+
# mypy
123+
.mypy_cache/
124+
.dmypy.json
125+
dmypy.json
126+
127+
# Pyre type checker
128+
.pyre/
129+
130+
# VSCode project settings
131+
.vscode/
132+
133+
# Secret files
134+
secrets/*
135+
!secrets/.gitkeep
136+
137+
# Mac OS
138+
.DS_Store

.pre-commit-config.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
repos:
2+
- repo: "https://github.com/pre-commit/pre-commit-hooks"
3+
rev: v4.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-toml
8+
- id: check-yaml
9+
- id: check-json
10+
- id: check-added-large-files
11+
- repo: local
12+
hooks:
13+
- id: ruff-format
14+
name: Formatting (ruff)
15+
entry: ruff format
16+
types: [python]
17+
language: system
18+
- id: ruff-fix
19+
name: Linting & sorting (ruff)
20+
entry: ruff --fix --fixable I001 # allow only to fix unsorted imports
21+
types: [python]
22+
language: system
23+
- id: nbstripout
24+
name: Strip Jupyter notebook output (nbstripout)
25+
entry: nbstripout
26+
types: [file]
27+
files: (.ipynb)$
28+
language: system
29+
- id: python-bandit-vulnerability-check
30+
name: Security check (bandit)
31+
entry: bandit
32+
types: [python]
33+
args: ["--recursive", "lib/"]
34+
language: system
35+
- id: pytest-check
36+
name: Tests (pytest)
37+
stages: [push]
38+
entry: pytest tests/
39+
types: [python]
40+
language: system
41+
pass_filenames: false
42+
always_run: true
43+
exclude: ^(.svn|CVS|.bzr|.hg|.git|__pycache__|.tox|.ipynb_checkpoints|assets|tests/assets/|venv/|.venv/)

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
USE_CONDA ?= 1
2+
INSTALL_SCRIPT = install_with_conda.sh
3+
ifeq (false,$(USE_CONDA))
4+
INSTALL_SCRIPT = install_with_venv.sh
5+
endif
6+
7+
.DEFAULT_GOAL = help
8+
9+
# help: help - Display this makefile's help information
10+
.PHONY: help
11+
help:
12+
@grep "^# help\:" Makefile | grep -v grep | sed 's/\# help\: //' | sed 's/\# help\://'
13+
14+
# help: install - Create a virtual environment and install dependencies
15+
.PHONY: install
16+
install:
17+
@bash bin/$(INSTALL_SCRIPT)
18+
19+
# help: install_precommit - Install pre-commit hooks
20+
.PHONY: install_precommit
21+
install_precommit:
22+
@pre-commit install -t pre-commit
23+
@pre-commit install -t pre-push
24+
25+
# help: serve_docs_locally - Serve docs locally on port 8001
26+
.PHONY: serve_docs_locally
27+
serve_docs_locally:
28+
@mkdocs serve --livereload -a localhost:8001
29+
30+
# help: deploy_docs - Deploy documentation to GitHub Pages
31+
.PHONY: deploy_docs
32+
deploy_docs:
33+
@mkdocs build
34+
@mkdocs gh-deploy

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<div align="center">
2+
3+
# choice-learn-private
4+
5+
[![CI status](https://github.com/artefactory/choice-learn-private/actions/workflows/ci.yaml/badge.svg)](https://github.com/artefactory/choice-learn-private/actions/workflows/ci.yaml?query=branch%3Amain)
6+
[![Python Version](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue.svg)]()
7+
8+
[![Linting , formatting, imports sorting: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
9+
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
10+
[![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-informational?logo=pre-commit&logoColor=white)](https://github.com/artefactory/choice-learn-private/blob/main/.pre-commit-config.yaml)
11+
</div>
12+
13+
TODO: if not done already, check out the [Skaff documentation](https://artefact.roadie.so/catalog/default/component/repo-builder-ds/docs/) for more information about the generated repository.
14+
15+
choice-learn is a Python package designed to help you build with ease a discrete choice model.
16+
17+
## Table of Contents
18+
19+
- [choice-learn-private](#choice-learn-private)
20+
- [Table of Contents](#table-of-contents)
21+
- [Installation](#installation)
22+
- [Usage](#usage)
23+
- [Documentation](#documentation)
24+
- [Repository Structure](#repository-structure)
25+
26+
## Installation
27+
28+
To install the required packages in a virtual environment, run the following command:
29+
30+
```bash
31+
make install
32+
```
33+
34+
TODO: Choose between conda and venv if necessary or let the Makefile as is and copy/paste the [MORE INFO installation section](MORE_INFO.md#eased-installation) to explain how to choose between conda and venv.
35+
36+
A complete list of available commands can be found using the following command:
37+
38+
```bash
39+
make help
40+
```
41+
42+
## Usage
43+
44+
TODO: Add usage instructions here
45+
46+
## Documentation
47+
48+
TODO: Github pages is not enabled by default, you need to enable it in the repository settings: Settings > Pages > Source: "Deploy from a branch" / Branch: "gh-pages" / Folder: "/(root)"
49+
50+
A detailed documentation of this project is available [here](https://artefactory.github.io/choice-learn-private/)
51+
52+
To serve the documentation locally, run the following command:
53+
54+
```bash
55+
mkdocs serve
56+
```
57+
58+
To build it and deploy it to GitHub pages, run the following command:
59+
60+
```bash
61+
make deploy_docs
62+
```
63+
64+
## Repository Structure
65+
66+
```
67+
.
68+
├── .github <- GitHub Actions workflows and PR template
69+
├── bin <- Bash files
70+
├── config <- Configuration files
71+
├── docs <- Documentation files (mkdocs)
72+
├── lib <- Python modules
73+
├── notebooks <- Jupyter notebooks
74+
├── secrets <- Secret files (ignored by git)
75+
└── tests <- Unit tests
76+
```

bin/install_with_conda.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash -e
2+
3+
read -p "Want to install conda env named 'choice-learn-private'? (y/n)" answer
4+
if [ "$answer" = "y" ]; then
5+
echo "Installing conda env..."
6+
conda create -n choice-learn-private python=3.10 -y
7+
source $(conda info --base)/etc/profile.d/conda.sh
8+
conda activate choice-learn-private
9+
echo "Installing requirements..."
10+
pip install -r requirements-developer.txt
11+
python3 -m ipykernel install --user --name=choice-learn-private
12+
conda install -c conda-forge --name choice-learn-private notebook -y
13+
echo "Installing pre-commit..."
14+
make install_precommit
15+
echo "Installation complete!";
16+
else
17+
echo "Installation of conda env aborted!";
18+
fi

0 commit comments

Comments
 (0)