Skip to content

Commit 82944e4

Browse files
authored
Switched to uv for build and fixed issues (#259)
* switched dev build to uv * Removed no longer supported python 2 support for LazyStr * Fixed unit tests by adding now required report_lineage to MockFileSystem * linting: remove obsolete rule exclusions * linting: ignore most new pylint rules * linting: exception used before being defined * Removed no longer needed setup.py * Removed usage of backports-csv to reduce warnings * Removed usage of backports-tempfile to reduce warnings * Removed no longer used requirements txt files * exclude docker directory from setuptools packages * Added dummy GitHub Actions config * Added build steps * Added set_tags step * Build package * Fixed missing quote * Added configuration to push to test pypi and pypi * Temporarily enable pushing to test pypi for PRs * Revert "Temporarily enable pushing to test pypi for PRs" This reverts commit 14de5eb. * Removed no longer used Dockerfile * Removed docker build * Removed no longer needed scripts * Removed no longer used travis config * Removed dependabot config
1 parent b8cf50f commit 82944e4

34 files changed

Lines changed: 5675 additions & 368 deletions

.github/dependabot.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: CI Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
build-and-test:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set tags
23+
id: set_tags
24+
run: |
25+
VERSION=""
26+
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
27+
if [[ $GITHUB_REF == refs/tags/v* ]]; then
28+
VERSION=${GITHUB_REF#refs/tags/v}
29+
fi
30+
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
31+
PYTHON_PACKAGE_VERSION="${VERSION}"
32+
else
33+
PYTHON_PACKAGE_VERSION=`./scripts/dev/get-test-pypi-version.sh ${GITHUB_SHA}`
34+
fi
35+
echo "PYTHON_PACKAGE_VERSION=${PYTHON_PACKAGE_VERSION}"
36+
echo "python_package_version=${PYTHON_PACKAGE_VERSION}" >> $GITHUB_OUTPUT
37+
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v7
40+
41+
- name: "Set up Python"
42+
uses: actions/setup-python@v6
43+
with:
44+
python-version-file: ".python-version"
45+
46+
- name: Install dependencies
47+
run: make dev-install
48+
49+
- name: Linting
50+
run: make dev-lint
51+
52+
- name: Unit tests
53+
run: make dev-pytest
54+
55+
- name: Show determined Python package version
56+
run: echo "${{ steps.set_tags.outputs.python_package_version }}"
57+
58+
- name: Set version
59+
run: uv version "${{ steps.set_tags.outputs.python_package_version }}"
60+
61+
- name: Build dist
62+
run: uv build
63+
64+
- name: Upload artifacts
65+
uses: actions/upload-artifact@v6
66+
with:
67+
name: python-package-distributions
68+
path: dist/
69+
70+
testpypi-publish:
71+
if: github.ref == 'refs/heads/main'
72+
needs: ["build-and-test"]
73+
name: Upload release to Test PyPI
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Download dists
78+
uses: actions/download-artifact@v6
79+
with:
80+
name: python-package-distributions
81+
path: dist/
82+
83+
- name: Publish package distributions to Test PyPI
84+
uses: pypa/gh-action-pypi-publish@release/v1
85+
with:
86+
repository-url: https://test.pypi.org/legacy/
87+
verbose: true
88+
password: ${{ secrets.TEST_PYPI_CREDENTIALS }}
89+
90+
pypi-publish:
91+
if: startsWith(github.ref, 'refs/tags')
92+
needs: ["build-and-test"]
93+
name: Upload release to PyPI
94+
runs-on: ubuntu-latest
95+
96+
steps:
97+
- name: Download dists
98+
uses: actions/download-artifact@v6
99+
with:
100+
name: python-package-distributions
101+
path: dist/
102+
103+
- name: Publish package distributions to PyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1
105+
with:
106+
password: ${{ secrets.PYPI_CREDENTIALS }}

.pylintrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ disable=
33
missing-docstring,
44
consider-using-f-string,
55
invalid-name,
6-
no-self-use,
76
too-few-public-methods,
8-
bad-continuation,
9-
super-with-arguments
7+
too-many-positional-arguments,
8+
super-with-arguments,
9+
broad-exception-raised,
10+
unnecessary-dunder-call,
11+
use-dict-literal,
12+
use-implicit-booleaness-not-comparison
1013

1114
[TYPECHECK]
1215
ignored-classes=scoped_session

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.10

.travis.yml

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

Dockerfile

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

Jenkinsfile

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

Makefile

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ DOCKER_COMPOSE_DEV = docker-compose
22
DOCKER_COMPOSE_CI = docker-compose -f docker-compose.yml -f docker-compose.ci.yml
33
DOCKER_COMPOSE = $(DOCKER_COMPOSE_DEV)
44

5-
VENV = venv
6-
PIP = $(VENV)/bin/pip
5+
VENV = .venv
6+
UV = VIRTUAL_ENV=$(VENV) uv
7+
UV_PIP = $(UV) pip
78
PYTHON = $(VENV)/bin/python
89

910
RUN = $(DOCKER_COMPOSE) run --rm sciencebeam-utils
@@ -20,25 +21,22 @@ venv-clean:
2021

2122

2223
venv-create:
23-
python3 -m venv $(VENV)
24+
$(UV) venv $(VENV)
2425

2526

2627
dev-install:
27-
$(PIP) install -r requirements.build.txt
28-
$(PIP) install -r requirements.txt
29-
$(PIP) install -r requirements.prereq.txt
30-
$(PIP) install -r requirements.dev.txt
28+
$(UV) sync --all-extras
3129

3230

3331
dev-venv: venv-create dev-install
3432

3533

3634
dev-flake8:
37-
$(PYTHON) -m flake8 sciencebeam_utils tests setup.py
35+
$(PYTHON) -m flake8 sciencebeam_utils tests
3836

3937

4038
dev-pylint:
41-
$(PYTHON) -m pylint sciencebeam_utils tests setup.py
39+
$(PYTHON) -m pylint sciencebeam_utils tests
4240

4341

4442
dev-lint: dev-flake8 dev-pylint
@@ -57,43 +55,3 @@ dev-watch-slow:
5755

5856

5957
dev-test: dev-lint dev-pytest
60-
61-
62-
build:
63-
if [ "$(NO_BUILD)" != "y" ]; then \
64-
$(DOCKER_COMPOSE) build sciencebeam-utils; \
65-
fi
66-
67-
68-
delete-pyc:
69-
find ./sciencebeam_utils/ -name '*.pyc' -delete
70-
71-
72-
test: build
73-
$(RUN) ./project_tests.sh
74-
75-
76-
watch: build delete-pyc
77-
$(RUN) pytest-watch -- $(PYTEST_ARGS)
78-
79-
80-
ci-build:
81-
make DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" build
82-
83-
84-
ci-test:
85-
make DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" test
86-
87-
88-
ci-push-testpypi:
89-
$(DOCKER_COMPOSE_CI) run --rm \
90-
-v $$PWD/.pypirc:/root/.pypirc \
91-
sciencebeam-utils \
92-
./docker/push-testpypi-commit-version.sh "$(COMMIT)"
93-
94-
95-
ci-push-pypi:
96-
$(DOCKER_COMPOSE_CI) run --rm \
97-
-v $$PWD/.pypirc:/root/.pypirc \
98-
sciencebeam-utils \
99-
./docker/push-pypi-version.sh "$(VERSION)"

docker-compose.ci.yml

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

docker-compose.override.yml

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

0 commit comments

Comments
 (0)