-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
454 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
|
||
on: [push, pull_request] | ||
jobs: | ||
tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- { python: "3.11", os: ubuntu-latest, check: "tests-3.11" } | ||
- { python: "3.12", os: ubuntu-latest, check: "tests-3.12" } | ||
- { python: "3.12", os: ubuntu-latest, check: "lint" } | ||
- { python: "3.12", os: ubuntu-latest, check: "docs" } | ||
- { python: "3.12", os: ubuntu-latest, check: "mypy" } | ||
- { python: "3.12", os: ubuntu-latest, check: "build" } | ||
name: ${{ matrix.check }} on Python ${{ matrix.python }} (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3.0.2 | ||
|
||
- name: Set up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v4.0.0 | ||
with: | ||
python-version: "${{ matrix.python }}" | ||
|
||
- name: Upgrade pip | ||
run: | | ||
pip install --upgrade pip | ||
pip --version | ||
- name: Install Nox | ||
run: | | ||
pip install nox | ||
nox --version | ||
- name: Run Nox | ||
run: | | ||
nox --force-color --python=${{ matrix.python }} --session=${{ matrix.check }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- trunk | ||
|
||
permissions: # added using https://github.com/step-security/secure-workflows | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
|
||
- uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b | ||
with: | ||
python-version: "3.x" | ||
cache: "pip" | ||
cache-dependency-path: pyproject.toml | ||
|
||
- name: deps | ||
run: python -m pip install -U build | ||
|
||
- name: env | ||
run: env | ||
|
||
- name: build | ||
run: python -m build | ||
|
||
- name: Upload built packages | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: built-packages | ||
path: ./dist/ | ||
if-no-files-found: warn | ||
|
||
release-pypi: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Used to authenticate to PyPI via OIDC. | ||
id-token: write | ||
steps: | ||
- name: Download artifacts directories # goes to current working directory | ||
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | ||
|
||
- name: publish | ||
uses: pypa/gh-action-pypi-publish@0bf742be3ebe032c25dd15117957dc15d0cfc38d | ||
with: | ||
packages_dir: built-packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.ipynb_checkpoints | ||
*.egg-info | ||
__pycache__ | ||
/dist | ||
/build | ||
/git-log-head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
silly_pyproject_name | ||
======================== | ||
|
||
Stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
API Reference | ||
============= | ||
|
||
.. automodule:: silly_pyproject_name | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extensions = [ | ||
'sphinx.ext.autodoc', | ||
'sphinx.ext.viewcode', | ||
] | ||
master_doc = 'index' | ||
project = 'silly_pyproject_name' | ||
copyright = 'Copyright (c) Moshe Zadka' | ||
author = 'Moshe Zadka' | ||
version = '' | ||
|
||
exclude_patterns = ['.ipynb_checkpoints/**'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
silly_pyproject_name | ||
================ | ||
|
||
|
||
CLI tools for manipulating Python project's name. Example for Gather. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
quick-start | ||
api-reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Getting Started with silly_pyproject_name | ||
===================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import functools | ||
import os | ||
|
||
import nox | ||
|
||
nox.options.envdir = "build/nox" | ||
nox.options.sessions = ["lint", "tests", "mypy", "docs", "build"] | ||
|
||
VERSIONS = ["3.11", "3.12"] | ||
|
||
|
||
@nox.session(python=VERSIONS) | ||
def tests(session): | ||
tmpdir = session.create_tmp() | ||
session.install("-r", "requirements-tests.txt") | ||
session.install("-e", ".") | ||
tests = session.posargs or ["silly_pyproject_name.tests"] | ||
session.run( | ||
"coverage", | ||
"run", | ||
"--branch", | ||
"--source=silly_pyproject_name", | ||
"--omit=**/__main__.py", | ||
"-m", | ||
"virtue", | ||
*tests, | ||
env=dict(COVERAGE_FILE=os.path.join(tmpdir, "coverage"), TMPDIR=tmpdir), | ||
) | ||
fail_under = "--fail-under=100" | ||
session.run( | ||
"coverage", | ||
"report", | ||
fail_under, | ||
"--show-missing", | ||
"--skip-covered", | ||
env=dict(COVERAGE_FILE=os.path.join(tmpdir, "coverage")), | ||
) | ||
|
||
|
||
@nox.session(python=VERSIONS[-1]) | ||
def build(session): | ||
session.install("build") | ||
session.run("python", "-m", "build", "--wheel") | ||
|
||
|
||
@nox.session(python=VERSIONS[-1]) | ||
def lint(session): | ||
files = ["src/", "noxfile.py"] | ||
session.install("-r", "requirements-lint.txt") | ||
session.install("-e", ".") | ||
session.run("black", "--check", "--diff", *files) | ||
black_compat = ["--max-line-length=88", "--ignore=E203,E503"] | ||
session.run("flake8", *black_compat, "src/") | ||
|
||
|
||
@nox.session(python=VERSIONS[-1]) | ||
def mypy(session): | ||
session.install("-r", "requirements-mypy.txt") | ||
session.install("-e", ".") | ||
session.run( | ||
"mypy", | ||
"--warn-unused-ignores", | ||
"--ignore-missing-imports", | ||
"src/", | ||
) | ||
|
||
|
||
@nox.session(python=VERSIONS[-1]) | ||
def docs(session): | ||
"""Build the documentation.""" | ||
output_dir = os.path.abspath(os.path.join(session.create_tmp(), "output")) | ||
doctrees, html = map( | ||
functools.partial(os.path.join, output_dir), ["doctrees", "html"] | ||
) | ||
session.run("rm", "-rf", output_dir, external=True) | ||
session.install("-r", "requirements-docs.txt") | ||
session.install("-e", ".") | ||
sphinx = ["sphinx-build", "-b", "html", "-W", "-d", doctrees, ".", html] | ||
session.cd("doc") | ||
session.run(*sphinx) | ||
|
||
|
||
@nox.session(python=VERSIONS[-1]) | ||
def refresh_deps(session): | ||
"""Refresh the requirements-*.txt files""" | ||
session.install("pip-tools") | ||
for deps in ["tests", "docs", "lint", "mypy"]: | ||
session.run( | ||
"pip-compile", | ||
"--extra", | ||
deps, | ||
"pyproject.toml", | ||
"--output-file", | ||
f"requirements-{deps}.txt", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[build-system] | ||
requires = [ | ||
"setuptools", | ||
"autocalver", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "silly_pyproject_name" | ||
dynamic = ["version"] | ||
description = "CLI tools for manipulating Python project's name. Example for Gather." | ||
readme = "README.rst" | ||
authors = [{name = "Moshe Zadka", email = "moshez@zadka.club"}] | ||
|
||
[project.optional-dependencies] | ||
tests = ["virtue", "pyhamcrest", "coverage"] | ||
mypy = ["mypy"] | ||
lint = ["flake8", "black"] | ||
docs = ["sphinx"] | ||
|
||
[project.license] | ||
text = """ | ||
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. | ||
""" | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/elcaminoreal/silly_pyproject_name" | ||
|
||
[tool.autocalver] | ||
use = true | ||
log = "git-log-head" | ||
log_command = "git log -n 1 --date=iso" | ||
is_main_var = "GITHUB_REF" | ||
is_main_match = ".*/trunk$" | ||
|
||
[project.entry-points.gather] | ||
placeholder = "silly_pyproject_name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.12 | ||
# by the following command: | ||
# | ||
# pip-compile --output-file=- - | ||
# | ||
alabaster==0.7.16 | ||
# via sphinx | ||
babel==2.14.0 | ||
# via sphinx | ||
certifi==2023.11.17 | ||
# via requests | ||
charset-normalizer==3.3.2 | ||
# via requests | ||
docutils==0.20.1 | ||
# via sphinx | ||
idna==3.6 | ||
# via requests | ||
imagesize==1.4.1 | ||
# via sphinx | ||
jinja2==3.1.3 | ||
# via sphinx | ||
markupsafe==2.1.3 | ||
# via jinja2 | ||
packaging==23.2 | ||
# via sphinx | ||
pygments==2.17.2 | ||
# via sphinx | ||
requests==2.31.0 | ||
# via sphinx | ||
snowballstemmer==2.2.0 | ||
# via sphinx | ||
sphinx==7.2.6 | ||
# via -r - | ||
sphinxcontrib-applehelp==1.0.8 | ||
# via sphinx | ||
sphinxcontrib-devhelp==1.0.6 | ||
# via sphinx | ||
sphinxcontrib-htmlhelp==2.0.5 | ||
# via sphinx | ||
sphinxcontrib-jsmath==1.0.1 | ||
# via sphinx | ||
sphinxcontrib-qthelp==1.0.7 | ||
# via sphinx | ||
sphinxcontrib-serializinghtml==1.1.10 | ||
# via sphinx | ||
urllib3==2.1.0 | ||
# via requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.12 | ||
# by the following command: | ||
# | ||
# pip-compile --output-file=- - | ||
# | ||
black==23.12.1 | ||
# via -r - | ||
click==8.1.7 | ||
# via black | ||
flake8==7.0.0 | ||
# via -r - | ||
mccabe==0.7.0 | ||
# via flake8 | ||
mypy-extensions==1.0.0 | ||
# via black | ||
packaging==23.2 | ||
# via black | ||
pathspec==0.12.1 | ||
# via black | ||
platformdirs==4.1.0 | ||
# via black | ||
pycodestyle==2.11.1 | ||
# via flake8 | ||
pyflakes==3.2.0 | ||
# via flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.12 | ||
# by the following command: | ||
# | ||
# pip-compile --output-file=- - | ||
# | ||
mypy==1.8.0 | ||
# via -r - | ||
mypy-extensions==1.0.0 | ||
# via mypy | ||
typing-extensions==4.9.0 | ||
# via mypy |
Oops, something went wrong.