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

Review build tool chain #75

Merged
merged 9 commits into from
Dec 30, 2023
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
4 changes: 3 additions & 1 deletion .github/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
distutils-pytest
git-props
pathlib ; python_version == '2.7'
pytest >=3.7.0
setuptools_scm
setuptools
29 changes: 29 additions & 0 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish
on:
release:
types:
- published
jobs:
PyPI:
name: publish release to PyPI
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
env:
SDIST: pytest-dependency-${{ github.event.release.tag_name }}.tar.gz
steps:
- name: Fetch assets
uses: cb80/dlassets@latest
with:
tag: ${{ github.event.release.tag_name }}
to: assets
- name: Check assets
run: |
ls -la assets
- name: Copy distfile to dist directory
run: |
mkdir -p dist
cp -p assets/$SDIST dist
- name: Upload distfile to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
18 changes: 8 additions & 10 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,28 @@ jobs:
strategy:
matrix:
python-version:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
os: [ubuntu-latest]
include:
- python-version: '3.6'
os: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r .github/requirements.txt
- name: Build
run: |
python setup.py build
- name: Test with pytest
run: |
export PYTHONPATH=$(pwd)/build/lib
python -m pytest tests
python setup.py test
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
*.pyc
*~
.cache/
__pycache__/
/.version
/.env
/MANIFEST
/_meta.py
/build/
/dist/
/doc/doctest/
/doc/doctrees/
/doc/html/
/doc/latex/
/doc/linkcheck/
/pytest_dependency.egg-info/
/python2_6.patch
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include .version
include LICENSE.txt
include MANIFEST.in
include README.rst
include _meta.py
include doc/examples/*.py
include tests/conftest.py
include tests/pytest.ini
Expand Down
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ BUILDLIB = $(CURDIR)/build/lib
build:
$(PYTHON) setup.py build

test: build
PYTHONPATH=$(BUILDLIB) $(PYTHON) -m pytest tests
test:
$(PYTHON) setup.py test

sdist:
$(PYTHON) setup.py sdist
Expand All @@ -15,16 +15,17 @@ doc-html: build
$(MAKE) -C doc html PYTHONPATH=$(BUILDLIB)

clean:
rm -f *~ tests/*~
rm -rf build
rm -rf __pycache__

distclean: clean
rm -rf .cache tests/.cache .pytest_cache tests/.pytest_cache
rm -f *.pyc tests/*.pyc
rm -rf __pycache__ tests/__pycache__
rm -f MANIFEST .version
rm -f MANIFEST _meta.py
rm -rf dist
rm -rf pytest_dependency.egg-info
rm -rf tests/.pytest_cache
$(MAKE) -C doc distclean

.PHONY: build test sdist doc-html clean distclean
meta:
$(PYTHON) setup.py meta


.PHONY: build test sdist doc-html clean distclean meta
23 changes: 14 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,23 @@ The latest release version can be found `at PyPI`__.
System requirements
-------------------

+ Python 2.7 or 3.4 and newer.
+ Python 3.4 and newer.
+ `setuptools`_.
+ `pytest`_ 3.7.0 or newer.

Optional library packages:

+ `setuptools_scm`_
+ `git-props`_

The version number is managed using this package. All source
distributions add a static text file with the version number and
fall back using that if `setuptools_scm` is not available. So this
package is only needed to build out of the plain development source
tree as cloned from GitHub.
This package is used to extract some metadata such as the version
number out of git, the version control system. All releases embed
that metadata in the distribution. So this package is only needed
to build out of the plain development source tree as cloned from
GitHub, but not to build a release distribution.

+ `distutils-pytest`_ >= 0.2

Only needed to run the test suite.


Installation
Expand All @@ -57,7 +61,7 @@ Installation

3. Test (optional)::

$ PYTHONPATH=build/lib python -m pytest tests
$ python setup.py test

4. Install::

Expand Down Expand Up @@ -101,5 +105,6 @@ permissions and limitations under the License.
.. _PyPI site: https://pypi.org/project/pytest-dependency/
.. _setuptools: http://pypi.python.org/pypi/setuptools/
.. _pytest: http://pytest.org/
.. _setuptools_scm: https://github.com/pypa/setuptools_scm/
.. _git-props: https://github.com/RKrahl/git-props
.. _distutils-pytest: https://github.com/RKrahl/distutils-pytest
.. _Read the Docs site: https://pytest-dependency.readthedocs.io/
18 changes: 18 additions & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/devhelp/
/dirhtml/
/doctrees/
/epub/
/gettext/
/html/
/htmlhelp/
/json/
/latex/
/linkcheck/
/man/
/pickle/
/pseudoxml/
/qthelp/
/singlehtml/
/texinfo/
/text/
/xml/
7 changes: 7 additions & 0 deletions doc/src/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ History of changes to pytest-dependency
=======================================

dev (not yet released)
Incompatible changes
+ Drop support for Python 2.

Bug fixes and minor changes
+ `#40`_: add logging.
+ `#50`_, `#51`_: test suite incompatibility with pytest 6.2.0.
+ `#58`_: declare the type of automark_dependency ini-option
correctly as bool.

Internal
+ `#75`_: review build tool chain.

.. _#40: https://github.com/RKrahl/pytest-dependency/issues/40
.. _#50: https://github.com/RKrahl/pytest-dependency/issues/50
.. _#51: https://github.com/RKrahl/pytest-dependency/pull/51
.. _#58: https://github.com/RKrahl/pytest-dependency/pull/58
.. _#75: https://github.com/RKrahl/pytest-dependency/pull/75

0.5.1 (2020-02-14)
Bug fixes and minor changes
Expand Down
60 changes: 60 additions & 0 deletions python-pytest-dependency.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
%bcond_without tests
%global distname pytest-dependency

%if 0%{?sle_version} >= 150500
%global pythons python3 python311
%else
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
%endif

Name: python-%{distname}
Version: $version
Release: 0
Summary: $description
License: Apache-2.0
URL: $url
Group: Development/Languages/Python
Source: https://github.com/RKrahl/pytest-dependency/releases/download/%{version}/%{distname}-%{version}.tar.gz
BuildRequires: %{python_module base >= 3.4}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with tests}
BuildRequires: %{python_module distutils-pytest}
BuildRequires: %{python_module pytest >= 3.7}
%endif
Requires: python-pytest >= 3.7
BuildArch: noarch
%python_subpackages

%description
$long_description


%prep
%setup -q -n %{distname}-%{version}


%build
%python_build


%install
%python_install
%fdupes %{buildroot}%{python_sitelib}


%if %{with tests}
%check
%python_expand $$python setup.py test
%endif


%files %{python_files}
%license LICENSE.txt
%doc README.rst
%{python_sitelib}/*


%changelog
Loading