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

Convert to poetry #10

Merged
merged 6 commits into from
Oct 11, 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
30 changes: 14 additions & 16 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
pip install coverage 'coveralls<3.3'
python -m pip install 'poetry'

Choose a reason for hiding this comment

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

Since you were asking about conventions...something I've been thinking about is how to make sure we're using the same version of poetry here, locally and in the Dockerfile. I've been creating a poetry-requirements.txt with poetry>1,<2 and then pip install -r poetry-requirements.txt everywhere so that you don't have to repeat the version. Maybe something to consider for the other repos.

poetry install
- name: Run tests
run: coverage run -m pytest
run: poetry run coverage run -m pytest
- name: Coveralls report
run: coveralls --service=github
run: poetry run coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -43,19 +43,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python -m pip install 'poetry'
- name: Build package and publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_OCS_ARCHIVE_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
poetry build -f wheel
poetry build -f sdist
poetry publish -u "__token__" -p '${{ secrets.PYPI_OBS_PORTAL_API_TOKEN }}'
31 changes: 25 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A base library for the Science Archive and Ingester library to support generaliz

Optional prerequisites may be skipped for reduced functionality.

- Python >= 3.7
- Python >= 3.8

## Usage

Expand Down Expand Up @@ -88,11 +88,30 @@ The library supports three types of file storage by default, that can be selecte

## Development

### Running the Tests
### **Poetry**

After cloning this project, from the project root and inside your virtual environment:
We use Poetry for package management. If you already have Poetry installed, you
can skip this section.

```bash
(venv) $ pip install -e .[tests]
(venv) $ pytest
You can install Poetry using one of the many options listed at https://python-poetry.org/docs/#installation.
One simple option is using Pipx:

python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install poetry

### **Install**

Install the project and its Python dependencies:

poetry install

This will install the project in a Poetry managed virtual environment. To run
commands in that environment either use `poetry run ...` or start a shell in
that environment with `poetry shell`

### **Test**

```
poetry run pytest
```
Loading