Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream changes, use src layout #40

Merged
merged 67 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3111800
Show how to use lint & test rules instead of pytest or flake8 commands
Sep 16, 2019
dcf9b1f
Import the latest 'contributor covenant', in rst
Sep 16, 2019
56cafcc
Reference the code of conduct in the contribution guidelines
Sep 16, 2019
4bdcdf2
Fix typo
Sep 16, 2019
969512f
Keep Dask fragments out of commits
accurrently Feb 19, 2020
be32cfd
Upgrade all dev requirements
audreyfeldroy Apr 5, 2024
d4d4508
Update Python version requirement and package URL
audreyfeldroy Apr 6, 2024
e685256
Refactor package setup instructions
audreyfeldroy Apr 6, 2024
4027334
Move note about venv gitignore
audreyfeldroy Apr 6, 2024
5d1cf52
Add Discord link to README
audreyfeldroy Apr 6, 2024
0b4be7b
Initial working pyproject.toml addition
pydanny Apr 6, 2024
44f31b0
Merge pull request #716 from audreyfeldroy/initial-pyproject.toml
pydanny Apr 6, 2024
6e9dbca
Update sphinx from 1.8.5 to 7.2.6
pyup-bot Apr 6, 2024
08946a0
Update twine from 1.14.0 to 5.0.0
pyup-bot Apr 6, 2024
88d011c
Improve the Makefile
pydanny Apr 6, 2024
6320869
Merge pull request #522 from apehex/document-the-make-rules-instead-o…
pydanny Apr 6, 2024
79a70b4
Merge pull request #520 from apehex/add-a-code-of-conduct
pydanny Apr 6, 2024
255bcf6
- adapted to src structure... moved to pathlib
franzhaas Apr 6, 2024
755b6b5
For #706, this replaces click with typer
pydanny Apr 6, 2024
d62ce5b
Create python-publish.yml
FrancisBilla Apr 6, 2024
5886204
Merge pull request #1 from FrancisBilla/FrancisBilla-patch-1
FrancisBilla Apr 6, 2024
ef7fe33
- using mulitple args instead of / to combine files to paths
franzhaas Apr 6, 2024
2e2f52b
Add missing space after -r
PovilasKud Apr 6, 2024
a5cf681
Fine tune CLI component
pydanny Apr 6, 2024
c7bcfdf
fix #715: Get tests running + remove obsolete Argparse tests
SampleText2k77 Apr 6, 2024
c9043b9
Merge pull request #727 from audreyfeldroy/improve-makefile
Enrikaa Apr 6, 2024
1d36a16
Merge pull request #730 from PovilasKud/fix_missing_space
Enrikaa Apr 6, 2024
61d8c33
Merge pull request #732 from SampleText2k77/fix-tests
audreyfeldroy Apr 6, 2024
56f3002
Merge pull request #729 from franzhaas/master
pydanny Apr 6, 2024
abb96e2
Adding ruff support for the repo and in the generated python package
ArjunDandagi Apr 6, 2024
72c5deb
Adding ruff support for the repo and in the generated python package
ArjunDandagi Apr 6, 2024
45155fa
Merge pull request #733 from ArjunDandagi/ruff-for-linting-and-format…
ArjunDandagi Apr 6, 2024
27ced9f
Migrate to Github Actions #707
FrancisBilla Apr 6, 2024
71cf641
Add missing package data
pydanny Apr 6, 2024
cfda64a
Migrate to Github Actions #707
FrancisBilla Apr 6, 2024
2e70b14
Merge branch 'audreyfeldroy:master' into HPPK-707-Migrate-CI-to-Githu…
FrancisBilla Apr 6, 2024
4bbb716
Merge pull request #736 from audreyfeldroy/add-missing-package-data
pydanny Apr 6, 2024
d032573
Merge pull request #731 from audreyfeldroy/add-typer-for-cli
pydanny Apr 6, 2024
972864a
Merge branch 'master' into patch-1
pydanny Apr 6, 2024
545b492
Merge pull request #571 from accurrently/patch-1
pydanny Apr 6, 2024
bc7d1b7
Migrate to Github Actions #707
FrancisBilla Apr 6, 2024
e886299
Merge branch 'audreyfeldroy:master' into master
FrancisBilla Apr 6, 2024
4d282fa
Merge remote-tracking branch 'origin/master' into HPPK-707-Migrate-CI…
FrancisBilla Apr 6, 2024
5aceadb
Merge branch 'HPPK-707-Migrate-CI-to-GithubActions' of https://github…
FrancisBilla Apr 6, 2024
4ca3d5b
Update .github/workflows/build-pipeline.yml
audreyfeldroy Apr 6, 2024
77e60ef
Merge pull request #734 from FrancisBilla/HPPK-707-Migrate-CI-to-Gith…
audreyfeldroy Apr 6, 2024
f9285ef
Merge branch 'master' into pyup-update-twine-1.14.0-to-5.0.0
ArjunDandagi Apr 7, 2024
c50d542
fix command error
ArjunDandagi Apr 7, 2024
1f7f8ea
Merge pull request #726 from audreyfeldroy/pyup-update-twine-1.14.0-t…
ArjunDandagi Apr 7, 2024
2254ea0
Merge branch 'master' into pyup-update-sphinx-1.8.5-to-7.2.6
ArjunDandagi Apr 7, 2024
47f3d4d
Merge pull request #725 from audreyfeldroy/pyup-update-sphinx-1.8.5-t…
ArjunDandagi Apr 7, 2024
845b8b5
remove-black-references-in-makefile
ArjunDandagi Apr 9, 2024
301ecea
Merge pull request #739 from audreyfeldroy/remove-black-references-in…
ArjunDandagi Apr 9, 2024
16c0220
Merge branch 'refs/heads/upstream-master' into upstream
Zeitsperre May 6, 2024
5ad91df
merge upstream changes to fork, use flat layout
Zeitsperre May 6, 2024
e294d1d
re-add twine
Zeitsperre May 6, 2024
e125dac
lower alabaster pin
Zeitsperre May 6, 2024
3ed3850
lower pre-commit pin
Zeitsperre May 6, 2024
56cde86
lower pre-commit pin
Zeitsperre May 6, 2024
5d4cd7d
lower cookiecutter-pypackage minversion
Zeitsperre May 7, 2024
9f06cab
adjust test
Zeitsperre May 7, 2024
e7bfb5f
remove redundant workflow
Zeitsperre May 7, 2024
e1161ce
install within test
Zeitsperre May 7, 2024
c5c25c9
editable install
Zeitsperre May 7, 2024
e06bd10
skip a test if not running in tox
Zeitsperre May 7, 2024
197f912
fix test
Zeitsperre May 7, 2024
2f8f0f6
remove shlex
Zeitsperre May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: pip install tox
run: |
python -m pip install tox
- name: Run bake test suite
run: tox -e ${{ matrix.tox-env }}
run:
python -m tox -e ${{ matrix.tox-env }}
- name: Archive package
if: ${{ matrix.tox-env == 'py39' }}
uses: actions/upload-artifact@v2
with:
name: cookie-cutter
path: src/dist
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Ready to contribute? Here's how to set up `cookiecutter-pypackage` for local dev

