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

switch to pyproject.toml #128

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
strategy:
matrix:
py:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.8"
os:
- "ubuntu-latest"
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Customizable options upon install include choice of:
Requirements
------------

* Python 3.6+
* Python 3.8+
* `cookiecutter <https://cookiecutter.readthedocs.io/en/latest/installation.html>`_

Versions
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 @@ -129,7 +129,7 @@ def display_actions_message():
%(venv_cmd)s %(venv)s

Upgrade packaging tools.
%(pip_cmd)s install --upgrade pip setuptools
%(pip_cmd)s install --upgrade pip

Install the project in editable mode with its testing requirements.
%(pip_cmd)s install -e ".[testing]"
Expand Down
21 changes: 6 additions & 15 deletions tests/test_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
WORKING = os.path.abspath(os.path.join(os.path.curdir))

base_files = [
'.coveragerc',
'.gitignore',
'/myapp/__init__.py',
'/myapp/routes.py',
Expand All @@ -25,18 +24,15 @@
'/tests/conftest.py',
'/tests/test_functional.py',
'/tests/test_views.py',
'CHANGES.txt',
'MANIFEST.in',
'README.txt',
'README.md',
'development.ini',
'production.ini',
'pytest.ini',
'setup.py',
'pyproject.toml',
'testing.ini',
]

sqlalchemy_files = [
'.coveragerc',
'.gitignore',
'/myapp/__init__.py',
'/myapp/alembic/env.py',
Expand All @@ -62,18 +58,15 @@
'/tests/conftest.py',
'/tests/test_functional.py',
'/tests/test_views.py',
'CHANGES.txt',
'MANIFEST.in',
'README.txt',
'README.md',
'development.ini',
'production.ini',
'pytest.ini',
'setup.py',
'pyproject.toml',
'testing.ini',
]

zodb_files = [
'.coveragerc',
'.gitignore',
'/myapp/__init__.py',
'/myapp/models/__init__.py',
Expand All @@ -92,13 +85,11 @@
'/tests/conftest.py',
'/tests/test_functional.py',
'/tests/test_views.py',
'CHANGES.txt',
'MANIFEST.in',
'README.txt',
'README.md',
'development.ini',
'production.ini',
'pytest.ini',
'setup.py',
'pyproject.toml',
'testing.ini',
]

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37,py38,py39,py310,py311,pypy3
envlist = py38,py39,py310,py311,pypy3
skip_missing_interpreters = True
skipsdist = True

Expand Down
2 changes: 0 additions & 2 deletions {{cookiecutter.repo_name}}/.coveragerc

This file was deleted.

4 changes: 0 additions & 4 deletions {{cookiecutter.repo_name}}/CHANGES.txt

This file was deleted.

2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include *.txt *.ini *.cfg *.rst
include *.txt *.ini *.cfg *.rst *.toml
recursive-include {{ cookiecutter.repo_name }} *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2
recursive-include tests *
recursive-exclude * __pycache__
Expand Down
62 changes: 62 additions & 0 deletions {{cookiecutter.repo_name}}/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# {{ cookiecutter.project_name }}

## Getting Started

- Change directory into your newly created project if not already there. Your
current directory should be the same as this `README.md` file and `pyproject.toml`.

```
cd {{ cookiecutter.repo_name }}
```

- Create a Python virtual environment, if not already created.

```
python3 -m venv env
```

- Upgrade packaging tools, if necessary.

```
env/bin/pip install --upgrade pip
```

- Install the project in editable mode with its testing requirements.

```
env/bin/pip install -e ".[testing]"
```

{% if cookiecutter.backend == 'sqlalchemy' -%}
- Initialize and upgrade the database using Alembic.

- Generate your first revision.

```
env/bin/alembic -c development.ini revision --autogenerate -m "init"
```

- Upgrade to that revision.

```
env/bin/alembic -c development.ini upgrade head
```

- Load default data into the database using a script.

```
env/bin/initialize_{{ cookiecutter.repo_name }}_db development.ini
```

{% endif -%}
- Run your project's tests.

```
env/bin/pytest
```

- Run your project.

```
env/bin/pserve development.ini
```
46 changes: 0 additions & 46 deletions {{cookiecutter.repo_name}}/README.txt

This file was deleted.

66 changes: 66 additions & 0 deletions {{cookiecutter.repo_name}}/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
version = "0.0"
name = "{{ cookiecutter.repo_name }}"
authors = []
description = "{{ cookiecutter.project_name }}"
readme = "README.md"
keywords = ["web", "pyramid", "pylons"]
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
]
requires-python = ">=3.8"
dependencies = [
"plaster_pastedeploy",
"pyramid",
"pyramid_{{ cookiecutter.template_language }}",
"pyramid_debugtoolbar",
"waitress",
{%- if cookiecutter.backend == "sqlalchemy" %}
"alembic",
"pyramid_retry",
"pyramid_tm",
"SQLAlchemy",
"transaction",
"zope.sqlalchemy",
{%- elif cookiecutter.backend == "zodb" %}
"pyramid_retry",
"pyramid_tm",
"pyramid_zodbconn",
"transaction",
"ZODB",
{%- endif %}
]

[project.optional-dependencies]
testing = [
"WebTest",
"pytest",
"pytest-cov",
]
{% if cookiecutter.backend == 'sqlalchemy' %}
[project.scripts]
initialize_{{ cookiecutter.repo_name }}_db = "{{ cookiecutter.repo_name }}.scripts.initialize_db:main"
{% endif %}
[project.entry-points."paste.app_factory"]
main = "{{ cookiecutter.repo_name }}:main"

[tool.setuptools.packages.find]
exclude = ["tests"]

[tool.coverage.run]
source = "{{ cookiecutter.repo_name }}"

[tool.pytest.ini_options]
addopts = "--strict-markers"
testpaths = [
"{{ cookiecutter.repo_name }}",
"tests",
]
6 changes: 0 additions & 6 deletions {{cookiecutter.repo_name}}/pytest.ini

This file was deleted.

71 changes: 0 additions & 71 deletions {{cookiecutter.repo_name}}/setup.py

This file was deleted.

Loading