Skip to content

Commit 42920b6

Browse files
authored
Merge pull request #12 Complete porting to stand-alone
2 parents b0378f4 + c46c778 commit 42920b6

File tree

12 files changed

+296
-13
lines changed

12 files changed

+296
-13
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Code of Conduct
2+
3+
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4+
5+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct.
15+
16+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
17+
18+
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

.github/CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### Contribution Best Practices
2+
3+
* Read this [how-to about Github workflow here](https://guides.github.com/introduction/flow/) if you are not familiar with.
4+
5+
* Read all the texts related to [contributing for an OS community](https://github.com/HTTP-APIs/hydrus/tree/master/.github).
6+
7+
* Read this [how-to about writing a PR](https://github.com/blog/1943-how-to-write-the-perfect-pull-request) and this [other how-to about writing a issue](https://wiredcraft.com/blog/how-we-write-our-github-issues/)
8+
9+
* **first ask in chat**: if you find a problem, first ask for [help in the chat](https://gitter.im/HTTP-APIs/Lobby), then consider opening a issue.
10+
11+
* **read history**: before opening a PR be sure that all the tests pass successfully. If any is failing for non-related reasons, annotate the test failure in the PR comment.
12+
13+
* **PRs on develop**: any change should be PRed first in `develop`, `master` can only receive merge from develop.
14+
15+
* **testing**: everything should work and be tested for Python 3.5.2 and above.
16+
17+
* **free PR**: no permission is needed to work on the code. Fork `master`, submit a PR and ask for reviewing. PR is the natural place for code comparison and corrections. If many contributors have something ready in a PR, we can consider opening a branch in which different people working on the same part of the application can collaborate.
18+
19+
* **pylint**: code in PRs should be accurately compliant with [PEP-8](https://www.python.org/dev/peps/pep-0008/), checking code with `pylint` is fine.
20+
21+
* **mypy**: every module is and should in future provide type annotations using `mypy`.

.github/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### I'm submitting a
2+
- [ ] bug report.
3+
- [ ] feature request.
4+
5+
### Current Behaviour:
6+
<!-- Describe about the bug -->
7+
8+
### Expected Behaviour:
9+
<!-- Describe what will happen if bug is removed -->
10+
11+
### Steps to reproduce:
12+
<!-- If you can then please provide the steps to reproduce the bug -->
13+
14+
### Do you want to work on this issue?
15+
<!-- yes/no -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!-- Please create/claim an issue before sending a PR -->
2+
<!-- Add issue number (Eg: fixes #123) -->
3+
4+
Fixes #
5+
6+
### Checklist
7+
- [ ] My branch is up-to-date with upstream/develop branch.
8+
- [ ] Everything works and tested for Python 3.5.2 and above.
9+
10+
### Description
11+
<!-- Describe about what this PR does, previous state and new state of the output -->
12+
13+
### Change logs
14+
15+
<!-- #### Added -->
16+
<!-- Edit these points below to describe the new features added with this PR -->
17+
<!-- - Feature 1 -->
18+
<!-- - Feature 2 -->
19+
20+
21+
<!-- #### Changed -->
22+
<!-- Edit these points below to describe the changes made in existing functionality with this PR -->
23+
<!-- - Change 1 -->
24+
<!-- - Change 1 -->
25+
26+
27+
<!-- #### Fixed -->
28+
<!-- Edit these points below to describe the bug fixes made with this PR -->
29+
<!-- - Bug 1 -->
30+
31+
32+
<!-- #### Removed -->
33+
<!-- Edit these points below to describe the removed features with this PR -->
34+
<!-- - Deprecated feature 1 -->

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
# hydra-python-core
22
This library provides the core functions to implement Hydra Official Specification in Python.
33

4+
Currently the library mainly consists of 2 modules `doc_writer` and `doc_maker` which help hydrus generalise a lot of things.
45

5-
*Porting out from hydrus the hydraspecs directory*
6+
-> `doc_writer` creates a new API Documentation as well as a `HydraDoc` object while,
7+
-> `doc_maker` uses an existing API Documentation to create a `HydraDoc` object c`
8+
9+
10+
11+
### Installation
12+
13+
To install the library:
14+
15+
```bash
16+
pip install git+https://github.com/HTTP-APIs/hydra-python-core.git#egg=hydra_python_core
17+
```
18+
19+
**Note :-** If using hydrus, the library doesn't need to be installed separately as it is already a part of `requirements.txt` for hydrus.
620

21+
22+
23+
### Usage
24+
25+
To import the modules:
26+
27+
```python
28+
from hydra_python_core import doc_writer
29+
from hydra_python_core import doc_maker
30+
```
31+
32+
*Porting out from hydrus the hydraspecs directory*

hydra_python_core/doc_maker.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
'''Contsructor to take a Python dict containing an API Documentation and
2-
create a HydraDoc object for it'''
1+
"""Contsructor to take a Python dict containing an API Documentation and
2+
create a HydraDoc object for it
3+
"""
34
import re
45
import json
5-
from hydrus.samples.doc_writer_sample import api_doc as sample_document
6-
from hydrus.hydraspec.doc_writer import HydraDoc, HydraClass, HydraClassProp, HydraClassOp
7-
from hydrus.hydraspec.doc_writer import HydraStatus
6+
from hydra_python_core.doc_writer import HydraDoc, HydraClass, HydraClassProp, HydraClassOp
7+
from hydra_python_core.doc_writer import HydraStatus
88
from typing import Any, Dict, Match, Optional, Tuple, Union
99

1010

11-
def error_mapping(body: str = None) -> str:
11+
def error_mapping(body: str=None) -> str:
1212
"""Function returns starting error message based on its body type.
1313
:param body: Params type for error message
1414
:return string: Error message for input key
@@ -357,8 +357,3 @@ def create_status(possible_status: Dict[str, Any]) -> HydraStatus:
357357
status = HydraStatus(result["statusCode"],
358358
result["title"], result["description"])
359359
return status
360-
361-
362-
if __name__ == "__main__":
363-
api_doc = create_doc(sample_document.generate())
364-
print(json.dumps(api_doc.generate(), indent=4, sort_keys=True))

samples/__init__.py

Whitespace-only changes.

samples/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import json
2+
3+
if __name__ == "__main__":
4+
api_doc = create_doc(sample_document.generate())
5+
print(json.dumps(api_doc.generate(), indent=4, sort_keys=True))

samples/doc_writer_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Sample to create Hydra APIDocumentation using doc_writer."""
22

3-
from hydrus.hydraspec.doc_writer import HydraDoc, HydraClass, HydraClassProp, HydraClassOp
3+
from hydra_python_core.doc_writer import HydraDoc, HydraClass, HydraClassProp, HydraClassOp
44
from typing import Any, Dict, Union
55

66
# Creating the HydraDoc object, this is the primary class for the Doc

setup.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name='hydra_python_core',
5+
version='0.1',
6+
packages=find_packages(),
7+
license='MIT',
8+
description='Core functions for Hydrus',
9+
long_description=open('README.md').read(),
10+
long_description_content_type="text/markdown",
11+
url='https://github.com/HTTP-APIs/hydra-python-core',
12+
zip_safe=False
13+
)

0 commit comments

Comments
 (0)