.. code-block:: bash

$ pip install -rrequirements_dev.txt
$ pip install -r requirements_dev.txt
$ pytest ./tests

If you get any errors while installing cryptography package (something like `#include <openssl/aes.h>`). Please update your pip version and try again:
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
BAKE_OPTIONS=--no-input

help:
@echo "bake generate project using defaults"
@echo "watch generate project using defaults and watch for changes"
@echo "replay replay last cookiecutter run and watch for changes"
@echo "bake Generate project using defaults"
@echo "help Show this help"
@echo "test Run the tests"
@echo "replay Replay last cookiecutter run and watch for changes"
@echo "watch Generate project using defaults and watch for changes"


bake:
bake: # Generate project using defaults
cookiecutter $(BAKE_OPTIONS) . --overwrite-if-exists

watch: bake
Expand All @@ -14,3 +17,6 @@ watch: bake
replay: BAKE_OPTIONS=--replay
replay: watch
;

test:
pytest
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Cookiecutter_ template for a Python package.
* GitHub repo (fork): https://github.com/Ouranosinc/cookiecutter-pypackage/
* Documentation (upstream): https://cookiecutter-pypackage.readthedocs.io/
* Free software: BSD license
* Discord: https://discord.gg/PWXJr3upUE

Features
--------
Expand Down
5 changes: 3 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"add_pyup_badge": "n",
"make_docs": "y",
"add_translations": "y",
"command_line_interface": ["Click", "Argparse", "No command-line interface"],
"command_line_interface": ["Typer", "Click", "Argparse", "No command-line interface"],
"create_author_file": "y",
"open_source_license": [
"MIT license",
Expand All @@ -23,5 +23,6 @@
"GNU General Public License v3",
"Not open source"
],
"generated_with_cruft": "y"
"generated_with_cruft": "y",
"__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}"
}
5 changes: 2 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
Zeitsperre marked this conversation as resolved.
Show resolved Hide resolved
import os
import shlex
# import sys
# import os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
13 changes: 5 additions & 8 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ On Windows, activate it like this. You may find that using a Command Prompt wind

