Skip to content

Commit 84b9f59

Browse files
committed
Merge branch 'remove-older-python-versions-#517' into remove-database-backend-#489
2 parents e280471 + a069cec commit 84b9f59

3 files changed

Lines changed: 13 additions & 86 deletions

File tree

.github/workflows/ci-build.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ jobs:
1010
runs-on: ubuntu-24.04
1111
strategy:
1212
fail-fast: false
13-
matrix:
14-
python-version: ["3.10"]
15-
name: Python ${{ matrix.python-version }} Build & Tests
13+
name: Build & Tests
1614
steps:
1715
- name: Add apt repo
1816
run: sudo add-apt-repository universe
@@ -26,7 +24,7 @@ jobs:
2624
- name: Setup Python
2725
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
2826
with:
29-
python-version: ${{ matrix.python-version }}
27+
python-version: "3.10"
3028
architecture: x64
3129

3230
- name: Checkout DataGateway API
@@ -58,7 +56,7 @@ jobs:
5856

5957
# Run Unit tests
6058
- name: Run Nox unit tests session
61-
run: nox -p ${{ matrix.python-version }} -s unit_tests -- --cov=datagateway_api --cov-report=xml
59+
run: nox -s unit_tests -- --cov=datagateway_api --cov-report=xml
6260

6361
# ICAT Ansible clone and install dependencies
6462
- name: Checkout icat-ansible
@@ -136,7 +134,7 @@ jobs:
136134
# Run Nox integration tests session, saves and uploads a coverage report to codecov
137135
- name: Run Nox Integration tests session
138136
if: success()
139-
run: nox -p ${{ matrix.python-version }} -s integration_tests -- --cov=datagateway_api --cov-report=xml
137+
run: nox -s integration_tests -- --cov=datagateway_api --cov-report=xml
140138

141139
linting:
142140
runs-on: ubuntu-24.04
@@ -350,9 +348,7 @@ jobs:
350348
runs-on: ubuntu-24.04
351349
strategy:
352350
fail-fast: false
353-
matrix:
354-
python-version: ["3.10"]
355-
name: Pip Install ${{ matrix.python-version }} Test
351+
name: Pip Install Test
356352
steps:
357353
# Checkout DataGateway API and setup Python
358354
- name: Check out repo
@@ -361,7 +357,7 @@ jobs:
361357
- name: Setup Python
362358
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
363359
with:
364-
python-version: ${{ matrix.python-version }}
360+
python-version: "3.10"
365361
architecture: x64
366362
- name: Setup Java
367363
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0

README.md

Lines changed: 6 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -26,62 +26,6 @@ guide found online. It is assumed the commands shown in this part of the README
2626
executed in the root directory of this repo once it has been cloned to your local
2727
machine.
2828

29-
## Python Version Management (pyenv)
30-
31-
To start, install [pyenv](https://github.com/pyenv/pyenv). There is a Windows version of
32-
this tool ([pyenv-win](https://github.com/pyenv-win/pyenv-win)), however this is
33-
currently untested on this repo. This is used to manage the various versions of Python
34-
that will be used to test/lint Python during development. Install by executing the
35-
following:
36-
37-
```bash
38-
curl https://pyenv.run | bash
39-
```
40-
41-
The following lines need to be added to `~/.bashrc` - either open a new terminal or
42-
execute `source ~/.bashrc` to make these changes apply:
43-
44-
```bash
45-
export PATH="~/.pyenv/bin:$PATH"
46-
eval "$(pyenv init -)"
47-
eval "$(pyenv virtualenv-init -)"
48-
```
49-
50-
Various Python build dependencies need to be installed next. These will vary dependent
51-
on the platform of your system (see the
52-
[common pyenv build problems](https://github.com/pyenv/pyenv/wiki/Common-build-problems)
53-
for the relevant command for your OS), but the following shows the bash command to
54-
install the requirements for a CentOS/RHEL machine:
55-
56-
```bash
57-
sudo yum install @development zlib-devel bzip2 bzip2-devel readline-devel sqlite \
58-
sqlite-devel openssl-devel xz xz-devel libffi-devel findutils
59-
```
60-
61-
To make use of `pyenv`, let's install different versions of Python onto the system. In
62-
production, DataGateway API uses Python 3.10, so this should definitely be part a
63-
development environment for this repo. This stage might take some time as each Python
64-
version needs to be downloaded and built individually:
65-
66-
```bash
67-
pyenv install 3.10.0
68-
```
69-
70-
To verify the installation commands worked:
71-
72-
```bash
73-
python3.10 --version
74-
```
75-
76-
These Python versions need to be made available to local version of the repository. They
77-
will used during the Nox sessions, explained further down this file. Executing the
78-
following command will create a `.python-version` file inside the repo (this file is
79-
currently listed in `.gitignore`):
80-
81-
```bash
82-
pyenv local 3.10.0
83-
```
84-
8529
## API Dependency Management (Poetry)
8630

8731
To maintain records of the API's dependencies,
@@ -218,27 +162,14 @@ As a summary, these are the steps needed to create a dev environment for this re
218162
compressed into a single code block:
219163

220164
```bash
221-
# Install pyenv
222-
curl https://pyenv.run | bash
223-
224-
# Paste into ~/.bashrc
225-
export PATH="~/.pyenv/bin:$PATH"
226-
eval "$(pyenv init -)"
227-
eval "$(pyenv virtualenv-init -)"
228-
229-
# Apply changes made in ~/.bashrc
230-
source ~/.bashrc
231-
232-
# Install Python build tools
233-
sudo yum install @development zlib-devel bzip2 bzip2-devel readline-devel sqlite \
234-
sqlite-devel openssl-devel xz xz-devel libffi-devel findutils
165+
# Install Python 3.10
235166

236-
# Install different versions of Python and verify they work
237-
pyenv install 3.10.0
238-
python3.10 --version
167+
# Download and install Python 3.10 from the official Python website or use your system’s package manager (e.g., apt for Linux, Homebrew for macOS, or the installer for Windows).
168+
# Make sure Python is added to your system PATH.
169+
# Verify the installation by checking the version.
239170

240-
# Make installed Python versions available to repo
241-
pyenv local 3.10.0
171+
# To verify the installation commands worked:
172+
python3 --version
242173

243174
# Install Poetry
244175
curl -sSL https://install.python-poetry.org | python3 -

datagateway_api/src/common/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def map_distinct_attributes_to_results(distinct_attributes, query_result):
186186
returned to the user
187187
"""
188188
result_dict = {}
189-
for attr_name, data in zip(distinct_attributes, query_result, strict=False):
189+
for attr_name, data in zip(distinct_attributes, query_result, strict=True):
190190
# Splitting attribute names in case it's from a related entity
191191
split_attr_name = attr_name.split(".")
192192

0 commit comments

Comments
 (0)