Skip to content

build+ci: make local, gh, and Jenkins envs identical #2019

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

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
6 changes: 1 addition & 5 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: ${{ steps.changes.outputs.utils == 'true' }}
run: git tag delphi-utils/v${{ steps.utils.outputs.version }}
- name: Publish tags
run: git push --tags
run: git push --tags
outputs:
indicators-version: ${{ steps.indicators.outputs.version }}
utils-version: ${{ steps.utils.outputs.version }}
Expand All @@ -76,10 +76,6 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install testing dependencies
run: |
python -m pip install --upgrade pip
pip install pylint pytest pydocstyle wheel twine
- name: Install
run: |
make install
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ jobs:
with:
python-version: 3.8
cache: "pip"
cache-dependency-path: "setup.py"
- name: Install testing dependencies
run: |
python -m pip install --upgrade pip
pip install pylint pytest pydocstyle wheel
cache-dependency-path: "pyproject.toml"
- name: Install
run: |
make install-ci
Expand Down
2 changes: 1 addition & 1 deletion _delphi_utils_python/.bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ commit = True
message = chore: bump delphi_utils to {new_version}
tag = False

[bumpversion:file:setup.py]
[bumpversion:file:pyproject.toml]

[bumpversion:file:delphi_utils/__init__.py]
2 changes: 1 addition & 1 deletion _delphi_utils_python/DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To install the module in your default version of Python, run the
following from this directory:

```
pip install .
pip install -e '.[dev]'
```

As described in each of the indicator code directories, you will want to install
Expand Down
12 changes: 6 additions & 6 deletions _delphi_utils_python/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
.PHONY = venv, lint, test, clean, release

venv:
python3.8 -m venv env
python3.8 -m venv env; \
. env/bin/activate; \
python -m pip install pip==23.0.1

install: venv
. env/bin/activate; \
pip install wheel ; \
pip install -e .
pip install -e '.[dev]'

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install .
pip install '.[dev]'

lint:
. env/bin/activate; pylint delphi_utils --rcfile=../pyproject.toml
Expand All @@ -30,4 +30,4 @@ clean:

release: lint test
. env/bin/activate ; \
python setup.py sdist bdist_wheel
python -m build --sdist --wheel
59 changes: 59 additions & 0 deletions _delphi_utils_python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[build-system]
requires = ["setuptools>=70.1", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

[project]
name = "delphi-utils"
version = "0.3.24"
description = "Shared Utility Functions for Indicators"
readme = "README.md"
requires-python = "== 3.8.*"
license = { text = "MIT License" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.8",
"License :: MIT",
]
dependencies = [
"boto3",
"covidcast",
"cvxpy",
"epiweeks",
"gitpython",
"importlib_resources>=1.3",
"numpy",
"pandas>=1.1.0",
"requests",
"slackclient",
"scs<3.2.6", # TODO: remove this ; it is a cvxpy dependency, and the excluded version appears to break our jenkins build. see: https://github.com/cvxgrp/scs/issues/283
"structlog",
"xlrd", # needed by Pandas to read Excel files
]

[project.urls]
Homepage = "https://github.com/cmu-delphi/covidcast-indicators"

[project.optional-dependencies]
dev = [
"build[virtualenv]",
"darker[isort]~=2.1.1",
"pylint==2.8.3",
"pytest",
"pydocstyle",
"pytest-cov",
"mock",
"moto~=4.2.14",
"requests-mock",
"freezegun",
"twine"
]
flash = ["scipy"]

[tool.setuptools.packages.find]
where = ["."]
include = ["delphi_utils"]
namespaces = true

[tool.setuptools.package-data]
"delphi_utils.data" = ["20*/*.csv"]
48 changes: 0 additions & 48 deletions _delphi_utils_python/setup.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should keep this... I know previously we wanted to convert all the setup.py into pyproject.toml, but I rememeber the release where we converted delphi_utils setup.py into pyproject.toml has some hiccups....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some issues using the pyproject.toml for nhsn and ended up just using the setup.py. since this codebase will be replaced, I think it's better to keep setup.py and have it consistent with the other indicators

This file was deleted.

6 changes: 3 additions & 3 deletions _template_python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env
python3.8 -m venv env; \
. env/bin/activate; \
python -m pip install pip==23.0.1

install: venv
. env/bin/activate; \
pip install wheel ; \
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

Expand Down
42 changes: 42 additions & 0 deletions _template_python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[build-system]
requires = ["setuptools", "setuptools-scm>=8.0"]
build-backend = "setuptools.build_meta"

[project]
name = "delphi_NAME"
version = "0.1.0"
description = "SHORT DESCRIPTION"
readme = "README.md"
requires-python = "== 3.8.*"
license = { text = "MIT License" }
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.8",
"License :: MIT",
Copy link
Contributor

@aysim319 aysim319 Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to change this to "License :: OSI Approved :: MIT License"; fixing the merge conflict should fix this

]
dependencies = [
"delphi-utils",
"numpy",
"pandas>=1.1.0",
]

