Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianFP committed Nov 25, 2023
0 parents commit 199e82d
Show file tree
Hide file tree
Showing 27 changed files with 684 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
# We run CI on pushes to the main branch
push:
branches:
- main
# and on all pull requests to the main branch
pull_request:
branches:
- main
# as well as upon manual triggers through the 'Actions' tab of the Github UI
workflow_dispatch:

jobs:
build-and-test:
name: Testing on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Here, we are testing the oldest and the newest supported Python version.
# If this is insufficient for your package, consider adding more versions.
python-version: ["3.8", "3.12"]

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
# setuptools_scm requires a non-shallow clone of the repository
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Python package
run: |
python -m pip install .[tests]
- name: Run Python tests
run: |
python -m pytest --nbval
coverage:
name: Coverage Testing
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install Python package
run: |
python -m pip install .[tests]
- name: Run Python tests
working-directory: ./tests
run: |
python -m pytest --cov --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: ./tests/coverage.xml
29 changes: 29 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PyPI deploy

on:
release:
types:
- published
workflow_dispatch:

jobs:
pypi-deploy:
name: Deploying Python Package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
# setuptools_scm requires a non-shallow clone of the repository
fetch-depth: 0

- uses: actions/setup-python@v4
name: Install Python

- name: Build SDist
run: pipx run build --sdist

- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
141 changes: 141 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Ignore setuptools_scm generated version file
project_W/_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
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/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .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
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

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

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
16 changes: 16 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2

build:
os: ubuntu-20.04
tools:
python: "3.9"

sphinx:
configuration: doc/conf.py

formats: all

python:
install:
- method: pip
path: .[docs]
6 changes: 6 additions & 0 deletions COPYING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This is the list of copyright holders of project W.

For information on the license, see LICENSE.md.


* Julian Partanen, 2023
44 changes: 44 additions & 0 deletions FILESTRUCTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
This is an explanation of the file structure that the cookiecutter generated for you:

* Python source files:
* The Python package source files are located in the `project_W` directory.
* The file `project_W.__main__.py` defines a command line interface that
is accessible both as the command `project_W` and via
`python -m project_W`.
* `tests/test_cli.py` contains rudimentary testing of this CLI.
* `tests/test_project_W.py` contains the unit tests for the package.
* `tests/conftest.py` contains testing setup and configuration for `pytest`
* The `notebooks` directory contains an example Jupyter notebook on how to use `project_W`.
This notebook is always executed during `pytest` execution and it is automatically
rendered into the Sphinx documentation.
* Markdown files with meta information on the project. [Markdown](https://www.markdownguide.org/basic-syntax/) is
a good language for these files, as it is easy to write and rendered into something beautiful by your git repository
hosting provider.
* `README.md` is the file that users will typically see first when discovering your project.
* `COPYING.md` provides a list of copyright holders.
* `LICENSE.md` contains the license you selected.
* `TODO.md` contains a list of TODOs after running the cookiecutter. Following the
instructions in that file will give you a fully functional repository with a lot
of integration into useful web services activated and running.
* `FILESTRUCTURE.md` describes the generated files. Feel free to remove this from the
repository if you do not need it.
* Python build system files
* `pyproject.toml` is the central place for configuration of your Python package.
It contains the project metadata, setuptools-specific information and the configuration
for your toolchain (like e.g. `pytest`).
* `setup.py` is still required for editable builds, but you should not need to change it.
In the future, `setuptools` will support editable builds purely from `pyproject.toml`
configuration.
* Configuration for CI/Code Analysis and documentation services
* `.github/workflows/ci.yml` describes the Github Workflow for Continuous
integration. For further reading on workflow files, we recommend the
[introduction into Github Actions](https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/introduction-to-github-actions)
and [the reference of available options](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions).
* `.github/dependabot.yml` configures the DependaBot integration on GitHub that
allows you to automatically create pull requests for updates of the used actions
in `.github/workflows/ci.yml`.
* `.gitlab-ci.yml` describes the configuration for Gitlab CI. For further
reading, we recommend [Gitlabs quick start guide](https://docs.gitlab.com/ee/ci/quick_start/)
and the [Gitlab CI configuration reference](https://docs.gitlab.com/ce/ci/yaml/)
* `.readthedocs.yml` configures the documentation build process at [ReadTheDocs](https://readthedocs.org).
To customize your build, you can have a look at the [available options](https://docs.readthedocs.io/en/stable/config-file/v2.html).
11 changes: 11 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Copyright 2023, The copyright holders according to COPYING.md


Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 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.



35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Welcome to project W

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/JulianFP/project-W/ci.yml?branch=main)](https://github.com/JulianFP/project-W/actions/workflows/ci.yml)
[![Documentation Status](https://readthedocs.org/projects/project-W/badge/)](https://project-W.readthedocs.io/)
[![codecov](https://codecov.io/gh/JulianFP/project-W/branch/main/graph/badge.svg)](https://codecov.io/gh/JulianFP/project-W)

## Installation

The Python package `project_W` can be installed from PyPI:

```
python -m pip install project_W
```

## Development installation

If you want to contribute to the development of `project_W`, we recommend
the following editable installation from this repository:

```
git clone [email protected]:JulianFP/project-W.git
cd project-W
python -m pip install --editable .[tests]
```

Having done so, the test suite can be run using `pytest`:

```
python -m pytest
```

## Acknowledgments

This repository was set up using the [SSC Cookiecutter for Python Packages](https://github.com/ssciwr/cookiecutter-python-package).
15 changes: 15 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
This TODO list is automatically generated from the cookiecutter-python-project template.
The following tasks need to be done to get a fully working project:

* Push to your remote repository for the first time by doing `git push origin main`.
* Add the secret variable `PYPI_API_TOKEN` to your GitHub project. This can be done in your
use settings at `https://pypi.org`. Note that currently, you have to create an unscoped token
for your first upload and only after that you can create a new token whose scope is restricted
to the current project.
* Enable the integration of Readthedocs with your Git hoster. In the case of Github, this means
that you need to login at [Read the Docs](https://readthedocs.org) and click the button
*Import a Project*.
* Enable the integration with `codecov.io` by heading to the [Codecov.io Website](https://codecov.io),
log in (e.g. with your Github credentials) and enable integration for your repository. This will
allow you to have automatic coverage reports on pull requests, but is not necessary to display
the coverage badge in the README.
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

ignore:
- "**/tests"
Loading

0 comments on commit 199e82d

Please sign in to comment.