> \path\to\env\Scripts\activate

.. note::

If you create your virtual environment folder in a different location within your project folder, be sure to add that path to your .gitignore file.

Install cookiecutter:

Expand All @@ -55,17 +58,15 @@ Use cookiecutter, pointing it at the cookiecutter-pypackage repo:

cookiecutter https://github.com/audreyfeldroy/cookiecutter-pypackage.git

You'll be asked to enter a bunch of values to set the package up.
If you don't know what to enter, stick with the defaults.
You'll be asked to enter various values to set the package up.
If you don't know what to enter, press Enter to stick with the defaults.


Step 3: Create a GitHub Repo
----------------------------

Go to your GitHub account and create a new repo named ``mypackage``, where ``mypackage`` matches the ``[project_slug]`` from your answers to running cookiecutter. This is so that Travis CI and pyup.io can find it when we get to Step 5.

``If your virtualenv folder is within your project folder, be sure to add the virtualenv folder name to your .gitignore file.``

You will find one folder named after the ``[project_slug]``. Move into this folder, and then setup git to use your GitHub repo and upload the code:

.. code-block:: bash
Expand All @@ -77,10 +78,6 @@ You will find one folder named after the ``[project_slug]``. Move into this fold
git remote add origin [email protected]:myusername/mypackage.git
git push -u origin main

.. note::

GitHub has changed the default branch name from 'master' to 'main'. If you are using another Git repository hosting service that uses the Git branch naming defaults, you might need to use 'master' instead of 'main'.

Where ``myusername`` and ``mypackage`` are adjusted for your username and package name.

You'll need a ssh key to push the repo. You can `Generate`_ a key or `Add`_ an existing one.
Expand Down
2 changes: 1 addition & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def replace_contents(filepath):
remove_file("environment-dev.yml")

if "no" in "{{ cookiecutter.command_line_interface|lower }}":
cli_file = Path("{{ cookiecutter.project_slug }}").joinpath("cli.py")
cli_file = Path("src/{{ cookiecutter.project_slug }}").joinpath("cli.py")
remove_file(cli_file)

if "Not open source" == "{{ cookiecutter.open_source_license }}":
Expand Down
1 change: 0 additions & 1 deletion hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@

# Exit to cancel project
sys.exit(1)
1
22 changes: 11 additions & 11 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
alabaster
build
cookiecutter
coverage
flit
pre-commit
pytest-cookies
pytest
tox>=4.0
twine
watchdog>=0.9.0
alabaster>=0.7.13
build>=1.2.1
cookiecutter>=2.6.0
coverage>=7.5.1
flit>=3.9.0
pre-commit>=3.5.0
pytest-cookies>=0.7.0
pytest>=8.2.0
tox>=4.15.0
twine>=5.0.0
watchdog>=4.0.0
3 changes: 3 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exclude = [
"*cookiecutter.project_slug*"
]
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ search = version='{current_version}'
replace = version='{new_version}'

