Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python312 #89

Merged
merged 15 commits into from
Aug 20, 2024
9 changes: 5 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
branches: [main]
schedule:
- cron: "41 21 * * 1"
workflow_dispatch:

jobs:
analyze:
Expand All @@ -39,11 +40,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -54,7 +55,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -68,4 +69,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v3
11 changes: 8 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,31 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
environment:
name: pypi
url: "https://pypi.org/p/cfgenvy"
permissions:
id-token: write

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: build
run: |
docker compose run build-wheel

- name: pre-release
if: ${{ github.event.release.prerelease }}
uses: pypa/gh-action-pypi-publish@v1.5.0
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: release
if: ${{ !github.event.release.prerelease }}
uses: pypa/gh-action-pypi-publish@v1.5.0
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ on:
push:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
target: ["3.9", "3.10"]
target: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: build
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ sdist
.venv
venv
.py39
.py310
.py311
.py312

# mac
.DS_Store
Expand Down
30 changes: 15 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py39-plus]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: [--profile, black]
types: [python]

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.8.0
hooks:
- id: black
args: [--target-version=py37]
args: [-t, py39, -t, py310, -t, py311]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -41,47 +41,47 @@ repos:
- id: python-use-type-annotations

- repo: https://github.com/pycqa/pylint
rev: v2.16.0
rev: v3.2.6
hooks:
- id: pylint
language: system
types: [python]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.1.1
hooks:
- id: flake8
language: system
types: [python]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
rev: v1.11.1
hooks:
- id: mypy
language: system
types: [python]

- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
args:
- "--extra-keys=cell.metadata.pycharm"

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.5.3
rev: 1.8.7
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==3.3.1]
additional_dependencies: [pyupgrade==3.17.0]
args: [--py39-plus]
- id: nbqa-isort
additional_dependencies: [isort==5.12.0]
additional_dependencies: [isort==5.13.2]
args: [--float-to-top]
- id: nbqa-black
additional_dependencies: [black==23.1.0]
args: [--target-version=py39]
additional_dependencies: [black==24.8.0]
args: [-t=py39, -t=py310, -t=py311]
- id: nbqa-flake8
additional_dependencies: [flake8==6.0.0]
additional_dependencies: [flake8==7.1.1]

- repo: local
hooks:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
build-wheel:
volumes:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

volumes:
postgres_data:

Expand Down
14 changes: 7 additions & 7 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG PYTHON_VERSION="3.10"
ARG PYTHON_VERSION="3.12"
ARG ROOT_CONTAINER=python:${PYTHON_VERSION}-slim-bullseye


FROM ${ROOT_CONTAINER} as binaries
FROM ${ROOT_CONTAINER} AS binaries
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
USER root
WORKDIR /tmp
Expand All @@ -26,25 +26,25 @@ RUN \
ENTRYPOINT ["/usr/bin/tini", "-g", "--"]


FROM binaries as source
FROM binaries AS source
COPY . .


FROM source as pre-commit
FROM source AS pre-commit
RUN \
pip install ".[dev]"
CMD pre-commit run --all-files


FROM source as test
FROM source AS test
RUN \
pip install ".[dev]"
CMD pytest


FROM source as build-wheel
FROM source AS build-wheel
CMD pip wheel --no-deps -w ./dist .


FROM binaries as install-wheel
FROM binaries AS install-wheel
CMD pip install --find-links=./dist dsdk[dev]
18 changes: 1 addition & 17 deletions postgres/dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
ARG ROOT_CONTAINER=timescale/timescaledb:2.7.2-pg14-oss
ARG PGTAP_VERSION=1.2.0

FROM ${ROOT_CONTAINER} as build
ARG PGTAP_VERSION
WORKDIR /tmp
ADD https://github.com/theory/pgtap/releases/download/v${PGTAP_VERSION}/pgTAP-${PGTAP_VERSION}.zip .
RUN \
apk -U add \
alpine-sdk \
perl \
&& unzip pgTAP-${PGTAP_VERSION}.zip \
&& cd pgTAP-${PGTAP_VERSION} \
&& make \
&& make install


