Skip to content

Commit 911d5c5

Browse files
authored
Merge pull request #131 from maxsch3/update_versions
Update versions and resolve vulnerabilities
2 parents 2d36fad + 7c36ebb commit 911d5c5

23 files changed

+255
-50
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
8+
9+
jobs:
10+
test-code:
11+
name: "Test code"
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.8", "3.9", "3.10", "3.11"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
- name: Test with pytest
29+
run: |
30+
pip install pytest pytest-cov pytest-dependency
31+
PYTHONPATH="$PYTHONPATH:./keras-batchflow" pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
32+
33+
page_build:
34+
name: "Build and deploy documentation to staging"
35+
needs: test-code
36+
runs-on: ubuntu-latest
37+
environment: github-pages-staging
38+
steps:
39+
- uses: actions/checkout@v4
40+
- name: Set up Python
41+
uses: actions/setup-python@v4
42+
with:
43+
python-version: '3.10'
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install -r requirements.txt
48+
pip install -r build_requirements.txt
49+
pip install -e .
50+
- name: Build docs
51+
run: |
52+
mkdocs build --verbose --clean --strict
53+
- name: Deploy
54+
uses: JamesIves/github-pages-deploy-action@v4
55+
with:
56+
branch: gh-pages # The branch the action should deploy to.
57+
folder: site
58+
repository-name: maxsch3/keras-batchflow-test
59+
ssh-key: ${{ secrets.GH_DEPLOY_SECRET }}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Python package
2+
3+
on:
4+
release:
5+
types: ['published']
6+
7+
8+
jobs:
9+
10+
page_build:
11+
name: "Build documentation"
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.10'
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
python -m pip install --upgrade build
23+
pip install -r requirements.txt
24+
pip install -r build_requirements.txt
25+
pip install -e .
26+
- name: Setup Pages
27+
uses: actions/configure-pages@v4
28+
- name: Build docs
29+
run: |
30+
mkdocs build --verbose --clean --strict
31+
- name: Upload page artifact
32+
uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: ./site
35+
36+
pypi_build:
37+
name: Build pypi package
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
- name: Set up Python
42+
uses: actions/setup-python@v4
43+
with:
44+
python-version: '3.10'
45+
- name: Install dependencies
46+
run: |
47+
python -m pip install --upgrade pip
48+
python -m pip install --upgrade build
49+
pip install -r requirements.txt
50+
pip install -r build_requirements.txt
51+
pip install -e .
52+
- name: Build pypi package
53+
run: |
54+
python -m build
55+
- name: Upload build package as artifact
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: python-package-distributions
59+
path: dist/
60+
61+
deploy_page:
62+
name: 'Deploy release documentation'
63+
needs: [page_build, pypi_build]
64+
65+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
66+
permissions:
67+
pages: write # to deploy to Pages
68+
id-token: write # to verify the deployment originates from an appropriate source
69+
actions: read # to download an artifact uploaded by `actions/upload-pages-artifact@v3`
70+
71+
# Deploy to the github-pages environment
72+
environment:
73+
name: github-pages
74+
url: ${{ steps.deployment.outputs.page_url }}
75+
76+
# Specify runner + deployment step
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Deploy to GitHub Pages
80+
id: deployment
81+
uses: actions/deploy-pages@v4
82+
83+
deploy_pypi:
84+
name: Publish to pypi
85+
needs: [page_build, pypi_build]
86+
runs-on: ubuntu-latest
87+
environment:
88+
name: pypi
89+
url: https://pypi.org/p/keras-batchflow
90+
permissions:
91+
id-token: write
92+
steps:
93+
- name: Download all the dists
94+
uses: actions/download-artifact@v3
95+
with:
96+
name: python-package-distributions
97+
path: dist/
98+
- name: Publish distribution 📦 to PyPI
99+
uses: pypa/gh-action-pypi-publish@release/v1
100+
with:
101+
user: __token__
102+
password: ${{ secrets.PYPI_TOKEN }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
- '!master'
8+
9+
jobs:
10+
test-code:
11+
name: "Test code"
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.8", "3.9", "3.10", "3.11"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
- name: Test with pytest
29+
run: |
30+
pip install pytest pytest-cov pytest-dependency
31+
PYTHONPATH="$PYTHONPATH:./keras-batchflow" pytest tests --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
32+
33+
test-doc-build:
34+
name: "Test documentation build"
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
- name: Set up Python
39+
uses: actions/setup-python@v4
40+
with:
41+
python-version: '3.10'
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install -r requirements.txt
46+
pip install -r build_requirements.txt
47+
pip install -e .
48+
- name: Test doc build
49+
run: |
50+
mkdocs build --verbose --clean --strict

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
language: python
22
python:
3-
# - "2.7"
4-
# - "3.4"
5-
# - "3.5"
6-
- "3.6"
7-
- "3.7"
3+
- "3.8"
4+
- "3.9"
5+
- "3.10"
86
env:
9-
- framework=TF1
7+
# - framework=TF1
108
- framework=TF2
119

1210
script:
@@ -16,7 +14,7 @@ jobs:
1614
include:
1715
- stage: deploy-test
1816
if: branch = master
19-
python: "3.6"
17+
python: "3.10"
2018
script: skip
2119
install:
2220
- pip install -r requirements_tf1.txt
@@ -34,7 +32,7 @@ jobs:
3432
branch: master
3533
- stage: deploy-prod
3634
if: tag IS present
37-
python: "3.6"
35+
python: "3.10"
3836
script: skip
3937
install:
4038
- pip install -r requirements_tf1.txt

build_requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
setuptools-scm==3.5.0
2-
mkdocs==1.1.2
3-
mkdocs-jupyter==0.13.0
4-
notebook==6.1.5
5-
pymdown-extensions==6.3
6-
nbconvert==5.6.1
1+
setuptools-scm
2+
mkdocs
3+
mkdocs-jupyter
4+
notebook
5+
pymdown-extensions
6+
nbconvert
77
git+https://github.com/tomchristie/mkautodoc.git#egg=mkautodoc

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pandas>=2.0.0
2+
scikit-learn
3+
tensorflow-cpu

requirements_tf1.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

requirements_tf2.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
download_url='https://github.com/maxsch3/batchflow',
1818
license='MIT',
1919
setup_requires=['setuptools_scm'],
20-
install_requires=['numpy>=1.9.1',
21-
'scipy>=0.14',
20+
install_requires=['numpy>=1.20.0',
2221
'scikit-learn',
23-
'pandas'],
22+
'pandas>=2.0.0'],
2423
extras_require={
2524
'visualize': ['pydot>=1.2.4'],
2625
'tests': ['pytest',
@@ -33,7 +32,7 @@
3332
'Intended Audience :: Science/Research',
3433
'License :: OSI Approved :: MIT License',
3534
'Programming Language :: Python :: 3',
36-
'Programming Language :: Python :: 3.6',
35+
'Programming Language :: Python :: 3.10',
3736
'Topic :: Software Development :: Libraries',
3837
'Topic :: Software Development :: Libraries :: Python Modules'
3938
],

test/test_base_random_cell_transform.py renamed to tests/test_base_random_cell_transform.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,15 @@ def test_transform(self):
159159

160160
def test_transform_many_cols(self):
161161
ct = LocalVersionTransform([.0, 1.], cols=['var1', 'var2'])
162-
batch = ct.transform(self.df.copy())
162+
# make a bigger batch to make sure augmenatation will always be used on the batch
163+
# when batch is small there is a small chance the batch will sieve through without augmentation due to its
164+
# random nature
165+
seed_df = self.df.sample(100, replace=True)
166+
batch = ct.transform(seed_df.copy())
163167
assert isinstance(batch, pd.DataFrame)
164-
assert batch.shape == self.df.shape
165-
assert not batch.equals(self.df)
166-
batch = self.df.copy()
168+
assert batch.shape == seed_df.shape
169+
assert not batch.equals(seed_df)
170+
batch = seed_df.copy()
167171
batch1 = ct.transform(batch)
168172
# test if transform does in-place transform
169173
assert batch1.equals(batch)

0 commit comments

Comments
 (0)