Skip to content

Commit eb35c12

Browse files
Omer ShafiqOmer Shafiq
authored andcommitted
inital push
0 parents  commit eb35c12

File tree

12 files changed

+373
-0
lines changed

12 files changed

+373
-0
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to
2+
# help make automated releases for this project
3+
4+
name: Release
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build-and-publish:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
# IMPORTANT: this permission is mandatory for trusted publishing
16+
id-token: write
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
- name: Set up Python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: '3.x'
24+
- name: Install build dependencies
25+
run: python -m pip install -U setuptools wheel build
26+
- name: Build
27+
run: python -m build .
28+
- name: Publish
29+
uses: pypa/gh-action-pypi-publish@release/v1
30+
with:
31+
skip-existing: true

.github/workflows/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to
2+
# help test this project
3+
4+
name: Test
5+
6+
on: [push, pull_request]
7+
8+
jobs:
9+
test:
10+
strategy:
11+
matrix:
12+
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
13+
platform: [ubuntu-latest, macos-latest, windows-latest]
14+
runs-on: ${{ matrix.platform }}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Set up Python ${{ matrix.python }}
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python }}
22+
- name: Install test dependencies
23+
run: python -m pip install --upgrade nox
24+
- name: Test
25+
run: python -m nox -s tests-${{ matrix.python }}
26+
- name: Lint
27+
run: python -m nox -s lint

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# general things to ignore
2+
build/
3+
dist/
4+
*.egg-info/
5+
*.egg
6+
*.py[cod]
7+
__pycache__/
8+
*.so
9+
*~
10+
venv/
11+
12+
# due to using nox and pytest
13+
.nox
14+
.cache

LICENSE.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2016 The Python Packaging Authority (PyPA)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7+
of the Software, and to permit persons to whom the Software is furnished to do
8+
so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# A sample Python project
2+
3+
![Python Logo](https://www.python.org/static/community_logos/python-logo.png "Sample inline image")
4+
5+
A sample project that exists as an aid to the [Python Packaging User
6+
Guide][packaging guide]'s [Tutorial on Packaging and Distributing
7+
Projects][distribution tutorial].
8+
9+
This project does not aim to cover best practices for Python project
10+
development as a whole. For example, it does not provide guidance or tool
11+
recommendations for version control, documentation, or testing.
12+
13+
[The source for this project is available here][src].
14+
15+
The metadata for a Python project is defined in the `pyproject.toml` file,
16+
an example of which is included in this project. You should edit this file
17+
accordingly to adapt this sample project to your needs.
18+
19+
----
20+
21+
This is the README file for the project.
22+
23+
The file should use UTF-8 encoding and can be written using
24+
[reStructuredText][rst] or [markdown][md use] with the appropriate [key set][md
25+
use]. It will be used to generate the project webpage on PyPI and will be
26+
displayed as the project homepage on common code-hosting services, and should be
27+
written for that purpose.
28+
29+
Typical contents for this file would include an overview of the project, basic
30+
usage examples, etc. Generally, including the project changelog in here is not a
31+
good idea, although a simple “What's New” section for the most recent version
32+
may be appropriate.
33+
34+
[packaging guide]: https://packaging.python.org
35+
[distribution tutorial]: https://packaging.python.org/tutorials/packaging-projects/
36+
[src]: https://github.com/pypa/sampleproject
37+
[rst]: http://docutils.sourceforge.net/rst.html
38+
[md]: https://tools.ietf.org/html/rfc7764#section-3.5 "CommonMark variant"
39+
[md use]: https://packaging.python.org/specifications/core-metadata/#description-content-type-optional

