Skip to content

Commit

Permalink
Use versioneer (#74)
Browse files Browse the repository at this point in the history
* Use versioneer

* Add workflow temporarily for testing

* Try also building

* Use pep440-pre

* Use pip install -e . in pr.yml

* Test upload to testpypi

* Use pip install -e . in spiders.yml

* Remove test file

* Set REQUEST_FINGERPRINT_IMPLEMENTATION

* Increase modal wait time

* Tag latest release
  • Loading branch information
jmyrberg authored Nov 2, 2022
1 parent c773d73 commit da74361
Show file tree
Hide file tree
Showing 15 changed files with 729 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
ignore = E402, W504
max-line-length = 79
exclude = .svn,CVS,.bzr,.hg,.git,__pycache__,.eggs,*.egg,*/_vendor/*,node_modules
exclude = .svn,CVS,.bzr,.hg,.git,__pycache__,.eggs,*.egg,*/_vendor/*,node_modules,finscraper/_version.py,finscraper/__init__.py
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
finscraper/_version.py export-subst
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
pip install -e .
pip install -r requirements-dev.txt
- name: Setup Xvfb for headed Chrome
if: contains(fromJson('["oikotieapartment"]'), matrix.spider)
run: |
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,38 @@ jobs:
python -m pip install --upgrade pip
pip install build twine
python -m build --sdist --wheel --outdir dist/ .
twine upload dist/*
twine upload dist/*
tag:
name: Tag release with latest
needs: [build-and-release]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Advance latest tag
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
console.log("Trying to delete existing 'latest' tag...")
await github.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/latest"
})
console.log("Deleted existing tag!")
} catch (e) {
console.log("The tag doesn't exist yet: " + e)
}
console.log("Tagging commit '" + context.sha + "' with 'latest'...")
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/latest",
sha: context.sha
})
console.log("Tagging done!")
3 changes: 2 additions & 1 deletion .github/workflows/spiders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
pip install -e .
pip install -r requirements-dev.txt
- name: Setup Xvfb for headed Chrome
if: contains(fromJson('["oikotieapartment"]'), matrix.spider)
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ results/*
.DS_Store
notebooks/*
docs/source/_build/*
finscraper/_version.py

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
m2r2==0.3.2
setuptools_scm==7.0.4
sphinx==5.0.2
sphinxcontrib-napoleon==0.7
sphinx_rtd_theme==1.0.0
6 changes: 4 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
author = 'Jesse Myrberg'

# The full version, including alpha/beta/rc tags
from setuptools_scm import get_version
release = get_version('../../')
# https://github.com/python-versioneer/python-versioneer/issues/185
from finscraper._version import get_versions
release = get_versions()['version']
del get_versions

# -- General configuration ---------------------------------------------------

Expand Down
3 changes: 3 additions & 0 deletions finscraper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

from . import _version
__version__ = _version.get_versions()['version']
Loading

0 comments on commit da74361

Please sign in to comment.