Skip to content

Commit

Permalink
Update versioning (#93)
Browse files Browse the repository at this point in the history
* Publish to testpypi temporarily

* Update to use setuptools_scm

* Comment out version

* isortify

* Remove version check

* Remove _version.py

* Update version option

* Configure scm in setup.py

* Do not throw error when version file is not found

* Make flake8 ignore generated version file
  • Loading branch information
10sr authored Nov 4, 2024
1 parent 8cd589f commit bde89d2
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 24 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@ jobs:
make publish-installdeps
fi
twine --version
- name: Assert version
run: |
set -eux
test refs/tags/v`python3 ./setup.py --version` == "${{ github.ref }}"
- name: Publish to pypi
run: make publish publish_repository=pypi
run: make publish publish_repository=testpypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }}

test:
timeout-minutes: 5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist/
coverage.xml
Pipfile
Pipfile.lock
_version.py
5 changes: 4 additions & 1 deletion flake8_no_implicit_concat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
else:
from itertools import pairwise

from ._version import __version__
try:
from ._version import __version__
except ImportError:
__version__ = "N/A"

_ERROR = Tuple[int, int, str, None]

Expand Down
3 changes: 0 additions & 3 deletions flake8_no_implicit_concat/_version.py

This file was deleted.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta:__legacy__"
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"]
build-backend = "setuptools.build_meta"
8 changes: 7 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[metadata]
name = flake8-no-implicit-concat
# version = attr: flake8_no_implicit_concat._version.__version__
# version = attr: setuptools_scm.get_version
# use_scm_version =
# write_to = flake8_no_implicit_concat/_version.py
description = Flake8 plugin that forbids implicit str/bytes literal concatenations
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down Expand Up @@ -40,6 +42,9 @@ packages = find:
install_requires =
flake8
more-itertools; python_version<"3.10"
setup_requires =
wheel
setuptools_scm>=6.0

[options.entry_points]
flake8.extension =
Expand Down Expand Up @@ -98,6 +103,7 @@ exclude =
docs,
build,
tests/run_flake8,
flake8_no_implicit_concat/_version.py,


[isort]
Expand Down
12 changes: 1 addition & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,4 @@

from setuptools import setup


def _get_version() -> str:
with open("flake8_no_implicit_concat/_version.py") as f:
for line in f:
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")


setup(version=_get_version())
setup(use_scm_version={"write_to": "flake8_no_implicit_concat/_version.py"})

0 comments on commit bde89d2

Please sign in to comment.