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

Chore: release package #67

Merged
merged 1 commit into from
Feb 6, 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
40 changes: 40 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to Pypi
on:
push:
branches:
- 'master'

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution πŸ“¦ to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution πŸ“¦ to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,6 @@ cython_debug/
# Node stuff
package-lock.json
node_modules/

# package
dist/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

Expand Down
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) [2023] [STRV-DS-Department]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,8 @@ work with OpenSearch.

## <a name="installation">:computer: Installation</a>

### Local environment

1. Have a valid ssh authentication key on your local machine.
2. Add `git+ssh://[email protected]/strvcom/strv-ds-opensearch-manager.git` to `requirements.txt`.
3. Create a venv or conda environment using `requirements.txt`.

### Docker-compose
1. Do all the 'local environment' steps above.
2. Run docker compose with reference to the local key as an argument (e.g. `docker-compose build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519)"`)
3. Add the following to the Dockerfile:
```
# Add ssh private key into container
ARG SSH_PRIVATE_KEY
RUN mkdir ~/.ssh/
RUN echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_ed25519
RUN chmod 600 ~/.ssh/id_ed25519
RUN ssh-keyscan github.com >> ~/.ssh/known_hosts
```

**_NOTE:_** When using Makefile use `SSH_PRIVATE_KEY="$$(cat ~/.ssh/id_ed25519)`.
1. Create a new virtual environment.
2. Run `pip install osmanager`.

## <a name="usage">:hammer: Usage</a>

Expand Down Expand Up @@ -249,8 +231,32 @@ For running linters from GitHub actions locally, you need to do the following.
1. From root project directory, run: `pre-commit run --all-files`

### <a name="versioning">:heavy_plus_sign: Versioning</a>
For information on semantic versioning, see [semver.org](https://semver.org/).

Given a version number MAJOR.MINOR.PATCH, increment the:

- MAJOR version when you make incompatible API changes
- MINOR version when you add functionality in a backwards compatible manner
- PATCH version when you make backwards compatible bug fixes

When incrementing the MAJOR version, reset the MINOR and PATCH versions to 0.
When incrementing the MINOR version, reset the PATCH version to 0.

*TODO*
When a version is released, a tag should be created in the format `vMAJOR.MINOR.PATCH`.

Follow the steps below to create a new release:
1. Update `package.json` with the new version number.
2. Add the tag to the current branch like this:

```
git tag -a v1.0.0 -m "Release version 1.0.0"
```
3. Push the tag to the remote repository:

```
git push origin --tags
```
4. Create a new pull request with the new version number and merge it to the `master` branch.

### <a name="contributors">:pencil: Contributors</a>

Expand Down
1 change: 1 addition & 0 deletions osman/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Osman package init."""

# flake8: noqa
from osman.config import OsmanConfig
from osman.osman import Osman
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "strv-ds-opensearch-manager",
"version": "1.0.0",
"description": "STRV OpenSearch manager repository.",
"name": "osmanager",
"version": "1.0.2",
"description": "OpenSearch manager repository.",
"author": "STRV DS Department <[email protected]>",
"email": "[email protected]",
"url": "https://github.com/strvcom/osman",
"contributors": [
"Niek Mereu <[email protected]>",
"Vladimir Kadlec <[email protected]>",
"Jaroslav Bezdek <[email protected]>"
],
"license": "ISC",
Expand Down
20 changes: 13 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Package setup."""
import json

from setuptools import find_packages, setup

with open("README.md", mode="r", encoding="utf-8") as readme_file:
long_description = readme_file.read()

with open("package.json", mode="r", encoding="utf-8") as package_file:
package_info = package_file.read()
package_info = json.loads(package_info)

setup(
name="osman",
version="0.0.1",
author="STRV DS Department",
author_email="[email protected]",
description="STRV OpenSearch manager.",
name=package_info["name"],
version=package_info["version"],
author=package_info["author"],
author_email=package_info["email"],
url=package_info["url"],
description=package_info["description"],
long_description_content_type="text/markdown",
long_description=long_description,
packages=find_packages(
Expand All @@ -37,11 +43,11 @@
"py>=1.11",
"pyparsing>=3.0",
"requests>=2.28",
"tomli>=2.0.",
"tomli>=2.0",
"urllib3>=1.26",
"requests-aws4auth>=1.1",
"deepdiff>=6.2",
],
python_requires=">=3.8",
python_requires=">=3.9",
include_package_data=True,
)