[project.urls]
Homepage = "https://github.com/cmu-delphi/covidcast-indicators"

[project.optional-dependencies]
dev = [
"darker[isort]~=2.1.1",
"pylint==2.8.3",
"pytest",
"pydocstyle",
"pytest-cov",
"mock",
"moto~=4.2.14",
"requests-mock",
"freezegun",
]

[tool.setuptools.packages.find]
where = ["."]
namespaces = true
30 changes: 0 additions & 30 deletions _template_python/setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion backfill_corrections/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ install-python:
fi
python3 -m venv env
source env/bin/activate && \
python -m pip install --upgrade pip && \
python -m pip install pip==23.0.1 && \
pip install wheel && \
pip install --timeout 1000 delphi_utils

Expand Down
6 changes: 3 additions & 3 deletions changehc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env
python3.8 -m venv env; \
. env/bin/activate; \
python -m pip install pip==23.0.1

install: venv
. env/bin/activate; \
pip install wheel ; \
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

Expand Down
1 change: 1 addition & 0 deletions changehc/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"covidcast",
"darker[isort]~=2.1.1",
"delphi-utils",
"mock",
"moto~=4.2.14",
"numpy",
"pandas",
Expand Down
6 changes: 3 additions & 3 deletions claims_hosp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env
python3.8 -m venv env; \
. env/bin/activate; \
python -m pip install pip==23.0.1

install: venv
. env/bin/activate; \
pip install wheel ; \
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

Expand Down
1 change: 1 addition & 0 deletions claims_hosp/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"darker[isort]~=2.1.1",
"delphi-utils",
"numpy",
"pydocstyle",
"pandas",
"paramiko",
"pyarrow",
Expand Down
6 changes: 3 additions & 3 deletions doctor_visits/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env
python3.8 -m venv env; \
. env/bin/activate; \
python -m pip install pip==23.0.1

install: venv
. env/bin/activate; \
pip install wheel ; \
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

Expand Down
1 change: 1 addition & 0 deletions doctor_visits/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"darker[isort]~=2.1.1",
"delphi-utils",
"numpy",
"pydocstyle",
"pandas",
"paramiko",
"pylint==2.8.3",
Expand Down
6 changes: 3 additions & 3 deletions google_symptoms/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

dir = $(shell find ./delphi_* -name __init__.py | grep -o 'delphi_[_[:alnum:]]*' | head -1)
venv:
python3.8 -m venv env
python3.8 -m venv env; \
. env/bin/activate; \
python -m pip install pip==23.0.1

install: venv
. env/bin/activate; \
pip install wheel ; \
pip install -e ../_delphi_utils_python ;\
pip install -e .

install-ci: venv
. env/bin/activate; \
pip install wheel ; \
pip install ../_delphi_utils_python ;\
pip install .

Expand Down
Loading
Loading