Skip to content

Commit 721e276

Browse files
authored
feat: initial commit
* feat: setup repo * feat: add missing files to repo * chore: some cleanup * ci: initial commit * ci: update to ubuntu github hosted * chore: add convential commit hook * fix(ci): missing dollar * fix(pre-commit): invalid values in hooks * fix(ci): missing python version cache key for deps * fix: minimum python version in pyproject * chore: poetry lock * chore(ci): do not install dev dependencies * test(ci): remove python 3.8 * test(ci): remove alpine containers * test(ci): experiment with junit report * fix(ci): fix bad names * fix(ci): missing install python * chore: update README * chore: clean up gitignore * docs: use README from serverless go * docs: add contributing from serverless go * docs: update contributing * docs: readme remove duplicated sections * docs: update readme * refactor: apply review suggestions * chore: delete docs folder
1 parent c53004c commit 721e276

20 files changed

+1586
-0
lines changed

.flake8

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[flake8]
2+
per-file-ignores =
3+
**/__init__.py: F401
4+
extend-ignore =
5+
# See: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html
6+
E203,
7+
# Commented Black formatted code
8+
max-line-length = 89

.github/CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all project spaces, and it also applies when
49+
an individual is representing the project or its community in public spaces.
50+
Examples of representing a project or community include using an official
51+
project e-mail address, posting via an official social media account, or acting
52+
as an appointed representative at an online or offline event. Representation of
53+
a project may be further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