FROM ${ROOT_CONTAINER} as postgres
COPY --from=build /usr/local/share/postgresql/extension/pgtap* /usr/local/share/postgresql/extension/
FROM ${ROOT_CONTAINER} AS postgres
LABEL name=postgres
COPY ./docker-entrypoint.sh /usr/local/bin/
COPY ./sql/initdb.d/*.sql /docker-entrypoint-initdb.d/
Expand Down
31 changes: 16 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ classifiers = [
"Operating System :: POSIX",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Utilities",
]
dependencies = [
"blosc==1.10.6",
"cfgenvy>=2.0.0",
"blosc>=1.10.6",
"cfgenvy>=2.2.2",
"numpy>=1.15.4",
"pandas>=0.23.4",
"requests>=2.26.0",
"urllib3<2; python_version < '3.10'",
"urllib3>=2; python_version >= '3.10'",
]
description = "An opinionated library to help deploy data science projects"
dynamic = ["version"]
Expand All @@ -46,7 +50,7 @@ dev = [
"astroid",
"black",
"coverage[toml]",
"cython>=0.29.21",
"cython>=3.0.11",
"flake8",
"flake8-bugbear",
"flake8-commas",
Expand All @@ -59,12 +63,11 @@ dev = [
"mypy",
"pep8-naming",
"pre-commit",
"psycopg2-binary>=2.8.6",
"psycopg2-binary>=2.9.9",
"pylint",
"pymssql>=2.2.3",
"pymssql>=2.3.0",
"pytest",
"pytest-cov",
"types-pkg-resources",
"types-pymssql",
"types-python-dateutil",
"types-pymssql",
Expand All @@ -73,11 +76,11 @@ dev = [
"vcrpy",
]
pymssql = [
"cython>=0.29.21",
"pymssql>=2.2.3",
"cython>=3.0.11",
"pymssql>=2.3.0",
]
psycopg2 = [
"psycopg2-binary>=2.8.6",
"psycopg2-binary>=2.9.9",
]

[project.urls]
Expand All @@ -87,7 +90,7 @@ Tracker = "https://github.com/pennsignals/dsdk/issues"

[tool.black]
line-length = 79
target-version = ["py39","py310"]
target-version = ["py39","py310","py311"]

[tool.coverage.report]
exclude_lines = [
Expand All @@ -104,7 +107,7 @@ branch = true
parallel = true

[tool.distutils.bdist_wheel]
python-tag = "py39.py310"
python-tag = "py39.py310.py311.py312"

[tool.isort]
profile = "black"
Expand All @@ -118,14 +121,12 @@ default_section = "THIRDPARTY"
follow_imports = "normal"
ignore_missing_imports = false


[tool.pylint.basic]
good-names = '''a,b,c,d,df,do_POST,e,i,id,logger,n,on,ok,tz'''

[tool.pylint.message_control]
disable = '''duplicate-code'''
extension-pkg-allow-list = [
"pymssql._mssql",
]
disable = '''duplicate-code,contextmanager-generator-missing-cleanup'''

[tool.pylint.miscellaneous]
notes = '''FIXME,XXX'''
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Setup virtual environment:

Or setup homebrew virtual environment:

brew install python@3.10
/opt/homebrew/Cellar/python@3.10/.../Frameworks/Python.framework/Versions/Current/bin/python@3.10 -m venv .venv
brew install python@3.12
python3.12 -m venv .venv

Once virtual environment is setup:

Expand Down
4 changes: 3 additions & 1 deletion src/dsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .postgres import Mixin as PostgresMixin
from .postgres import Persistor as Postgres
from .postgres import PredictionMixin as PostgresPredictionMixin
from .service import Batch, CompositeTask, Delegate, Service, Task
from .service import Batch, CompositeTask, Delegate, Service, Task, __version__
from .utils import (
chunks,
configure_logger,
Expand All @@ -25,6 +25,7 @@
)

__all__ = (
"__version__",
"Asset",
"Batch",
"CompositeTask",
Expand All @@ -51,4 +52,5 @@
"profile",
"now_utc_datetime",
"retry",
"__version__",
)
Loading