Skip to content

Commit

Permalink
reformatted
Browse files Browse the repository at this point in the history
  • Loading branch information
yibeichan committed Oct 19, 2024
1 parent 81b1d21 commit c854264
Show file tree
Hide file tree
Showing 18 changed files with 421 additions and 336 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ body:
description: Please, provide a clear and concise piece of information.
placeholder: Please, provide a clear and concise piece of information.
validations:
required: false
required: false
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Include any relevant screenshots.
## Checklist:
- [ ] My code follows the code style of this project.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
- [ ] All new and existing tests passed.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/basic.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Basic Pull Request Template

## Description
Briefly describe the changes you've made.
Briefly describe the changes you've made.
34 changes: 17 additions & 17 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
version: 2
updates:
# Configuration for Python package updates using pip
- package-ecosystem: pip
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 5
groups:
production-dependencies:
dependency-type: production
development-dependencies:
dependency-type: development
- package-ecosystem: pip
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 5
groups:
production-dependencies:
dependency-type: production
development-dependencies:
dependency-type: development

# Configuration for GitHub Actions updates
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 5
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
open-pull-requests-limit: 5

# Enable automatic security updates
security_updates: true
security_updates: true
16 changes: 8 additions & 8 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
python-version: ['3.10']
include:
- os: ubuntu-latest
python-version: "3.10"
deploy: true # Only deploy from this configuration
- os: ubuntu-latest
python-version: '3.10'
deploy: true # Only deploy from this configuration
outputs:
deploy: ${{ steps.set-deploy-output.outputs.deploy }}
steps:
Expand Down Expand Up @@ -66,11 +66,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest] # For demonstration, other OSes are commented out
python-version: ["3.10"]
python-version: ['3.10']
include:
- os: ubuntu-latest
python-version: "3.10"
deploy: true # Only deploy from this configuration
- os: ubuntu-latest
python-version: '3.10'
deploy: true # Only deploy from this configuration
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10"]
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -52,7 +52,3 @@ jobs:
POETRY_REQUESTS_TIMEOUT: 120
run: poetry publish
shell: bash




47 changes: 23 additions & 24 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Auto-release
on:
# ATM, this is the closest trigger to a PR merging
workflow_run:
workflows: ["Python Tests"]
workflows: [Python Tests]
branches: [main]
types: [completed]

Expand All @@ -16,31 +16,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Prepare repository
- name: Prepare repository
# Fetch full git history and tags
run: git fetch --unshallow --tags
run: git fetch --unshallow --tags

- name: Unset header
- name: Unset header
# checkout@v2 adds a header that makes branch protection report errors
# because the Github action bot is not a collaborator on the repo
run: git config --local --unset http.https://github.com/.extraheader

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Download auto
run: |
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/tags/$AUTO_VERSION | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')"
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto
- name: Create release
run: |
~/auto shipit -vv
env:
GH_TOKEN: ${{ secrets.AUTO_ORG_TOKEN }}

run: git config --local --unset http.https://github.com/.extraheader

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Download auto
run: |
auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/tags/$AUTO_VERSION | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')"
wget -O- "$auto_download_url" | gunzip > ~/auto
chmod a+x ~/auto
- name: Create release
run: |
~/auto shipit -vv
env:
GH_TOKEN: ${{ secrets.AUTO_ORG_TOKEN }}
14 changes: 7 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
- main
pull_request:
schedule:
- cron: '0 6 1 * *'
- cron: 0 6 1 * *

jobs:
unit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest] # For demonstration, other OSes are commented out: macos-latest, windows-latest
python-version: ["3.11", "3.10"]
python-version: ['3.11', '3.10']
steps:
- uses: actions/checkout@v4
with: # no need for the history
Expand All @@ -41,7 +41,7 @@ jobs:
${{ runner.os }}-poetry-
- name: Install dependencies with Poetry
run: |
poetry install --with dev
poetry install --with dev
shell: bash
- name: Run unit tests
id: run-tests
Expand All @@ -64,7 +64,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest] # For demonstration, other OSes are commented out: macos-latest, windows-latest
python-version: ["3.11", "3.10"]
python-version: ['3.11', '3.10']
steps:
- uses: actions/checkout@v4
with: # no need for the history
Expand All @@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest] # For demonstration, other OSes are commented out: macos-latest, windows-latest
python-version: ["3.11", "3.10"]
python-version: ['3.11', '3.10']
steps:
- uses: actions/checkout@v4
with: # no need for the history
Expand All @@ -103,8 +103,8 @@ jobs:
${{ runner.os }}-poetry-
- name: Install dependencies with Poetry
run: |
poetry install --with dev
poetry install --with dev
shell: bash
- name: Run mypy
run: poetry run mypy .
shell: bash
shell: bash
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ community include:
Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or
advances of any kind - Trolling, insulting or derogatory comments, and personal or political attacks
advances of any kind - Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
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.
SOFTWARE.
65 changes: 0 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,3 @@
# The Sensein's python package template repo

