Skip to content

Commit cd4abaf

Browse files
Add automatic release on PyPI (#729)
- triggered on publishing a GH release - includes creation of release documentation - add PR templates, adapt issue templates - minor documentation changes
1 parent dc906c9 commit cd4abaf

File tree

9 files changed

+134
-30
lines changed

9 files changed

+134
-30
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ assignees: ''
88
---
99

1010
**Describe the bug**
11-
A clear and concise description of what the bug is.
12-
Please provide a stack trace if available.
11+
Describe the observed behavior, and what you expect to happen instead.
12+
In case of a crash, please provide the complete stack trace.
1313

1414
**How To Reproduce**
15-
Please provide a unit test or a minimal code snippet that reproduces the
16-
problem.
15+
Please provide a unit test or a minimal reproducible example that shows
16+
the problem.
1717

1818
**Your environment**
19-
Please run the following and paste the output.
19+
Please run the following in the environment where the problem happened and
20+
paste the output.
2021
```bash
2122
python -c "import platform; print(platform.platform())"
2223
python -c "import sys; print('Python', sys.version)"
2324
python -c "from pyfakefs.fake_filesystem import __version__; print('pyfakefs', __version__)"
25+
python -c "import pytest; print('pytest', pytest.__version__)"
2426
```

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature request
33
about: Suggest an idea for this project
44
title: ''
5-
labels: ''
5+
labels: 'enhancement'
66
assignees: ''
77

88
---
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Bug fix or feature implementation
3+
about: Create a pull request for changed code
4+
---
5+
6+
<!--
7+
Please prefix your PR title with [WIP] for PRs that are still in progress.
8+
-->
9+
10+
#### Describe the changes
11+
The related issue or a description of the bug or feature that this PR addresses.
12+
13+
#### Tasks
14+
- [ ] Unit tests added that reproduce the issue or prove feature is working
15+
- [ ] Fix or feature added
16+
- [ ] Entry to release notes added
17+
- [ ] Linter and mypy show no errors
18+
- [ ] Unit tests passing
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Documentation change
3+
about: Create a pull request for improved or fixed documentation
4+
---
5+
6+
#### Describe the changes
7+
A short description of the fixed or improved documentation, and the related
8+
issue if applicable.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: release-deploy
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
9+
deploy:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
python-version: [ '3.10' ]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
path: main
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Build package
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install build
30+
cd main
31+
echo "RELEASE_VERSION=$(cat pyfakefs/_version.py | cut -d "'" -f 2)" >> $GITHUB_ENV
32+
python -m build
33+
34+
- name: Publish package to PyPI
35+
uses: pypa/gh-action-pypi-publish@master
36+
with:
37+
user: __token__
38+
password: ${{ secrets.PYPI_TOKEN }}
39+
40+
- name: Create release docs
41+
run: |
42+
python -m pip install wheel
43+
python -m pip install pytest
44+
python -m pip install sphinx
45+
cd main/docs
46+
make html
47+
48+
- name: Checkout gh-pages
49+
uses: actions/checkout@v2
50+
with:
51+
ref: gh-pages
52+
path: doc
53+
54+
- name: Copy and commit release documentation
55+
run: |
56+
cp -r main/gh-pages/* doc/release
57+
cd doc
58+
sed "s/href=\"release\/index.html\">Pyfakefs .*/href=\"release\/index.html\">Pyfakefs $RELEASE_VERSION/" index.html > index1.html
59+
rm index.html
60+
mv index1.html index.html
61+
git config user.name "CI Build"
62+
git config user.email "[email protected]"
63+
git add release/*
64+
git commit -a -m "Release $RELEASE_VERSION documentation"
65+
git push

CHANGES.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# pyfakefs Release Notes
2-
The released versions correspond to PyPi releases.
2+
The released versions correspond to PyPI releases.
33

44
## Version 5.0.0 - unreleased
55
New version after the transfer to `pytest-dev`.
66

77
### Changes
8-
* the long deprecated old-style API is now removed
9-
* the deprecated method `copyRealFile` has been removed - use
10-
`add_real_file` instead
8+
* the old-style API deprecated since version 3.4 has now been removed
9+
* the method `copyRealFile` deprecated since version 3.2 has been removed -
10+
use `add_real_file` instead
1111

1212
### Infrastructure
1313
* transferred the repository to the `pytest-dev` organization
1414
* renamed the `master` branch to `main`
15+
* added automatic PyPI release workflow
1516

1617
### New Features
1718
* added some support for `st_blocks` in stat result
@@ -195,7 +196,7 @@ This is a bugfix release.
195196
## [Version 4.5.0](https://pypi.python.org/pypi/pyfakefs/4.5.0) (2021-06-04)
196197
Adds some support for Python 3.10 and basic type checking.
197198

198-
_Note_: This version has been yanked from PyPi as it erroneously allowed
199+
_Note_: This version has been yanked from PyPI as it erroneously allowed
199200
installation under Python 3.5.
200201

201202
### New Features
@@ -364,7 +365,7 @@ This is a bugfix release that fixes a regression issue.
364365
## [Version 4.0.2](https://pypi.python.org/pypi/pyfakefs/4.0.2) (2020-03-04)
365366

366367
This as a patch release that only builds for Python 3. Note that
367-
versions 4.0.0 and 4.0.1 will be removed from PyPi to disable
368+
versions 4.0.0 and 4.0.1 will be removed from PyPI to disable
368369
installing them under Python 2.
369370

370371
#### Fixes
@@ -374,7 +375,7 @@ installing them under Python 2.
374375

375376
This as a bug fix release for a regression bug.
376377

377-
_Note_: This version has been yanked from PyPi as it erroneously allowed
378+
_Note_: This version has been yanked from PyPI as it erroneously allowed
378379
installation under Python 2. This has been fixed in version 4.0.2.
379380

380381
#### Fixes
@@ -384,7 +385,7 @@ installation under Python 2. This has been fixed in version 4.0.2.
384385
pyfakefs 4.0.0 drops support for Python 2.7. If you still need
385386
Python 2.7, you can continue to use pyfakefs 3.7.x.
386387

387-
_Note_: This version has been yanked from PyPi as it erroneously allowed
388+
_Note_: This version has been yanked from PyPI as it erroneously allowed
388389
installation under Python 2. This has been fixed in version 4.0.2.
389390

390391
#### Changes
@@ -799,7 +800,7 @@ This is the last release that supports Python 2.6.
799800
File contents are read from the real file system only as needed ([#170](../../issues/170)).
800801
See `example_test.py` for a usage example.
801802
* Deprecated `TestCase.copyRealFile()` in favor of `add_real_file()`.
802-
`copyRealFile()` remains only for backward compatability. Also, some
803+
`copyRealFile()` remains only for backward compatibility. Also, some
803804
less-popular argument combinations have been disallowed.
804805
* Added this file you are reading, `CHANGES.md`, to the release manifest
805806

@@ -908,5 +909,5 @@ This is the last release that supports Python 2.6.
908909
* Relative paths not supported ([#16](../../issues/16), [#17](../../issues/17)))
909910

910911
## Older Versions
911-
There are no release notes for releases 2.6 and below. The following versions are still available on PyPi:
912+
There are no release notes for releases 2.6 and below. The following versions are still available on PyPI:
912913
* [1.1](https://pypi.python.org/pypi/pyfakefs/1.1), [1.2](https://pypi.python.org/pypi/pyfakefs/1.2), [2.0](https://pypi.python.org/pypi/pyfakefs/2.0), [2.1](https://pypi.python.org/pypi/pyfakefs/2.1), [2.2](https://pypi.python.org/pypi/pyfakefs/2.2), [2.3](https://pypi.python.org/pypi/pyfakefs/2.3) and [2.4](https://pypi.python.org/pypi/pyfakefs/2.4)

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ Using pyfakefs, your tests operate on a fake file system in memory without
55
touching the real disk. The software under test requires no modification to
66
work with pyfakefs.
77

8-
pyfakefs provides the `fs` fixture for use with `pytest`, which will
8+
pyfakefs acts as a `pytest` plugin by providing the `fs` fixture, which will
99
automatically invoke the fake filesystem. It also provides
1010
the `fake_filesystem_unittest.TestCase` class for use with `unittest` and
1111
the means to use the fake filesystem with other test frameworks.
1212

13-
pyfakefs works with Linux, Windows and macOS.
13+
pyfakefs works with current versions of Linux, Windows and macOS.
1414

1515
## Documentation
1616

17-
This file provides general usage instructions for pyfakefs. There is more:
17+
This document provides a general overview for pyfakefs. There is more:
1818

1919
* The documentation at [GitHub Pages:](http://pytest-dev.github.io/pyfakefs)
2020
* The [Release documentation](http://pytest-dev.github.io/pyfakefs/release)
2121
contains usage documentation for pyfakefs and a description of the
2222
most relevant classes, methods and functions for the last version
23-
released on PyPi
23+
released on PyPI
2424
* The [Development documentation](http://pytest-dev.github.io/pyfakefs/main)
2525
contains the same documentation for the current main branch
2626
* The [Release 3.7 documentation](http://pytest-dev.github.io/pyfakefs/release37)
@@ -36,6 +36,16 @@ Refer to the
3636
for information on other test scenarios, test customization and
3737
using convenience functions.
3838

39+
## Features
40+
Apart from automatically mocking most file-system functions, pyfakefs
41+
provides some additional features:
42+
- mapping files and directories from the real file system into the fake filesystem
43+
- configuration and tracking of the file system size
44+
- pause and resume of patching to be able to use the real file system inside a
45+
test step
46+
- (limited) emulation of other OSes (Linux, macOS or Windows)
47+
- configuration to behave as if running as a non-root user while running
48+
under root
3949

4050
## Compatibility
4151
pyfakefs works with CPython 3.7 and above, on Linux, Windows and macOS, and
@@ -46,10 +56,10 @@ though a current version is recommended.
4656

4757
pyfakefs will not work with Python libraries that use C libraries to access the
4858
file system. This is because pyfakefs cannot patch the underlying C libraries'
49-
file access functions--the C libraries will always access the real file system.
50-
For example, pyfakefs will not work with [`lxml`](http://lxml.de/). In this case
51-
`lxml` must be replaced with a pure Python alternative such as
52-
[`xml.etree.ElementTree`](https://docs.python.org/3/library/xml.etree.elementtree.html).
59+
file access functions--the C libraries will always access the real file
60+
system. Refer to the
61+
[documentation](https://pytest-dev.github.io/pyfakefs/release/intro.html#limitations)
62+
for more information about the limitations of pyfakefs.
5363

5464
## Development
5565

docs/intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ providing the `fs` fixture that enables the fake filesystem.
1414

1515
Installation
1616
------------
17-
pyfakefs is available on `PyPi <https://pypi.python.org/pypi/pyfakefs/>`__.
18-
The latest released version can be installed from pypi:
17+
pyfakefs is available on `PyPI <https://pypi.python.org/pypi/pyfakefs/>`__.
18+
The latest released version can be installed from PyPI:
1919

2020
.. code:: bash
2121

docs/usage.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ the ``fs`` fixture.
714714
715715
Handling mount points
716716
~~~~~~~~~~~~~~~~~~~~~
717-
Under Linux and MacOS, the root path (``/``) is the only mount point created
717+
Under Linux and macOS, the root path (``/``) is the only mount point created
718718
in the fake file system. If you need support for more mount points, you can add
719719
them using ``add_mount_point()``.
720720
@@ -806,7 +806,7 @@ Here is the same code using a context manager:
806806
807807
Simulating other file systems
808808
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
809-
``Pyfakefs`` supports Linux, MacOS and Windows operating systems. By default,
809+
``Pyfakefs`` supports Linux, macOS and Windows operating systems. By default,
810810
the file system of the OS where the tests run is assumed, but it is possible
811811
to simulate other file systems to some extent. To set a specific file
812812
system, you can change ``pyfakefs.FakeFilesystem.os`` to one of
@@ -820,11 +820,11 @@ attributes, which can also be set separately if needed:
820820
821821
- ``is_windows_fs`` - if ``True`` a Windows file system (NTFS) is assumed
822822
- ``is_macos`` - if ``True`` and ``is_windows_fs`` is ``False``, the
823-
standard MacOS file system (HFS+) is assumed
823+
standard macOS file system (HFS+) is assumed
824824
- if ``is_windows_fs`` and ``is_macos`` are ``False``, a Linux file system
825825
(something like ext3) is assumed
826826
- ``is_case_sensitive`` is set to ``True`` under Linux and to ``False``
827-
under Windows and MacOS by default - you can change it to change the
827+
under Windows and macOS by default - you can change it to change the
828828
respective behavior
829829
- ``path_separator`` is set to ``\`` under Windows and to ``/`` under Posix,
830830
``alternative_path_separator`` is set to ``/`` under Windows and to

0 commit comments

Comments
 (0)