Skip to content

Commit

Permalink
build: remove poetry (#294)
Browse files Browse the repository at this point in the history
* build: init stab at removing poetry

* build: fix typo in toml

* build: fix typos in toml

* build: remove poetry from build command

* chore: prune pre-commit
  • Loading branch information
MartinBernstorff authored Feb 7, 2023
1 parent 5cb2e16 commit eb536f7
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 106 deletions.
41 changes: 11 additions & 30 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
name: 'Run tests'
description: 'Run tests'
name: "Run tests"
description: "Run tests"
inputs:
python-version:
description: "Which Python version to run on"
required: true
default: 3.9
poetry-version:
description: "Which version of Poetry to install"
default: 1.1.15
cache-version:
description: "Cache version for invalidation"
default: 0.0.0

runs:
using: "composite"
Expand All @@ -20,32 +14,19 @@ runs:
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

### Caching
- name: Cache poetry and venv
id: cache-poetry-and-venv
uses: MartinBernstorff/cache-poetry-and-venv@latest
with:
poetry-version: ${{ inputs.poetry-version }}
cache-version: ${{ inputs.cache-version }}
python-version: ${{ inputs.python-version }}

# Installing
- name: Install Poetry
if: steps.cache-poetry-and-venv.outputs.poetry-cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: ${{ inputs.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

- name: Install Project
if: steps.cache-poetry-and-venv.outputs.venv-cache-hit != 'true'
shell: bash
run: poetry install -vvv

run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
### Run tests
- name: Run pytest
shell: bash
run: |
poetry run pytest --cov=src --cov-report term-missing --color=yes
set -o pipefail
ls -la
pytest --cov=src --cov-report term-missing --color=yes -n 2
4 changes: 0 additions & 4 deletions .github/workflows/main_test_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ jobs:
test:
runs-on: ${{ matrix.os }}
env:
poetry-version: 1.1.15
cache-version: 0.0.2
python-version: 3.9

strategy:
Expand All @@ -26,8 +24,6 @@ jobs:
uses: ./.github/actions/test
with:
python-version: ${{ env.python-version }}
poetry-version: ${{ env.poetry-version }}
cache-version: ${{ env.cache-version }}

release:
runs-on: ubuntu-latest
Expand Down
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,7 @@ ipython_config.py
# 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
Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
Expand Down Expand Up @@ -158,6 +151,5 @@ pytest-coverage.txt

#other
*test_load_data.py
poetry.lock
*.html
dist*
29 changes: 5 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default_stages: [commit, push]
default_stages: [push]

repos:
- repo: https://github.com/pycqa/isort
Expand All @@ -13,22 +13,10 @@ repos:
hooks:
- id: pyupgrade

- repo: https://github.com/MartinBernstorff/pybetter-without-emojis
rev: 1208357bcc569b86a4a0dc69b108cbe28f190f54
hooks:
- id: pybetter
args: [--select, "B002,B007"]

- repo: https://github.com/bwhmather/ssort
rev: v0.11.6
hooks:
- id: ssort

- repo: https://github.com/myint/docformatter
rev: v1.5.0
hooks:
- id: docformatter
args: [--in-place]
- id: ssort

- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.3
Expand All @@ -40,21 +28,14 @@ repos:
hooks:
- id: black

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: [--config, .flake8]

- repo: https://github.com/pycqa/pylint
rev: v2.15.2
hooks:
- id: pylint
types: [python]
args:
[
args: [
"-rn", # Only display messages
"-sn", # Don't display the score
"--disable=R,import-error" # Refactors are not important enough to block a commit.
# Unused-imports aren't testable by the github action, so don't test that here.
"--disable=R,import-error", # Refactors are not important enough to block a commit.
]
# Unused-imports aren't testable by the github action, so don't test that here.
81 changes: 42 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[tool.poetry]
[project]
name = "psycopmlutils"
version = "0.3.1"
description = "A collection of machine-learning utilities used across the psycop-projects."
authors = ["Martin Bernstorff <[email protected]>"]
authors = [{name = "Martin Bernstorff", email = "[email protected]"},
{name = "Lasse Hansen", email = "[email protected]"},
{name = "Kenneth Enevoldsen"}]

requires-python = ">=3.8.0"

classifiers = [
"Environment :: Console",
"Intended Audience :: Developers",
Expand All @@ -15,41 +20,39 @@ classifiers = [
"Programming Language :: Python :: 3.9",
]

[tool.poetry.dependencies]
# Manually specify catalogue dependencies
pydantic = ">=1.9.0"

# Other dependencies
python = ">=3.9,<3.11"
numpy = ">=1.23.3,<1.25.0"
scipy = ">=1.8.1,<1.10.0"
pandas = ">=1.4.4,<1.6.0"
catalogue = ">=2.0.8, <2.1.0"
wasabi = ">=0.9.0,<1.2.0"
scikit-learn = ">=1.1.2,<1.3.0"
srsly = ">=2.4.4, <2.5.0"
wandb = ">=0.12.7,<0.13.8"
psutil = ">=5.9.1, <6.0.0"
dill = ">=0.3.5,<0.3.7"
SQLAlchemy = ">=1.4.40,<1.4.46"
pyodbc = ">=4.0.34, <=4.1.0"
transformers = ">=4.22.0,<4.26.0"

[tool.poetry.dev-dependencies]
black = "22.12.*"
pytest = "7.2.*"
pytest-cov = "4.0.*"
Sphinx = "5.3.*"
furo = ">=2022.6.4,<2022.12.8"
sphinx-copybutton = "0.5.*"
sphinxext-opengraph = "0.7.*"
myst-parser = "0.18.*"
flake8 = "6.0.*"
docformatter = ">=1.4.0,<1.5.2"
mypy = ">=0.971,<0.992"
pytest-xdist = "^3.0.2"
pre-commit = ">=2.20.0,<2.22.0"
dependencies = [
"pydantic>=1.9.0",
"numpy>=1.23.3,<1.25.0",
"scipy>=1.8.1,<1.10.0",
"pandas>=1.4.4,<1.6.0",
"catalogue>=2.0.8, <2.1.0",
"wasabi>=0.9.0,<1.2.0",
"scikit-learn>=1.1.2,<1.3.0",
"srsly>=2.4.4, <2.5.0",
"wandb>=0.12.7,<0.13.8",
"psutil>=5.9.1, <6.0.0",
"dill>=0.3.5,<0.3.7",
"SQLAlchemy>=1.4.40,<1.4.46",
"pyodbc>=4.0.34, <=4.1.0",
"transformers>=4.22.0,<4.26.0",
]

[project.optional-dependencies]
dev = [
"black>=22.12.0",
"pytest>=7.2.0",
"pytest-cov>=4.0.0",
"Sphinx>=5.3.0",
"furo>=2022.6.4,<2022.12.8",
"sphinx-copybutton>=0.5.0",
"sphinxext-opengraph>=0.7.0",
"myst-parser>=0.18.0",
"flake8>=6.0.0",
"docformatter>=1.4.0,<1.5.2",
"mypy>=0.971,<0.992",
"pytest-xdist>=3.0.2",
"pre-commit>=2.20.0,<2.22.0",
]

[tool.coverage.run]
omit = [
Expand All @@ -59,8 +62,8 @@ omit = [
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["setuptools>=61.0.0", "wheel", "setuptools_scm"]
build-backend = "setuptools.build_meta"

[tool.isort]
known_third_party = ["wandb"]
Expand All @@ -72,7 +75,7 @@ version_variable = [
]
upload_to_pypi = true
upload_to_release = true
build_command = "pip install poetry && poetry build"
build_command = "python -m pip install build; python -m build"

[tool.pylint]
load-plugins = "pylint.extensions.docparams,pylint.extensions.code_style,pylint.extensions.for_any_all,pylint.extensions.typing"
Expand Down

0 comments on commit eb536f7

Please sign in to comment.