Skip to content

Commit

Permalink
Merge pull request #1 from piopy/develop
Browse files Browse the repository at this point in the history
release_v0.1.0
  • Loading branch information
piopy authored Jun 5, 2023
2 parents d3cfacf + 8b859e4 commit 5a3863a
Show file tree
Hide file tree
Showing 22 changed files with 2,143 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
159 changes: 159 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

data/*
!data/.gitkeep
!data/*.ico
*.lock
jupyter/**
TODO
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Slite",
"type": "python",
"request": "launch",
"module": "streamlit",
"args": [
"run",
"${workspaceFolder}/src/Homepage.py"
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/src"
}
],
"compounds": []
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"editor.detectIndentation": true,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"indentRainbow.ignoreErrorLanguages": [
"markdown",
],
"autoDocstring.docstringFormat": "numpy",
"autoDocstring.quoteStyle": "\"\"\"",
"autoDocstring.startOnNewLine": true,
"python.defaultInterpreterPath": "${workspaceFolder}/src/.venv",
"window.zoomLevel": 1,
"python.analysis.typeCheckingMode": "off",
"python.formatting.provider": "black",
}
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM python:3.10-slim

# arguments
ARG DEV_MODE
ARG USERNAME
ARG USER_UID
ARG USER_GID

# environment
ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONHASHSEED=random \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.1.13 \
POETRY_VERSION=1.3.1 \
URLLIB_VERSION=1.26.15 \
DAGSTER_HOME=/opt/dagster/dagster_home

# create a non root user and install sudo
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# create a directory and make it accessible to the user
RUN mkdir /app
RUN chown -R $USERNAME:$USERNAME /app

# poetry
RUN pip install "poetry==$POETRY_VERSION" "urllib3==$URLLIB_VERSION"
ENV PATH="${PATH}:/home/${USERNAME}/.local/bin"

# copy only requirements to cache them in docker layer
WORKDIR /app
COPY src/pyproject.toml /app/

# project initialization
RUN poetry config virtualenvs.create false \
&& poetry install $(test "${DEV_MODE}" != prototype && echo "--no-dev") --no-interaction --no-ansi

USER $USERNAME
# creating folders, and files for a project
COPY src/ /app/src/

ENV PYTHONPATH "${PYTHONPATH}:/app/src"

# run
WORKDIR /app/src/
CMD ["python", "main.py"]
Loading

0 comments on commit 5a3863a

Please sign in to comment.