Skip to content

Commit cfab8c2

Browse files
JIRA-1630 Minor: Initial Stub Development for Provena Client Tool. (#1)
* 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
1 parent 3bd04b3 commit cfab8c2

22 files changed

+2915
-33
lines changed

.github/workflows/ci-cd.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: ci-cd
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ci:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Set up Python
10+
uses: actions/setup-python@v4
11+
with:
12+
python-version: "3.9"
13+
14+
- name: Check-out repository
15+
uses: actions/checkout@v3
16+
17+
- name: Install poetry
18+
uses: snok/install-poetry@v1
19+
20+
- name: Install package
21+
run: poetry install
22+
23+
- name: Mypy type check
24+
run: poetry run mypy .
25+
26+
- name: Test with pytest
27+
run: poetry run pytest tests/ --cov=provenaclient --cov-report=xml
28+
29+
- name: Use Codecov to track coverage
30+
uses: codecov/codecov-action@v3
31+
with:
32+
files: ./coverage.xml
33+
34+
- name: Build documentation
35+
run: poetry run make html --directory docs/
36+
37+
cd:
38+
permissions:
39+
id-token: write
40+
contents: write
41+
needs: ci
42+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/inital-branch')
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Set up Python
46+
uses: actions/setup-python@v4
47+
with:
48+
python-version: "3.9"
49+
50+
- name: Check-out repository
51+
uses: actions/checkout@v3
52+
with:
53+
fetch-depth: 0
54+
55+
- name: Use Python Semantic Release to prepare release
56+
id: release
57+
uses: python-semantic-release/[email protected]
58+
with:
59+
github_token: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Publish to TestPyPI
62+
uses: pypa/gh-action-pypi-publish@release/v1
63+
if: steps.release.outputs.released == 'true'
64+
with:
65+
repository-url: https://test.pypi.org/legacy/
66+
67+
- name: Test install from TestPyPI
68+
if: steps.release.outputs.released == 'true'
69+
run: |
70+
pip install \
71+
--index-url https://test.pypi.org/simple/ \
72+
--extra-index-url https://pypi.org/simple \
73+
provenaclient
74+
75+
- name: Publish to PyPI
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
if: steps.release.outputs.released == 'true'
78+
79+
- name: Publish package distributions to GitHub Releases
80+
uses: python-semantic-release/upload-to-gh-release@main
81+
if: steps.release.outputs.released == 'true'
82+
with:
83+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ parts/
2020
sdist/
2121
var/
2222
wheels/
23+
pip-wheel-metadata/
2324
share/python-wheels/
2425
*.egg-info/
2526
.installed.cfg
@@ -49,7 +50,6 @@ coverage.xml
4950
*.py,cover
5051
.hypothesis/
5152
.pytest_cache/
52-
cover/
5353

5454
# Translations
5555
*.mo
@@ -72,7 +72,6 @@ instance/
7272
docs/_build/
7373

7474
# PyBuilder
75-
.pybuilder/
7675
target/
7776

7877
# Jupyter Notebook
@@ -83,9 +82,7 @@ profile_default/
8382
ipython_config.py
8483

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

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

97-
# poetry
98-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
103-
104-
# pdm
105-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/#use-with-ide
110-
.pdm.toml
111-
112-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
11395
__pypackages__/
11496

11597
# Celery stuff
@@ -145,16 +127,16 @@ dmypy.json
145127

146128
# Pyre type checker
147129
.pyre/
130+
**__pycache__
148131

149-
# pytype static type analyzer
150-
.pytype/
132+
# PyCharm
133+
.idea/
151134

152-
# Cython debug symbols
153-
cython_debug/
135+
# RStudio project files
136+
**.Rproj.user/
137+
**.Rproj.user*
138+
**.Rproj
139+
**.Rhistory
154140

155-
# PyCharm
156-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158-
# and can be added to the global gitignore or merged into this file. For a more nuclear
159-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
141+
# MacOS
142+
.DS_Store

.readthedocs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.9"
13+
jobs:
14+
post_create_environment:
15+
# Install poetry
16+
# https://python-poetry.org/docs/#installing-manually
17+
- pip install poetry
18+
# Tell poetry to not use a virtual environment
19+
- poetry config virtualenvs.create false
20+
post_install:
21+
# Install dependencies with 'docs' dependency group
22+
# https://python-poetry.org/docs/managing-dependencies/#dependency-groups
23+
- poetry install
24+
25+
# Build documentation in the "docs/" directory with Sphinx
26+
sphinx:
27+
configuration: docs/conf.py

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
<!--next-version-placeholder-->
4+
5+
## v0.1.0 (04/04/2024)
6+
7+
- First release of `provenaclient`!

CONTRIBUTING.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Contributing
2+
3+
Contributions are welcome, and they are greatly appreciated! Every little bit
4+
helps, and credit will always be given.
5+
6+
## Types of Contributions
7+
8+
### Report Bugs
9+
10+
If you are reporting a bug, please include:
11+
12+
* Your operating system name and version.
13+
* Any details about your local setup that might be helpful in troubleshooting.
14+
* Detailed steps to reproduce the bug.
15+
16+
### Fix Bugs
17+
18+
Look through the GitHub issues for bugs. Anything tagged with "bug" and "help
19+
wanted" is open to whoever wants to implement it.
20+
21+
### Implement Features
22+
23+
Look through the GitHub issues for features. Anything tagged with "enhancement"
24+
and "help wanted" is open to whoever wants to implement it.
25+
26+
### Write Documentation
27+
28+
You can never have enough documentation! Please feel free to contribute to any
29+
part of the documentation, such as the official docs, docstrings, or even
30+
on the web in blog posts, articles, and such.
31+
32+
### Submit Feedback
33+
34+
If you are proposing a feature:
35+
36+
* Explain in detail how it would work.
37+
* Keep the scope as narrow as possible, to make it easier to implement.
38+
* Remember that this is a volunteer-driven project, and that contributions
39+
are welcome :)
40+
41+
## Get Started!
42+
43+
Ready to contribute? Here's how to set up `provenaclient` for local development.
44+
45+
1. Download a copy of `provenaclient` locally.
46+
2. Install `provenaclient` using `poetry`:
47+
48+
```console
49+
$ poetry install
50+
```
51+
52+
3. Use `git` (or similar) to create a branch for local development and make your changes:
53+
54+
```console
55+
$ git checkout -b name-of-your-bugfix-or-feature
56+
```
57+
58+
4. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests.
59+
60+
5. Commit your changes and open a pull request.
61+
62+
## Pull Request Guidelines
63+
64+
Before you submit a pull request, check that it meets these guidelines:
65+
66+
1. The pull request should include additional tests if appropriate.
67+
2. If the pull request adds functionality, the docs should be updated.
68+
3. The pull request should work for all currently supported operating systems and versions of Python.
69+
70+
## Code of Conduct
71+
72+
Please note that the `provenaclient` project is released with a
73+
Code of Conduct. By contributing to this project you agree to abide by its terms.

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,39 @@
1-
# provena-python-client
2-
Client library for interfacing with a Provena instance
1+
# provenaclient
2+
3+
A client library for interfacing with a Provena instance.
4+
5+
## Installation
6+
7+
```bash
8+
$ pip install provenaclient
9+
```
10+
11+
## Usage
12+
13+
### How to get started with Poetry
14+
15+
1) Run the Command: `curl -sSL https://install.python-poetry.org | python3 -`.
16+
2) Check if poetry was successfully installed by running `poetry --version`.
17+
3) You should now have be able to see your poetry version successfully.
18+
4) Now run the command `poetry shell`. This will activate the poetry virtual environment for you.
19+
5) Now finally run the command `poetry install`. This will install all dependencies defined within pyproject.toml.
20+
21+
### My Poetry Installation is not being detected?
22+
1) This means that your PATH variable does not include the Poetry directory.
23+
2) Open your .bashrc file, using the command `nano ~/.bashrc`.
24+
3) Add the following line at the end of the file, `export PATH= "$HOME/.local/bin:$PATH"`.
25+
4) Reload your .bashrc file, using the command `source ~/.bashrc`.
26+
5) Verify that your poetry is now running, using the command `poetry --version`.
27+
28+
29+
30+
## Contributing
31+
TODO
32+
33+
## License
34+
35+
`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.
36+
37+
## Credits
38+
39+
`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).

