Skip to content
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

Align versions of Python@3.10.9 and Poetry@1.3.2 #522

Merged
merged 4 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==1.3.2
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.10.9"
cache: "poetry"
- name: Install dependencies
run: poetry install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
run: pipx install poetry==1.3.2
- uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.10.9"
cache: "poetry"
- name: Install dependencies
run: poetry install
Expand Down
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"filename": "docs/developer_setup.md",
"hashed_secret": "afc848c316af1a89d49826c5ae9d00ed769415f3",
"is_verified": false,
"line_number": 203
"line_number": 233
}
],
"tests/unit/test_acoustic_service.py": [
Expand Down Expand Up @@ -203,5 +203,5 @@
}
]
},
"generated_at": "2023-01-26T20:41:38Z"
"generated_at": "2023-01-30T15:11:07Z"
}
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10.6 as python-base
FROM python:3.10.9 as python-base

ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=on \
Expand All @@ -9,14 +9,14 @@ ENV PIP_DEFAULT_TIMEOUT=100 \
PYSETUP_PATH="/opt/pysetup"

RUN python3 -m venv $POETRY_HOME && \
$POETRY_HOME/bin/pip install poetry==1.3.1 && \
$POETRY_HOME/bin/poetry --version
$POETRY_HOME/bin/pip install poetry==1.3.2 && \
$POETRY_HOME/bin/poetry --version

WORKDIR $PYSETUP_PATH
COPY ./poetry.lock ./pyproject.toml ./
RUN $POETRY_HOME/bin/poetry install --no-dev --no-root

FROM python:3.10.6-slim as production
FROM python:3.10.9-slim as production

COPY bin/update_and_install_system_packages.sh /opt
RUN opt/update_and_install_system_packages.sh libpq5
Expand Down
38 changes: 35 additions & 3 deletions docs/developer_setup.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
## Developer Setup
Technologies and tools in use:
- Python: https://www.python.org/
- Poetry: https://python-poetry.org/
- Pre-commit: https://pre-commit.com/
- Docker: https://www.docker.com/
- FastAPI: https://fastapi.tiangolo.com/
- Pydantic: https://pydantic-docs.helpmanual.io/
- SQLAlchemy: https://www.sqlalchemy.org/
- Alembic: https://alembic.sqlalchemy.org
- ...

---
## Python
CTMS is a Python application. We tend to keep the application up to date with
the latest version of Python -- we pin to the patch version throughout the
repository.

To keep your development environment up to date, you may wish to install a
Python version manager to switch Python versions along with the application.
Tools for this include:
- [pyenv](https://github.com/pyenv/pyenv)
- [asdf](https://asdf-vm.com/)

Dependabot will submit pull requests to update the Python version in the
Dockerfile, but will miss other places like `pyproject.toml` and Github Action
workflow files. This `sed`[^1] snippet will find/replace all Python versions in
one go - in this example, from version `A.B.C` to `X.Y.Z`:
```bash
git ls-files | xargs sed -i 's/A\.B\.C/X\.Y\.Z/g'
```

Manually inspect the changes to filter out false positives.
## Poetry

## Installation
### Installation
Install Poetry for osx/linux (please confirm via the [poetry docs](https://python-poetry.org/docs/#installation)):

```sh
curl -sSL https://install.python-poetry.org | python3 -
```

## Setup Dependencies
### Setup Dependencies
To set up dependencies necessary for local development, run:

```sh
Expand Down Expand Up @@ -102,6 +122,16 @@ The command `deactivate` might not work to full disengage the poetry shell as it

[...view poetry site for further documentation and details.](https://python-poetry.org/)

### Keeping Poetry up to date
Poetry is pinned to a specific version in a few places throughout the
repository. This `sed`[^1] snippet will find/replace all of these insances in
one go - in this example, from version `A.B.C` to `X.Y.Z`:
```bash
git ls-files | xargs sed -i 's/A\.B\.C/X\.Y\.Z/g'
```

Manually inspect the changes to filter out false positives.

---
## Pre-commit

Expand Down Expand Up @@ -290,3 +320,5 @@ After you've done the necessary developer setup, try 'make' for some quick first

---
[View All Docs](./)

[^1]: Use [`gnu-sed`](https://formulae.brew.sh/formula/gnu-sed#default) on Mac for command compatability
Loading