noxfile.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# this file is *not* meant to cover or endorse the use of nox or pytest or
2+
# testing in general,
3+
#
4+
# It's meant to show the use of:
5+
#
6+
# - check-manifest
7+
# confirm items checked into vcs are in your sdist
8+
# - readme_renderer (when using a reStructuredText README)
9+
# confirms your long_description will render correctly on PyPI.
10+
#
11+
# and also to help confirm pull requests to this project.
12+
13+
import os
14+
15+
import nox
16+
17+
nox.options.sessions = ["lint"]
18+
19+
# Define the minimal nox version required to run
20+
nox.options.needs_version = ">= 2024.3.2"
21+
22+
23+
@nox.session
24+
def lint(session):
25+
session.install("flake8")
26+
session.run(
27+
"flake8", "--exclude", ".nox,*.egg,build,data",
28+
"--select", "E,W,F", "."
29+
)
30+
31+
32+
@nox.session
33+
def build_and_check_dists(session):
34+
session.install("build", "check-manifest >= 0.42", "twine")
35+
# If your project uses README.rst, uncomment the following:
36+
# session.install("readme_renderer")
37+
38+
session.run("check-manifest", "--ignore", "noxfile.py,tests/**")
39+
session.run("python", "-m", "build")
40+
session.run("python", "-m", "twine", "check", "dist/*")
41+
42+
43+
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"])
44+
def tests(session):
45+
session.install("pytest")
46+
build_and_check_dists(session)
47+
48+
generated_files = os.listdir("dist/")
49+
generated_sdist = os.path.join("dist/", generated_files[1])
50+
51+
session.install(generated_sdist)
52+
53+
session.run("py.test", "tests/", *session.posargs)

