Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
version 0.2.1
OAuth 2
Accounting API
Identity API
Exception handling
  • Loading branch information
SidneyAllen committed May 20, 2020
1 parent 7986053 commit cc6b476
Show file tree
Hide file tree
Showing 299 changed files with 70,741 additions and 33 deletions.
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
end_of_line = lf

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false

[Makefile]
indent_style = tab
46 changes: 15 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -20,12 +21,9 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -40,14 +38,12 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

Expand All @@ -58,8 +54,6 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand All @@ -77,38 +71,22 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

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

# Celery stuff
# celery beat schedule file
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
# dotenv
.env

# virtualenv
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
Expand All @@ -122,8 +100,14 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
# IDE settings
.vscode/
.idea/

# openapi code generator specifics
xeroapi-sdk-codegen/

# test specific configuration files
/tests/oauth2_client.py
/tests/oauth2_token.py
9 changes: 9 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Credits

## Development Lead

* Xero Developer API <[email protected]>

## Contributors

None yet. Why not be the first?
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

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, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
143 changes: 143 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Contributing to Xero-Python
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

We want to make contributing to this project as easy and transparent as possible, whether it's:

The following is a set of guidelines for contributing to Xero and its projects, which are hosted in the [XeroAPI Organization](https://github.com/XeroAPI) on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

### Table Of Contents
[Code of Conduct](#code-of-conduct)

[I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question)

[How Can I Contribute?](#how-can-i-contribute)
* [Reporting Bugs](#reporting-bugs)
* [Suggesting Enhancements](#suggesting-enhancements)
* [Pull Requests](#pull-requests)
* [Local installation](#local-installation)


## Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

## I don't want to read this whole thing I just have a question!!!

> **Note:** Please don't file an issue to ask a question. You'll get faster results by using the resources below.
We have an official [message board](https://community.xero.com/developer) where Xero API support and the community chimes in with helpful advice if you have questions.

* [API Documentation](https://developer.xero.com/documentation/)
* [Xero FAQ](https://developer.xero.com/faq)
* [Community, the official Xero message board](https://community.xero.com/developer)
* [Stackoverflow - Xero related](https://stackoverflow.com/questions/tagged/xero-api?sort=Newest)
* [Submit requests for support](https://developer.xero.com/contact-xero-developer-platform-support/) to our API Support team.

# How Can I Contribute?

You can contribute by reporting bugs, suggesting enhancements, improving documentation i.e. [README](README.md) or submitting a pull request.


## Reporting Bugs

Bugs are tracked as issues in this repository.

Before opening a new issue:
* **check [the README](README.md)** to see if the behavior you observed might be expected and if configuration options are available to provide you with the desired behavior.

* **perform a cursory search** to see if there's [an existing issue](https://github.com/xero-github/xero-python/issues) covering your feedback. If there is one and the issue is still open, **add a :+1: reaction** on the issue to express interest in the issue being resolved. That will help the team gauge interest without the noise of comments which trigger notifications to all watchers. Comments should be used only if you have new and useful information to share.

### Write bug reports with detail, background, and sample code

- Which version of the SDK are you using?
- A quick summary and/or background
- Steps to reproduce
- Be specific!
- Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

## Suggesting Enhancements

When opening an issue for a feature request:
* **use a clear and descriptive title** for the issue to identify the problem.
* **include as many details as possible in the body**. Explain your use-case, the problems you're hitting and the solutions you'd like to see to address those problems.

## Pull requests

We welcome your feedback and pull requests. Be aware some code is generated and pull requests may not be the best solution - see below.

### We Use OpenAPI Generator
The best way to propose changes to the codebase is to open an [issue](https://github.com/XeroAPI/xero-python/issues) and discuss with our team.

We are using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) and [our OpenAPI specs](https://github.com/XeroAPI/Xero-OpenAPI), to create and update our models and client classes. Improvements may require updates to our OAS or our customized mustache templates instead of modifying via pull request.

### Submit a pull request

1. Fork and clone the repository
1. Create a new branch: `git checkout -b my-branch-name`
1. Make your change, add tests if needed
1. Make sure the tests pass on your machine: `tox` read more in [local installation](#local-installation).
1. Push to your fork and submit a pull request
1. Pat your self on the back and wait for your pull request to be reviewed and merged.

Here are a few things you can do that will increase the likelihood of your pull request being accepted:

- Follow the [style guide](#style-guide).
- Write tests.
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).

### Style Guide

* 4 spaces for indentation rather than tabs
* See [.editorconfig](.editorconfig) for more styling rules
* We us [black](https://github.com/psf/black) code formatter and
[flake8](https://flake8.pycqa.org/en/latest/) to enforce style requirements.
* Activate virtual environment by running `source venv/bin/activate`
* Execute `flake8 xero_python tests` to check your code passes style requirements.
* If you see `BLK100 Black would make changes.` error Execute `black <file/path.py>` to correct it.

### Local development requirements

* Python3.5+ installed.

### Local installation

* To speed up local tests install [libyaml](https://pyyaml.org/wiki/LibYAML) library.
```bash
brew install libyaml # Mac with Homebrew
apt-get install libyaml-dev # Ubuntu
dnf install libyaml-devel # Fedora
```
* Create new python virtual environment `python3 -m venv venv`
* Activate new virtual environment by running `source venv/bin/activate`
* Install project dependencies by running `pip install -r requirements.txt -r requirements/dev.txt`

### Running tests
* Activate virtual environment by running `source venv/bin/activate`
* Execute `pytest` to run tests.

### Running tests for all python versions
* We use [tox](https://tox.readthedocs.io/en/latest/) to create different python environments and execute tests.

#### Local installation requirements
* You need to have python interpreters for python 3.5, 3.6, 3.7, and 3.8 installed locally.
* You can install them using [pyenv](https://github.com/pyenv/pyenv)
* Install `pyenv` - follow https://github.com/pyenv/pyenv#installation
* Install python versions required
```bash
pyenv install 3.5.9 && \
pyenv install 3.6.10 && \
pyenv install 3.7.6 && \
pyenv install 3.8.2
```

#### Running all tests
* Activate pyenv installed python versions `pyenv local 3.5.9 3.6.10 3.7.6 3.8.2`
* Activate virtual environment by running `source venv/bin/activate`
* Execute `tox` to run all tests in all python versions

## License
By contributing, you agree that your contributions will be licensed under its MIT License.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## History

### 0.1.0 (2020-03-02)
* First release on PyPI.
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Xero Developer API
Copyright (c) 2020, Xero Developer API

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,3 +19,4 @@ 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.

11 changes: 11 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include AUTHORS.md
include HISTORY.md
include LICENSE
include README.md
include requirements.txt

recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]

recursive-include docs *.md conf.py Makefile make.bat *.jpg *.png *.gif
Loading

0 comments on commit cc6b476

Please sign in to comment.