Skip to content

Commit

Permalink
Merge branch 'main' into improve-asset-roles-desc
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault authored Nov 13, 2024
2 parents f70b450 + 70b0af5 commit 25d0ee4
Show file tree
Hide file tree
Showing 23 changed files with 1,573 additions and 2,066 deletions.
39 changes: 0 additions & 39 deletions .dockerignore

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: "3.10"
- name: Install poetry
run: make poetry-install
- name: Install uv
run: make setup
- name: Publish stac-model to PyPI
run: |
poetry build
poetry publish --username __token__ --password ${{ secrets.PYPI_SECRET }}
uv build
uv publish --username __token__ --password ${{ secrets.PYPI_SECRET }}
10 changes: 5 additions & 5 deletions .github/workflows/stac-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
run: make poetry-install
- name: Install uv
run: make setup

- name: Set up cache
uses: actions/cache@v4.0.2
uses: actions/cache@v4.1.2
with:
path: .venv
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('poetry.lock') }}
key: venv-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('uv.lock') }}
- name: Install dependencies
run: make install-dev

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ jobs:
- uses: actions/checkout@v4
- run: |
npm install
npm list
npm test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
requirements*.txt

### ArchLinuxPackages ###
*.tar
*.tar.*
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
default_language_version:
python: python3.10
python: python3

default_stages: [commit, push]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down
21 changes: 12 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@

## Project setup

1. If you don't have `Poetry` installed run:
1. If you don't have `uv` installed run:

```bash
make poetry-install
make setup
```

> This installs Poetry as a [standalone application][poetry-install]. <br>
> For more details, see also the [Poetry Documentation][poetry-docs]. <br>
> If you prefer, you can simply install it inside your virtual environment.
> This installs `uv` as a [standalone application][uv-install]. <br>
> For more details, see also the [`uv` documentation][uv-docs]. <br>
2. Initialize project dependencies with poetry and install `pre-commit` hooks:
2. Initialize project dependencies with `uv` and install `pre-commit` hooks:

```bash
make install-dev
make pre-commit-install
```

This will install project dependencies into the currently active environment. If you would like to
use uv's default behavior of managing a project-scoped environment, use `uv` commands directly to
install dependencies. `uv sync` will install dependencies and dev dependencies in `.venv` and update the `uv.lock`.

## PR submission

Before submitting your code please do the following steps:
Expand Down Expand Up @@ -85,7 +88,7 @@ git push -u origin your-branch
### Building a new version of `stac-model`

- Apply any relevant changes and `CHANGELOG.md` entries in a PR that modifies `stac-model`.
- Bump the version with `poetry version <version>`.
- Bump the version with `bumpversion bump <version>`.
- You can pass the new version explicitly, or a rule such as `major`, `minor`, or `patch`. <br>
For more details, refer to the [Semantic Versions][semver] standard;
- Once CI validation succeeded, merge the corresponding PR branch.
Expand All @@ -110,6 +113,6 @@ You can also share how the ML Model extension does or does
not serve your needs with us in the GitHub Discussions or raise
Issues for bugs.

[poetry-install]: https://github.com/python-poetry/install.python-poetry.org
[poetry-docs]: https://python-poetry.org/docs/
[uv-install]: https://docs.astral.sh/uv/getting-started/installation/
[uv-docs]: https://docs.astral.sh/uv/
[semver]: https://semver.org/
85 changes: 31 additions & 54 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,58 +1,43 @@
#* Variables
SHELL ?= /usr/bin/env bash
PYTHON ?= python
PYTHONPATH := `pwd`
POETRY ?= poetry
ACTIVEPYTHON = $(shell which python)

#* Poetry
.PHONY: poetry-install
poetry-install:
curl -sSL https://install.python-poetry.org | $(PYTHON) -

.PHONY: poetry-remove
poetry-remove:
curl -sSL https://install.python-poetry.org | $(PYTHON) - --uninstall

.PHONY: poetry-plugins
poetry-plugins:
$(POETRY) self add poetry-plugin-up