pyproject.toml

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Guide (user-friendly):
2+
# https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
3+
4+
# Specification (technical, formal):
5+
# https://packaging.python.org/en/latest/specifications/pyproject-toml/
6+
7+
8+
# Choosing a build backend:
9+
# https://packaging.python.org/en/latest/tutorials/packaging-projects/#choosing-a-build-backend
10+
[build-system]
11+
# A list of packages that are needed to build your package:
12+
requires = ["setuptools"] # REQUIRED if [build-system] table is used
13+
# The name of the Python object that frontends will use to perform the build:
14+
build-backend = "setuptools.build_meta" # If not defined, then legacy behavior can happen.
15+
16+
17+
[project]
18+
# This is the name of your project. The first time you publish this
19+
# package, this name will be registered for you. It will determine how
20+
# users can install this project, e.g.:
21+
#
22+
# $ pip install sunflowerproject
23+
#
24+
# And where it will live on PyPI: https://pypi.org/project/sunflowerproject/
25+
#
26+
# There are some restrictions on what makes a valid project name
27+
# specification here:
28+
# https://packaging.python.org/specifications/core-metadata/#name
29+
name = "sunflowerproject" # REQUIRED, is the only field that cannot be marked as dynamic.
30+
31+
# Versions should comply with PEP 440:
32+
# https://www.python.org/dev/peps/pep-0440/
33+
#
34+
# For a discussion on single-sourcing the version, see
35+
# https://packaging.python.org/guides/single-sourcing-package-version/
36+
version = "4.0.0" # REQUIRED, although can be dynamic
37+
38+
# This is a one-line description or tagline of what your project does. This
39+
# corresponds to the "Summary" metadata field:
40+
# https://packaging.python.org/specifications/core-metadata/#summary
41+
description = "A sunflower Python project"
42+
43+
# This is an optional longer description of your project that represents
44+
# the body of text which users will see when they visit PyPI.
45+
#
46+
# Often, this is the same as your README, so you can just read it in from
47+
# that file directly.
48+
#
49+
# This field corresponds to the "Description" metadata field:
50+
# https://packaging.python.org/specifications/core-metadata/#description-optional
51+
readme = "README.md"
52+
53+
# Specify which Python versions you support. In contrast to the
54+
# 'Programming Language' classifiers in this file, 'pip install' will check this
55+
# and refuse to install the project if the version does not match. See
56+
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
57+
requires-python = ">=3.9"
58+
59+
# This is either text indicating the license for the distribution, or a file
60+
# that contains the license.
61+
# https://packaging.python.org/en/latest/specifications/core-metadata/#license
62+
license = { file = "LICENSE.txt" }
63+
64+
# This field adds keywords for your project which will appear on the
65+
# project page. What does your project relate to?
66+
#
67+
# Note that this is a list of additional keywords, separated
68+
# by commas, to be used to assist searching for the distribution in a
69+
# larger catalog.
70+
keywords = ["sunflower", "setuptools", "development"]
71+
72+
# This should be your name or the name of the organization who originally
73+
# authored the project, and a valid email address corresponding to the name
74+
# listed.
75+
authors = [{ name = "A. Random Developer", email = "author@example.com" }]
76+
77+
# This should be your name or the names of the organization who currently
78+
# maintains the project, and a valid email address corresponding to the name
79+
# listed.
80+
maintainers = [
81+
{ name = "A. Great Maintainer", email = "maintainer@example.com" },
82+
]
83+
84+
# Classifiers help users find your project by categorizing it.
85+
#
86+
# For a list of valid classifiers, see https://pypi.org/classifiers/
87+
classifiers = [
88+
# How mature is this project? Common values are
89+
# 3 - Alpha
90+
# 4 - Beta
91+
# 5 - Production/Stable
92+
"Development Status :: 3 - Alpha",
93+
94+
# Indicate who your project is intended for
95+
"Intended Audience :: Developers",
96+
"Topic :: Software Development :: Build Tools",
97+
98+
# Pick your license as you wish
99+
"License :: OSI Approved :: MIT License",
100+
101+
# Specify the Python versions you support here. In particular, ensure
102+
# that you indicate you support Python 3. These classifiers are *not*
103+
# checked by "pip install". See instead "requires-python" key in this file.
104+
"Programming Language :: Python :: 3",
105+
"Programming Language :: Python :: 3.9",
106+
"Programming Language :: Python :: 3.10",
107+
"Programming Language :: Python :: 3.11",
108+
"Programming Language :: Python :: 3.12",
109+
"Programming Language :: Python :: 3.13",
110+
"Programming Language :: Python :: 3 :: Only",
111+
]
112+
113+
# This field lists other packages that your project depends on to run.
114+
# Any package you put here will be installed by pip when your project is
115+
# installed, so they must be valid existing projects.
116+
#
117+
# For an analysis of this field vs pip's requirements files see:
118+
# https://packaging.python.org/discussions/install-requires-vs-requirements/
119+
dependencies = ["peppercorn"]
120+
121+
# List additional groups of dependencies here (e.g. development
122+
# dependencies). Users will be able to install these using the "extras"
123+
# syntax, for example:
124+
#
125+
# $ pip install sunflowerproject[dev]
126+
#
127+
# Optional dependencies the project provides. These are commonly
128+
# referred to as "extras". For a more extensive definition see:
129+
# https://packaging.python.org/en/latest/specifications/dependency-specifiers/#extras
130+
[project.optional-dependencies]
131+
dev = ["check-manifest"]
132+
test = ["coverage"]
133+
134+
# List URLs that are relevant to your project
135+
#
136+
# This field corresponds to the "Project-URL" and "Home-Page" metadata fields:
137+
# https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
138+
# https://packaging.python.org/specifications/core-metadata/#home-page-optional
139+
#
140+
# Examples listed include a pattern for specifying where the package tracks
141+
# issues, where the source is hosted, where to say thanks to the package
142+
# maintainers, and where to support the project financially. The key is
143+
# what's used to render the link text on PyPI.
144+
[project.urls]
145+
"Homepage" = "https://github.com/pypa/sunflowerproject"
146+
"Bug Reports" = "https://github.com/pypa/sunflowerproject/issues"
147+
"Funding" = "https://donate.pypi.org"
148+
"Say Thanks!" = "http://saythanks.io/to/example"
149+
"Source" = "https://github.com/pypa/sunflowerproject/"
150+
151+
# The following would provide a command line executable called `sunflower`
152+
# which executes the function `main` from this package when invoked.
153+
[project.scripts]
154+
sunflower = "sunflower:main"
155+
156+
157+
# This is configuration specific to the `setuptools` build backend.
158+
# If you are using a different build backend, you will need to change this.
159+
[tool.setuptools]
160+
# If there are data files included in your packages that need to be
161+
# installed, specify them here.
162+
package-data = { "sunflower" = ["*.dat"] }

src/flower/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def main():
2+
"""Entry point for the application script"""
3+
print("Call your main application code here")

src/flower/package_data.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
some data

src/flower/sunflower.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def add_one(number):
2+
return number + 1
3+
4+
def bloom():
5+
return "🌻"

0 commit comments

Comments
 (0)