Welcome to the [Sensein](https://sensein.group/) python template repo!
This template is here to help you kick off your projects with a clean and efficient setup.
It's inspired by the [python template by the Child Mind Institute](https://github.com/childmindresearch/template-python-repository) (thanks you!). Our version diverges in its setup process and in both the variety and quantity of automated features included.

Just follow these steps, and you'll be on your way:
1. **Choose a unique package name:** First off, you need a cool name for your package. To make sure it's not already taken on PyPI, head over to `https://pypi.org/project/facetracker/`. If you get a "Not Found" page, you're likely good to go!

2. **Use this template:** Go to the GitHub page for this template. You'll find a "Use this template" button on the top right. Click it to start setting up your project with the template's structure.

3. **Configure your project:** During the setup, you'll specify some basics like your project's name and whether it's public or private. You will be able to change this info in the future, no pressure!

4. **Add GitHub Secrets:** For automated processes, add these secrets to your GitHub repo:

- `PYPI_TOKEN`: Your token for PyPI, allowing GitHub Actions to publish your package.
- `AUTO_ORG_TOKEN`: A token for automated organization actions (this is useful for using [auto](https://github.com/intuit/auto) for automatic changelog generation).
- `CODECOV_TOKEN`: Your [Codecov](https://about.codecov.io/) token for reporting code coverage.

To obtain these tokens:
- For `PYPI_TOKEN`, log in to your PyPI account, go to your account settings, and create an API token. Alternatively, ask the admin of your organization to do so.
- `AUTO_ORG_TOKEN` is a personal access token from GitHub, used for actions requiring organization-level permissions. Generate one in your GitHub settings under Developer settings > Personal access tokens. Alternatively, if the repo is under your organization GitHub, please, ask the admin of your organization to provide one.
- For `CODECOV_TOKEN`, sign up or log in to Codecov, add your repository, and you'll be provided with a token.

To add these tokens:
Go to your repository on GitHub, click on "Settings" > "Secrets" > "Actions", then click on "New repository secret". Name your secret (e.g., `PYPI_TOKEN`) and paste the token value. Repeat this for each token.

5. **Clone the repo:** Once your repository is set up, clone it to your local machine.

6. **Replace placeholders with custom values**: Please, run `python template_setup.py --package-name facetracker --package-repo-without-git-extension https://github.com/sensein/facetracker --github-nickname sensein --codecov-token 014fb51c-ea46-4f81-83e3-80dac272bef3 --email [email protected]`.
For example, `python template_setup.py --package-name pipepal --package-repo-without-git-extension https://github.com/fabiocat93/pipepal --github-nickname fabiocat93 --codecov-token IQR1RCYMAA --email [email protected]`. This will replace some placeholders in the entire directory (including folder names, file names, file content) with your custom info:
- facetracker (e.g., `pipepal`)
- https://github.com/sensein/facetracker (e.g., `https://github.com/sensein/pipepal`)
- sensein (e.g., `sensein`)
- 014fb51c-ea46-4f81-83e3-80dac272bef3 (e.g.,`ABC0DEFGHI`)
- [email protected] (e.g., `[email protected]`)
It will also enable GitHub custom automation and delete the `template_setup.py` (you won't need that anymore).

7. **Adjust `pyproject.toml`:** Please, double-check `pyproject.toml` and update it with some custom info, if needed (i.e., `description`, `authors`, `maintainers`, `description`, `homepage`, `repository`, `keywords`, and `classifiers`). No need to touch `version`. This will be automatically handled by the package.

8. **Update README.md:** Replace the content of this README.md with information specific to your project.

9. **Install poetry:** Poetry is a fantastic tool for managing dependencies and packaging. If you haven't installed it yet, check out their [documentation](https://python-poetry.org/docs/) for guidance. It's pretty straightforward.

10. **Verify poetry setup:** Run `poetry --help` to ensure everything is set up correctly. To verify that the project folder is all in order, you can run `poetry check`.

11. **Install dependencies:** Get all your project's dependencies in place by running `poetry install --with dev`.

12. **Secure your package name:** Even if you're not quite ready to publish, consider securing your package name on PyPI. You can do this by publishing a dummy version (0.0.1) of your package with `poetry publish --build`.

13. **Commit and push:** Now's the time to add (e.g., `git add .`) and commit (e.g., `git commit -m "here goes a wonderful message"`) your changes. Consider adding a tag for your initial version (recommended), like `git tag 0.0.1`, then push it all to GitHub with `git push --tags` and `git push origin main`.

14. **Check GitHub actions:** If your push was successful, it'll trigger some GitHub Actions like code quality checks and tests. Make sure everything passes!

15. **Work in dev branch:** For future changes, create a `dev` branch and make your updates there. Use pull requests to merge these changes into the main branch.

16. **Releasing new versions:** If you want to release a new version of your package, add a "release" label to your pull request. This will trigger all the necessary actions to update the version tag, create a changelog, release the new version, and even create/update your package documentation.

17. **Set up API documentation:** After your first successful pull request, set up your API documentation website. Go to your repository's settings, find the GitHub Pages section, and select `docs` as the source. You'll get a link to your API docs.

18. **[Bonus] Customize issue and pull request remplates:** Optionally, you can customize your issue and pull request remplates from the `.github` folder.

That's it! With these steps, you're well on your way to creating an awesome Python package. Keep up the great work, and **happy coding**!


# The ```facetracker``` repo

[![Build](https://github.com/sensein/facetracker/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/sensein/facetracker/actions/workflows/test.yaml?query=branch%3Amain)
Expand Down
2 changes: 1 addition & 1 deletion facetracker/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
""".. include:: ../../README.md""" # noqa: D415
""".. include:: ../../README.md""" # noqa: D415
Loading

0 comments on commit c854264

Please sign in to comment.