.PHONY: poetry-env
poetry-env:
$(POETRY) config virtualenvs.in-project true
#* UV
.PHONY: setup
setup:
which uv >/dev/null || (curl -LsSf https://astral.sh/uv/install.sh | sh)

.PHONY: publish
publish:
$(POETRY) publish --build
uv publish --build

#* Installation
.PHONY: install
install: poetry-env
$(POETRY) lock -n && poetry export --without-hashes > requirements-lock.txt
$(POETRY) install -n
-poetry run mypy --install-types --non-interactive ./
install: setup
uv export --format requirements-txt -o requirements.txt --no-dev
uv pip install --python $(ACTIVEPYTHON) -r requirements.txt

.PHONY: install-dev
install-dev: poetry-env install
$(POETRY) install -n --with dev
install-dev: setup
uv export --format requirements-txt -o requirements-dev.txt
uv pip install --python $(ACTIVEPYTHON) -r requirements-dev.txt

.PHONY: pre-commit-install
pre-commit-install:
$(POETRY) run pre-commit install

pre-commit-install: setup
uv run --python $(ACTIVEPYTHON) pre-commit install

#* Formatters
.PHONY: codestyle
codestyle:
$(POETRY) run ruff format --config=pyproject.toml stac_model tests
codestyle: setup
uv run --python $(ACTIVEPYTHON) ruff format --config=pyproject.toml stac_model tests

.PHONY: format
format: codestyle

#* Linting
.PHONY: test
test:
PYTHONPATH=$(PYTHONPATH) poetry run pytest -c pyproject.toml --cov-report=html --cov=stac_model tests/
test: setup
uv run --python $(ACTIVEPYTHON) pytest -c pyproject.toml --cov-report=html --cov=stac_model tests/

.PHONY: check
check: check-examples check-markdown check-lint check-mypy check-safety check-citation
Expand All @@ -61,37 +46,28 @@ check: check-examples check-markdown check-lint check-mypy check-safety check-ci
check-all: check

.PHONY: mypy
mypy:
$(POETRY) run mypy --config-file pyproject.toml ./
mypy: setup
uv run --python $(ACTIVEPYTHON) mypy --config-file pyproject.toml ./

.PHONY: check-mypy
check-mypy: mypy

# NOTE:
# purposely running with docker rather than python package due to conflicting dependencies
# see https://github.com/citation-file-format/cffconvert/issues/292
.PHONY: check-citation
check-citation:
docker run --rm -v $(PYTHONPATH)/CITATION.cff:/app/CITATION.cff citationcff/cffconvert --validate

.PHONY: check-safety
check-safety:
$(POETRY) check
$(POETRY) run safety check --full-report
$(POETRY) run bandit -ll --recursive stac_model tests
check-safety: setup
uv run --python $(ACTIVEPYTHON) safety check --full-report
uv run --python $(ACTIVEPYTHON) bandit -ll --recursive stac_model tests

.PHONY: lint
lint:
$(POETRY) run ruff --config=pyproject.toml ./
$(POETRY) run pydocstyle --count --config=pyproject.toml ./
$(POETRY) run pydoclint --config=pyproject.toml ./
lint: setup
uv run --python $(ACTIVEPYTHON) ruff check --fix --config=pyproject.toml ./

.PHONY: check-lint
check-lint: lint
uv run --python $(ACTIVEPYTHON) ruff check --config=pyproject.toml ./

.PHONY: format-lint
format-lint:
$(POETRY) run ruff --config=pyproject.toml --fix ./
format-lint: lint
ruff format --config=pyproject.toml ./

.PHONY: install-npm
install-npm:
Expand Down Expand Up @@ -120,8 +96,9 @@ $(addprefix fix-, $(FORMATTERS)): fix-%: format-%
lint-all: lint mypy check-safety check-markdown

.PHONY: update-dev-deps
update-dev-deps:
$(POETRY) up --only=dev-dependencies --latest
update-dev-deps: setup
uv export --only-dev --format requirements-txt -o requirements-only-dev.txt
uv pip install --python $(ACTIVEPYTHON) -r requirements-only-dev.txt

#* Cleaning
.PHONY: pycache-remove
Expand Down
14 changes: 5 additions & 9 deletions README_STAC_MODEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
[![PyPI Release][bp3]][bp2]
[![Repository][bscm1]][bp4]
[![Releases][bscm2]][bp5]
[![Docs][bdoc1]][bdoc2]

[![Contributions Welcome][bp8]][bp9]

[![Poetry][bp11]][bp12]
[![uv][bp11]][bp12]
[![Pre-commit][bp15]][bp16]
[![Semantic versions][blic3]][bp5]
[![Pipelines][bscm6]][bscm7]
Expand All @@ -30,10 +29,10 @@ _A PydanticV2 and PySTAC validation and serialization library for the STAC ML Mo
pip install -U stac-model
```

or install with `Poetry`:
or install with uv:

```shell
poetry add stac-model
uv add stac-model
```
Then you can run

Expand Down Expand Up @@ -73,8 +72,8 @@ See [LICENSE][blic2] for more details.
[bp7]: https://kutt.it/7fYqQl
[bp8]: https://img.shields.io/static/v1.svg?label=Contributions&message=Welcome&color=0059b3&style=for-the-badge
[bp9]: https://github.com/stac-extensions/mlm/blob/main/CONTRIBUTING.md
[bp11]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json&style=for-the-badge
[bp12]: https://python-poetry.org/
[bp11]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json&style=for-the-badge
[bp12]: https://docs.astral.sh/uv/

[bp15]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white&style=for-the-badge
[bp16]: https://github.com/stac-extensions/mlm/blob/main/.pre-commit-config.yaml
Expand All @@ -95,6 +94,3 @@ See [LICENSE][blic2] for more details.
[hub6]: https://docs.github.com/en/code-security/dependabot
[hub8]: https://github.com/stac-extensions/mlm/blob/main/.github/release-drafter.yml
[hub9]: https://github.com/stac-extensions/mlm/blob/main/.github/.stale.yml

[bdoc1]: https://img.shields.io/badge/docs-github%20pages-0a507a?style=for-the-badge
[bdoc2]: https://github.com/stac-extensions/mlm/blob/main/README_STAC_MODEL.md
25 changes: 0 additions & 25 deletions docker/Dockerfile

This file was deleted.

Loading

0 comments on commit 25d0ee4

Please sign in to comment.