Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'
- name: Set up cache
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'
- name: Pip Update
run: |
make -s update-pip
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ stages:
- package
- doc

image: python:3.8
image: python:3.10

lint:
stage: lint
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
args: ["--config=pyproject.toml"]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.252
rev: v0.0.262
hooks:
- id: ruff

Expand Down
6 changes: 6 additions & 0 deletions .rtx.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# rtx settings set experimental true
[tools]
# poetry = {version='latest', pyproject='pyproject.toml'}
poetry = '1.4.2'
# python = '3.10'
python = {version = "3.10", virtualenv = ".venv"} # must be after poetry so the poetry bin is first in PATH
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SHELL=/bin/bash
ROOT_DIR=python-template
PACKAGE=python_template
PYTHON = python
PYTHON_VERSION=3.8
PYTHON_VERSION=3.10
DOC_DIR=./docs
TEST_DIR=./tests
TEST_MARKER=placeholder
Expand All @@ -22,12 +22,22 @@ help:
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m\
%s\n", $$1, $$2}'

# If .env file exists, include it and export its variables
ifeq ($(shell test -f .env && echo 1),1)
include .env
export
endif

python-info: ## List information about the python environment
@which ${PYTHON}
@${PYTHON} --version

update-pip:
${PYTHON} -m pip install -U pip

install-poetry: ## Install poetry if it is not already installed (Installing poetry with official method is recommended)
$(MAKE) update-pip
! command -v poetry &> /dev/null && pip install poetry==1.3.2
! command -v poetry &> /dev/null && pip install poetry==1.4.2
# poetry config virtualenvs.create false
# poetry config repositories.private-pypi <PRIVATE_PYPI_URL>
# poetry config http-basic.private-pypi ${PYPI_USERNAME} ${PYPI_PASSWORD}
Expand Down Expand Up @@ -75,7 +85,7 @@ install-precommit: ## Install pre-commit hooks
pre-commit install

install-lint:
pip install black[d]==23.1.0 ruff==0.0.252
pip install black[d]==23.1.0 ruff==0.0.262

install-build:
############# PIP ############
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ curl -sSL https://install.python-poetry.org | python3 -

- Install the project dependencies
```bash
conda create -n python-template python=3.8 -y
conda create -n python-template python=3.10 -y
conda activate python-template
make -s install
```
Expand Down
6 changes: 4 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ARG APP_NAME=python_template
ARG APP_PATH=/opt/$APP_NAME
ARG PYTHON_VERSION=3.10-slim-bullseye
ARG POETRY_VERSION=1.3.2
ARG POETRY_VERSION=1.4.2

#
# Stage: staging
Expand All @@ -22,7 +22,8 @@ ENV \
POETRY_VERSION=$POETRY_VERSION \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1
POETRY_NO_INTERACTION=1 \
POETRY_INSTALLER_MAX_WORKERS=10

RUN apt-get update && \
apt-get install --no-install-recommends -y \
Expand All @@ -36,6 +37,7 @@ ENV PATH="$POETRY_HOME/bin:$PATH"
# Import our project files
WORKDIR $APP_PATH
COPY ./poetry.lock ./pyproject.toml ./
RUN poetry install --no-root
COPY . .

#
Expand Down
40 changes: 20 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[virtualenvs]
create = false
in-project = true
prefer-active-python = true
29 changes: 14 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mkdocstrings = {version = "^0.20.0", extras = ["python"]}

[tool.poetry.group.dev.dependencies]
pre-commit = "^2.19.0"
ruff = "0.0.252"
ruff = "0.0.262"
black = {version = "23.1.0", extras = ["d", "jupyter"]}
mypy = "^1.0.0"
scalene = "^1.5.19"
Expand Down Expand Up @@ -113,22 +113,23 @@ target-version = "py38"
# required-version = "0.0.238"
line-length = 88
select = [
"B", # flake8-bugbear
"C", # flake8-comprehensions
"C9", # mccabe
"D", # flake8-docstrings
"E", # pycodestyle errors (default)
"F", # pyflakes (default)
"W", # pycodestyle warnings
"I001", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"I", # isort
"PD", # pandas-vet
"PIE", # pie
"PL", # pylint
"PTH", # pathlib
"Q", # flake8-quotes
"D", # flake8-docstrings
"T", # (disallow print statements) keep debugging statements out of the codebase
"RET", # return
"RUF", # Enable all ruff-specific checks
# (pylint) use all pylint rules (ruff currently implements only a subset of
# pylint's rules)
"PLC",
"PLE",
"PLR",
"PLW",
"SIM", # simplify
"T20", # (disallow print statements) keep debugging statements out of the codebase
"W", # pycodestyle warnings
]
#extend-select = []
respect-gitignore = true
Expand All @@ -140,8 +141,6 @@ ignore-init-module-imports = true
# ignore = []
extend-ignore = [
"E501", # Line too long, handled by black
# "B008", # Do not perform function calls in argument defaults
# "C901", # Too complex
"D107", # "Missing docstring in __init__",
]
extend-exclude = [
Expand Down
2 changes: 1 addition & 1 deletion pyproject_pip.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ doc = [

dev = [
"black[d]==23.1.0",
"ruff==0.0.252",
"ruff==0.0.262",
"pre-commit",
"mypy",
# "build", # NOTE: Uncomment if using pip instead of poetry.
Expand Down
2 changes: 1 addition & 1 deletion python_template/scripts/placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ def placeholder_script():

More detail: https://setuptools.pypa.io/en/latest/userguide/entry_point.html
"""
print("This is a placeholder script that can be run as `entry point`")
print("This is a placeholder script that can be run as `entry point`") # noqa: T201