Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Chris Jewell
covid19uk
Commits
769a4e8e
Commit
769a4e8e
authored
Apr 30, 2021
by
Chris Jewell
Browse files
Fix for version number if module is imported without installing.
parent
843416b7
Changes
3
Hide whitespace changes
Inline
Side-by-side
covid19uk/__init__.py
View file @
769a4e8e
...
...
@@ -6,9 +6,9 @@ from covid19uk.posterior.thin import thin_posterior
from
covid19uk.posterior.reproduction_number
import
reproduction_number
from
covid19uk.posterior.predict
import
predict
from
covid19uk.posterior.within_between
import
within_between
from
covid19uk.version
import
version
from
covid19uk.version
import
VERSION
__version__
=
version
()
__version__
=
VERSION
__all__
=
[
"assemble_data"
,
...
...
covid19uk/version.py
View file @
769a4e8e
...
...
@@ -3,6 +3,22 @@
import
pkg_resources
def
version
():
ver
=
pkg_resources
.
get_distribution
(
"covid19uk"
).
version
def
_get_version_from_pyproject
():
import
toml
with
open
(
"pyproject.toml"
)
as
f
:
file_contents
=
f
.
read
()
return
toml
.
loads
(
file_contents
)[
"tool"
][
"poetry"
][
"version"
]
def
_version
():
try
:
ver
=
pkg_resources
.
get_distribution
(
"covid19uk"
).
version
except
pkg_resources
.
DistributionNotFound
:
ver
=
_get_version_from_pyproject
()
return
ver
.
split
(
"."
)
MAJOR
,
MINOR
,
PATCH
=
_version
()
VERSION
=
f
"
{
MAJOR
}
.
{
MINOR
}
.
{
PATCH
}
"
pyproject.toml
View file @
769a4e8e
[tool.poetry]
name
=
"covid19uk"
version
=
"0.7.
3
"
version
=
"0.7.
4
"
description
=
"Spatial stochastic SEIR analysis of COVID-19 in the UK"
authors
=
[
"Chris Jewell <c.jewell@lancaster.ac.uk>"
]
license
=
"MIT"
...
...
@@ -10,8 +10,6 @@ python = "^3.7"
pandas
=
"^1.1.3"
geopandas
=
"^0.8.1"
PyYAML
=
"^5.3.1"
descartes
=
"^1.1.0"
xlrd
=
"^1.2.0"
tqdm
=
"^4.50.2"
h5py
=
"^3.1.0"
gemlib
=
{
git
=
"http://fhm-chicas-code.lancs.ac.uk/GEM/gemlib.git"
,
branch
=
"develop"
}
...
...
@@ -25,14 +23,12 @@ flake8 = "^3.8.4"
black
=
"^20.8b1"
pytest
=
"^6.2.1"
jedi
=
"^0.17.2"
[tool.poetry-dynamic-versioning]
enable
=
true
toml
=
"^0.10.2"
[tool.black]
line-length
=
80
include
=
'\.pyi?$'
[build-system]
requires
=
["poetry-core>
=
1.0.0
"
, "
poetry-dynamic-versioning
"
]
requires
=
["poetry-core>=1.0.0"]
build-backend
=
"poetry.core.masonry.api"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment