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

add module version in python code #27

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/versioning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Version Management

on:
- push

jobs:
validate-tag:
name: Validate tag
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Get version
id: getVersion
run: echo ::set-output name=version::$(python -c "from csdap_bulk_download import __version__; print(__version__)")

- uses: mukunku/[email protected]
id: checkTag
with:
tag: ${{ steps.getVersion.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Found existing tag
if: ${{ steps.checkTag.outputs.exists == 'true' }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Tag ${{ steps.getVersion.outputs.version }} already exists on this repo.')
3 changes: 3 additions & 0 deletions csdap_bulk_download/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""csdap_bulk_download."""

__version__ = "0.1.0"
3 changes: 2 additions & 1 deletion csdap_bulk_download/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from .csdap import CsdapClient
from .logger import setup_logger

from . import __version__

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -74,6 +74,7 @@
help="Filter by asset_type",
)
@click.option("verbosity", "-v", "--verbose", count=True)
@click.version_option(version=__version__, message="%(version)s")
def cli(
input_csvs: List[TextIOWrapper],
out_dir: Path,
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml

This file was deleted.

14 changes: 14 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[metadata]
version = attr: csdap_bulk_download.__version__

[black]
line-length = 88

[flake8]
max-line-length = 88
exclude =
.git,
.venv,
__pycache__,
*.egg-info,
output
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

setuptools.setup(
name="csdap_bulk_download",
version="1.0",
description="Bulk download tool for CSDAP orders.",
author="NASA Impact",
author_email="[email protected]",
Expand Down
8 changes: 0 additions & 8 deletions tox.ini

This file was deleted.