Skip to content

Commit

Permalink
feat(pip): migrate to publishing pip package using poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
pmokeev committed Feb 28, 2024
1 parent 9e4abde commit 223f0e7
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 14 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ "main" ]

jobs:
build:
lints-and-tests:

runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -43,4 +43,34 @@ jobs:
- name: Test with pytest
run: |
pip install .
pytest
pytest
publish-package:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

strategy:
matrix:
os: [ ubuntu-latest ]
python-version: [ "3.9" ]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Publish to PyPI
run: |
poetry version $(git describe --tags --abbrev=0)
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build
12 changes: 12 additions & 0 deletions DEVELOP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Publish package to PyPi

1. Create tag on main branch:
```commandline
git tag <tagname>
```
2. Push created tag to repository
```commandline
git push origin <tagname>
```
After this GitHubActions will automatically build pip package and push it to PyPi registry.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ in the same grid synchronizing their subdivision schemes.
To install the latest version of the library, run

```shell
pip install git+https://github.com/prime-slam/octreelib
pip install octreelib
```

To install a specific version, use **tags**, for example tag `v0.0.3`
To install a specific version, use **tags**, for example tag `0.0.1`

```shell
pip install git+https://github.com/prime-slam/octreelib@v0.0.3
pip install octreelib=v0.0.1
```

34 changes: 25 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
[project]
[tool.poetry]
name = "octreelib"
dynamic = ["dependencies"]
version = "0.0.5"
version = "0.0.0"
description = "Library for representing point clouds as OcTrees in SLAM"
authors = [
"Kiselyov Mikhail <[email protected]>",
"Pavel Mokeev <[email protected]>"
]
license = "APACHE"
readme = "README.md"
homepage = "https://github.com/prime-slam/"
repository = "https://github.com/prime-slam/octreelib"
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
]

[tool.setuptools]
include-package-data = false
[tool.poetry.dependencies]
python = "^3.9.0"
numpy = "^1.26.0"
k3d = "^2.16.0"

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }
[tool.poetry.dev-dependencies]
pytest = "^7.4.2"

[tool.setuptools.packages.find]
exclude = ["test*"]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 223f0e7

Please sign in to comment.