Skip to content

Commit

Permalink
JIRA-1630 Minor: Initial Stub Development for Provena Client Tool. (#1)
Browse files Browse the repository at this point in the history
* Created initial package setup with cookie-cutter template

* Updated CI/CD script to only run on main branch, fixed incorrect imports and deleted files that were not needed

* Integrated mypi in the package and was able to successfully build.

* Shifted from a class to a data-class for Settings, updated CI-CD script and README.md and removed CONDUCT.md files.

* Updated CI-CD script to use OCID instead of API tokens, and made it trigger on initial branch for testing purposes.

* Simplifying CI-CD file to ensure it runs without issues.

* Removed pull-request for now from CI/CD script.

* Updated dependencies for CI

* Updated poetry lock file for CI.

* Added dummy test for CI to pass.

* Updated CI to support pull request,  as I am gonna merge pull request to main to release package.

---------

Co-authored-by: Parth-Kulkarni
  • Loading branch information
parth-kulkarni1 authored Apr 5, 2024
1 parent 3bd04b3 commit cfab8c2
Show file tree
Hide file tree
Showing 22 changed files with 2,915 additions and 33 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: ci-cd

on: [push, pull_request]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Check-out repository
uses: actions/checkout@v3

- name: Install poetry
uses: snok/install-poetry@v1

- name: Install package
run: poetry install

- name: Mypy type check
run: poetry run mypy .

- name: Test with pytest
run: poetry run pytest tests/ --cov=provenaclient --cov-report=xml

- name: Use Codecov to track coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml

- name: Build documentation
run: poetry run make html --directory docs/

cd:
permissions:
id-token: write
contents: write
needs: ci
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/inital-branch')
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Check-out repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Python Semantic Release to prepare release
id: release
uses: python-semantic-release/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
with:
repository-url: https://test.pypi.org/legacy/

- name: Test install from TestPyPI
if: steps.release.outputs.released == 'true'
run: |
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
provenaclient
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
44 changes: 13 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down Expand Up @@ -49,7 +50,6 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -72,7 +72,6 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -83,9 +82,7 @@ profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand All @@ -94,22 +91,7 @@ ipython_config.py
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
Expand Down Expand Up @@ -145,16 +127,16 @@ dmypy.json

# Pyre type checker
.pyre/
**__pycache__

# pytype static type analyzer
.pytype/
# PyCharm
.idea/

# Cython debug symbols
cython_debug/
# RStudio project files
**.Rproj.user/
**.Rproj.user*
**.Rproj
**.Rhistory

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# MacOS
.DS_Store
27 changes: 27 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.9"
jobs:
post_create_environment:
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
# Tell poetry to not use a virtual environment
- poetry config virtualenvs.create false
post_install:
# Install dependencies with 'docs' dependency group
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
- poetry install

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

<!--next-version-placeholder-->

## v0.1.0 (04/04/2024)

- First release of `provenaclient`!
73 changes: 73 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.

## Types of Contributions

### Report Bugs

If you are reporting a bug, please include:

* Your operating system name and version.
* Any details about your local setup that might be helpful in troubleshooting.
* Detailed steps to reproduce the bug.

### Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
wanted" is open to whoever wants to implement it.

### Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement"
and "help wanted" is open to whoever wants to implement it.

### Write Documentation

You can never have enough documentation! Please feel free to contribute to any
part of the documentation, such as the official docs, docstrings, or even
on the web in blog posts, articles, and such.

### Submit Feedback

If you are proposing a feature:

* Explain in detail how it would work.
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions
are welcome :)

## Get Started!

Ready to contribute? Here's how to set up `provenaclient` for local development.

1. Download a copy of `provenaclient` locally.
2. Install `provenaclient` using `poetry`:

```console
$ poetry install
```

3. Use `git` (or similar) to create a branch for local development and make your changes:

```console
$ git checkout -b name-of-your-bugfix-or-feature
```

4. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests.

5. Commit your changes and open a pull request.

## Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

1. The pull request should include additional tests if appropriate.
2. If the pull request adds functionality, the docs should be updated.
3. The pull request should work for all currently supported operating systems and versions of Python.

## Code of Conduct

Please note that the `provenaclient` project is released with a
Code of Conduct. By contributing to this project you agree to abide by its terms.
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# provena-python-client
Client library for interfacing with a Provena instance
# provenaclient

A client library for interfacing with a Provena instance.

## Installation

```bash
$ pip install provenaclient
```

## Usage

### How to get started with Poetry

1) Run the Command: `curl -sSL https://install.python-poetry.org | python3 -`.
2) Check if poetry was successfully installed by running `poetry --version`.
3) You should now have be able to see your poetry version successfully.
4) Now run the command `poetry shell`. This will activate the poetry virtual environment for you.
5) Now finally run the command `poetry install`. This will install all dependencies defined within pyproject.toml.

### My Poetry Installation is not being detected?
1) This means that your PATH variable does not include the Poetry directory.
2) Open your .bashrc file, using the command `nano ~/.bashrc`.
3) Add the following line at the end of the file, `export PATH= "$HOME/.local/bin:$PATH"`.
4) Reload your .bashrc file, using the command `source ~/.bashrc`.
5) Verify that your poetry is now running, using the command `poetry --version`.



## Contributing
TODO

## License

`provenaclient` was created by Provena Development Team (CSIRO). Provena Development Team (CSIRO) retains all rights to the source and it may not be reproduced, distributed, or used to create derivative works.

## Credits

`provenaclient` was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cookiecutter
mypy
19 changes: 19 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = provenaclient
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2 changes: 2 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../CHANGELOG.md
```
36 changes: 36 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------

project = u"provenaclient"
copyright = u"2024, Parth Kulkarni"
author = u"Parth Kulkarni"

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"myst_nb",
"autoapi.extension",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]
autoapi_dirs = ["../src"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
2 changes: 2 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../CONTRIBUTING.md
```
Loading

0 comments on commit cfab8c2

Please sign in to comment.