.github/CONTRIBUTING.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Contribute to `serverless-functions-python`
2+
3+
## Topics
4+
5+
- [Contribute to `serverless-functions-python`](#contribute-to-serverless-functions-python)
6+
- [Topics](#topics)
7+
- [Reporting security issues](#reporting-security-issues)
8+
- [Reporting issues](#reporting-issues)
9+
- [Suggesting a feature](#suggesting-a-feature)
10+
- [Contributing code](#contributing-code)
11+
- [Submit code](#submit-code)
12+
- [Pull Request Guidelines](#pull-request-guidelines)
13+
- [Community Guidelines](#community-guidelines)
14+
15+
## Reporting security issues
16+
17+
At Scaleway we take security seriously. If you have any issues regarding security,
18+
please notify us by sending an email to [email protected].
19+
20+
Please DO NOT create a GitHub issue.
21+
22+
We will follow up with you promptly with more information and a remediation plan.
23+
We currently do not offer a paid security bounty program, but we would love to send some
24+
Scaleway swag your way along with our deepest gratitude for your assistance in making
25+
Scaleway a more secure Cloud ecosystem.
26+
27+
## Reporting issues
28+
29+
A great way to contribute to the project is to send a detailed report when you encounter a bug.
30+
We always appreciate a well-written, thorough bug report, and will thank you for it!
31+
Before opening a new issue, we appreciate you reviewing open issues to see if there are any similar requests.
32+
If there is a match, thumbs up the issue with a 👍 and leave a comment if you have additional information.
33+
34+
When reporting an issue, please include the PyPI version number of `scaleway-functions-python` that you are using.
35+
36+
## Suggesting a feature
37+
38+
When requesting a feature, some of the questions we want to answer are:
39+
40+
- What value does this feature bring to end users?
41+
- How urgent is the need (nice to have feature or need to have)?
42+
- Does this align with the goals of this library?
43+
44+
## Contributing code
45+
46+
### Submit code
47+
48+
To submit code:
49+
50+
- Create a fork of the project
51+
- Create a topic branch from where you want to base your work (usually main)
52+
- Add tests to cover contributed code
53+
- Push your commit(s) to your topic branch on your fork
54+
- Open a pull request against `serverless-functions-python` `main` branch that follows [PR guidelines](#pull-request-guidelines)
55+
56+
The maintainers of `serverless-functions-python` use a "Let's Get This Merged" (LGTM) message in the pull request to note that the commits are ready to merge.
57+
After one or more maintainer states LGTM, we will merge.
58+
If you have questions or comments on your code, feel free to correct these in your branch through new commits.
59+
60+
### Pull Request Guidelines
61+
62+
The goal of the following guidelines is to have Pull Requests (PRs) that are fairly easy to review and comprehend, and code that is easy to maintain in the future.
63+
64+
- **Pull Request title should respect [conventional commits](https://www.conventionalcommits.org/en/v1.0.0) specifications** and be clear on what is being changed.
65+
- A fix for local testing will be titled `fix(local-testing): ...`
66+
- A fix for http requests will be titled `fix(http): ...`
67+
68+
- **Keep it readable for human reviewers** and prefer a subset of functionality (code) with tests and documentation over delivering them separately
69+
70+
- **Notify Work In Progress PRs** by prefixing the title with `[WIP]`
71+
- **Please, keep us updated.**
72+
We will try our best to merge your PR, but please notice that PRs may be closed after 30 days of inactivity.
73+
74+
Your pull request should be rebased against the `main` branch.
75+
76+
Keep in mind only the **pull request title** will be used as the commit message as we stash all commits on merge.
77+
78+
## Community Guidelines
79+
80+
See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
81+
82+
Thank you for reading through all of this, if you have any questions feel free to [reach us](../README.md#💜-reach-us)!
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Set up poetry
2+
description: Install poetry and python dependencies
3+
inputs:
4+
groups:
5+
description: "Poetry dependencies groups."
6+
required: true
7+
python-version:
8+
description: "Python version."
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Load cached Poetry installation
14+
id: cached-poetry
15+
uses: actions/cache@v3
16+
with:
17+
path: ~/.local
18+
key: poetry-${{ inputs.python-version }}-v1
19+
20+
- name: Install Poetry
21+
uses: snok/install-poetry@v1
22+
with:
23+
virtualenvs-create: true
24+
virtualenvs-in-project: true
25+
if: steps.cached-poetry.outputs.cache-hit != 'true'
26+
27+
- name: Cache Poetry dependencies
28+
id: cache-poetry-deps
29+
uses: actions/cache@v3
30+
with:
31+
path: .venv
32+
key: venv-${{ inputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-${{ inputs.groups }}
33+
34+
- name: Install Poetry dependencies
35+
shell: bash
36+
run: poetry install --no-interaction --no-root --only main,${{ inputs.groups }}
37+
if: steps.cache-deps.outputs.cache-hit != 'true'

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: github-actions
5+
# Workflow files stored in the default location of `.github/workflows`
6+
directory: /
7+
schedule:
8+
interval: weekly
9+
- package-ecosystem: pip
10+
directory: /
11+
schedule:
12+
interval: weekly

.github/workflows/pytest.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: pytest
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
strategy:
16+
matrix:
17+
python-version: ['3.8', '3.9', '3.10', '3.11']
18+
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Set up python ${{ matrix.python-version }}
24+
id: setup-python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
29+
- name: Set up Poetry
30+
uses: ./.github/actions/setup-poetry
31+
with:
32+
groups: test
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Print versions
36+
run: |
37+
python --version
38+
poetry --version
39+
40+
- name: Test with pytest
41+
working-directory: tests
42+
run: poetry run pytest --junitxml=junit/test-results-${{ matrix.python-version
43+
}}.xml
44+
45+
- name: Upload pytest report
46+
uses: actions/upload-artifact@v3
47+
with:
48+
name: pytest-results-${{ matrix.python-version }}
49+
path: tests/junit/test-results-${{ matrix.python-version }}.xml
50+
retention-days: 3
51+
# Use always() to always run this step to publish test results when there are test failures
52+
if: ${{ always() }}

.github/workflows/python-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
3+
name: python-publish
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up python 3.11
19+
id: setup-python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.11'
23+
24+
- name: Set up Poetry
25+
uses: ./.github/actions/setup-poetry
26+
with:
27+
groups: '' # will only install the main group
28+
python-version: '3.11'
29+
30+
- name: Publish package
31+
run: poetry publish --build
32+
env:
33+
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
34+
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/report.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: report
3+
4+
on:
5+
workflow_run:
6+
workflows: [pytest]
7+
types: [completed]
8+
9+
permissions:
10+
checks: write
11+
12+
jobs:
13+
checks:
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- name: Download Test Report
17+
uses: dawidd6/action-download-artifact@v2
18+
with:
19+
name: junit-test-results
20+
workflow: ${{ github.event.workflow.id }}
21+
run_id: ${{ github.event.workflow_run.id }}
22+
23+
- name: Publish Test Report
24+
uses: mikepenz/action-junit-report@v3
25+
with:
26+
commit: ${{github.event.workflow_run.head_sha}}
27+
report_paths: tests/junit/test-results-*.xml

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Reference: https://github.com/github/gitignore/blob/main/Python.gitignore
2+
3+
# Byte-compiled / optimized / DLL files
4+
__pycache__/
5+
6+
# Distribution / packaging
7+
dist/
8+
9+
# Unit test / coverage reports
10+
.coverage
11+
.cache
12+
.pytest_cache/
13+
14+
# mypy
15+
.mypy_cache/

0 commit comments

Comments
 (0)