dev-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cookiecutter
2+
mypy

docs/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Minimal makefile for Sphinx documentation
2+
3+
# You can set these variables from the command line.
4+
SPHINXOPTS =
5+
SPHINXBUILD = python -msphinx
6+
SPHINXPROJ = provenaclient
7+
SOURCEDIR = .
8+
BUILDDIR = _build
9+
10+
# Put it first so that "make" without argument is like "make help".
11+
help:
12+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
14+
.PHONY: help Makefile
15+
16+
# Catch-all target: route all unknown targets to Sphinx using the new
17+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
%: Makefile
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```{include} ../CHANGELOG.md
2+
```

docs/conf.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Project information -----------------------------------------------------
8+
9+
project = u"provenaclient"
10+
copyright = u"2024, Parth Kulkarni"
11+
author = u"Parth Kulkarni"
12+
13+
# -- General configuration ---------------------------------------------------
14+
15+
# Add any Sphinx extension module names here, as strings. They can be
16+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
17+
# ones.
18+
extensions = [
19+
"myst_nb",
20+
"autoapi.extension",
21+
"sphinx.ext.napoleon",
22+
"sphinx.ext.viewcode",
23+
]
24+
autoapi_dirs = ["../src"]
25+
26+
# List of patterns, relative to source directory, that match files and
27+
# directories to ignore when looking for source files.
28+
# This pattern also affects html_static_path and html_extra_path.
29+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
30+
31+
# -- Options for HTML output -------------------------------------------------
32+
33+
# The theme to use for HTML and HTML Help pages. See the documentation for
34+
# a list of builtin themes.
35+
#
36+
html_theme = "sphinx_rtd_theme"

docs/contributing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```{include} ../CONTRIBUTING.md
2+
```

0 commit comments

Comments
 (0)