[tool:pytest]
addopts = --verbose
addopts =
--verbose
markers =
precommit: mark tests that can only be run with precommit present
precommit: mark tests that can only be run with precommit present
testpaths = tests
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
packages=[],
version='0.1.0',
description='Cookiecutter template for a Python package',
author='Audrey Roy Greenfeld',
author='Audrey M. Roy Greenfeld',
license='BSD',
author_email='[email protected]',
url='https://github.com/audreyr/cookiecutter-pypackage',
author_email='[email protected]',
url='https://github.com/audreyfeldroy/cookiecutter-pypackage',
keywords=['cookiecutter', 'template', 'package', ],
python_requires='>=3.8',
classifiers=[
Expand All @@ -20,10 +20,12 @@
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development',
Expand Down
23 changes: 18 additions & 5 deletions tests/test_bake_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ def test_year_compute_in_license_file(cookies):

def project_info(result):
"""Get toplevel dir, project_slug, and project dir from baked cookies"""
project_path = str(result.project_path)
project_slug = os.path.split(project_path)[-1]
project_dir = os.path.join(project_path, project_slug)
assert result.exception is None
assert result.project_path.is_dir()

project_path = result.project_path
project_slug = project_path.name
project_dir = project_path.joinpath("src").joinpath(project_slug)
return project_path, project_slug, project_dir


Expand All @@ -79,9 +82,13 @@ def test_bake_with_defaults(cookies):
assert result.exception is None

found_toplevel_files = [f.name for f in result.project_path.iterdir()]
assert "LICENSE" in found_toplevel_files
assert "Makefile" in found_toplevel_files
assert "README.rst" in found_toplevel_files
assert "environment-dev.yml" in found_toplevel_files
assert "pyproject.toml" in found_toplevel_files
assert "python_boilerplate" in found_toplevel_files
assert "src" in found_toplevel_files
assert "python_boilerplate" in next(result.project_path.joinpath("src").iterdir()).name
assert "tests" in found_toplevel_files
assert "tox.ini" in found_toplevel_files

Expand Down Expand Up @@ -235,6 +242,11 @@ def test_bake_not_open_source(cookies):
assert "License" not in result.project_path.joinpath("README.rst").read_text()


def _running_tox():
return os.getenv("TOX", False)


@pytest.mark.skipif("not _running_tox()", reason="Not running on tox")
def test_using_pytest(cookies):
with bake_in_temp_dir(cookies, extra_context={"use_pytest": "y"}) as result:
assert result.project_path.is_dir()
Expand All @@ -244,6 +256,7 @@ def test_using_pytest(cookies):
text = test_file_path.read_text()
assert "import pytest" in text
# Test the new pytest target
assert run_inside_dir("pip install --editable .", str(result.project_path)) == 0
assert run_inside_dir("pytest", str(result.project_path)) == 0


Expand Down Expand Up @@ -292,7 +305,7 @@ def test_bake_with_no_console_script(cookies):
assert "[project.scripts]" not in setup_file.read()


@pytest.mark.parametrize("option", ["Click", "Argparse"])
@pytest.mark.parametrize("option", ["Click", "Argparse", "Typer"])
def test_bake_with_console_options_script_files(cookies, option):
context = {"command_line_interface": option}
result = cookies.bake(
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ commands =
setenv =
PYTEST_ADDOPTS = "--color=yes"
PYTHONPATH = {toxinidir}
TOX = 1
deps =
-r{toxinidir}/requirements_dev.txt
download = True
Expand Down
3 changes: 3 additions & 0 deletions {{cookiecutter.project_slug}}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# Dask worker cache
dask-worker-space/

# pyenv
.python-version

Expand Down
84 changes: 84 additions & 0 deletions {{cookiecutter.project_slug}}/CODE_OF_CONDUCT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
====================================
Contributor Covenant Code of Conduct
====================================

Our Pledge
----------

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

Our Standards
-------------

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

Our Responsibilities
--------------------

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

Scope
-----

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

Enforcement
-----------

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

Attribution
-----------

This Code of Conduct is adapted from the `Contributor Covenant`_, version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

.. _`Contributor Covenant`: https://www.contributor-covenant.org
Loading
Loading