Skip to content

Commit

Permalink
Sbachmei/mic 5669/better handle supported python versions (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebachmeier authored Feb 6, 2025
1 parent 6fe4e45 commit ded8387
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 26 deletions.
33 changes: 25 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,39 @@ pseudopeople is a Python package that generates realistic simulated data about a
fictional United States population, designed for use in testing entity resolution
(record linkage) methods or other data science algorithms at scale.

Supported Python versions: 3.10, 3.11
.. _python_support:

You can install pseudopeople from PyPI with pip:
**Supported Python versions: 3.10, 3.11**

``> pip install pseudopeople``
.. _end_python_support:

or build it from source with
Installation
============

.. _installation:

Once Python is installed, you can install pseudopeople with `pip <https://pip.pypa.io/en/stable/>`_
by running the command:

.. highlight:: console

::

``> git clone https://github.com/ihmeuw/pseudopeople.git``
$ pip install pseudopeople

``> cd pseudopeople``
Or, you can install from source on `the pseudopeople GitHub repository <https://github.com/ihmeuw/pseudopeople>`_.

``> python setup.py install``
.. highlight:: console

::

$ pip install git+https://github.com/ihmeuw/pseudopeople.git

.. _end_installation:

Documentation
======================
=============

You can view documentation at https://pseudopeople.readthedocs.io/en/latest/

To receive updates about this software package `join the mailing list
Expand Down
15 changes: 7 additions & 8 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ out more about the principles and processes underlying this work.
Quickstart
----------

pseudopeople requires a version of `Python <https://www.python.org/>`_ between 3.8 and 3.11 (inclusive) to be installed.
Once Python is installed, you can install pseudopeople with `pip <https://pip.pypa.io/en/stable/>`_ by running the command:
pseudopeople requires a supported version of `Python <https://www.python.org/>`_ to be installed.

.. highlight:: console
.. include:: ../../README.rst
:start-after: .. _python_support:
:end-before: .. _end_python_support:

::

$ pip install pseudopeople

Or, you can install from source on `the pseudopeople GitHub repository <https://github.com/ihmeuw/pseudopeople>`_.
.. include:: ../../README.rst
:start-after: .. _installation:
:end-before: .. _end_installation:

Then, generate a small-scale simulated decennial census:

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
error = (
"\n----------------------------------------\n"
"Error: Pseudopeople runs under python {min_version}-{max_version}.\n"
"You are running python {py_version}".format(
"You are running python {py_version}\n".format(
min_version=min_version.base_version,
max_version=max_version.base_version,
py_version=py_version,
Expand Down
16 changes: 7 additions & 9 deletions update_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
import json
import re

from packaging.version import parse

# Load supported python versions
with open("python_versions.json", "r") as f:
versions = json.load(f)
versions_str = ", ".join(versions)
versions = [parse(v) for v in versions]
max_version = max(versions).base_version

# Open README.md and replace the line containing the python versions

# Replace python versions in readme
# Open README.md and replace supported python versions line
with open("README.rst", "r") as file:
readme = file.read()
readme = re.sub(r"python=\d+\.\d+", "python=" + max_version, readme)

# Update the list of supported python versions
# NOTE: this regex assumes the version format is always major.minor
readme = re.sub(
r"Supported Python versions: .*", r"Supported Python versions: " + versions_str, readme
r"Supported Python versions:\s*(?:\d+\.\d+(?:\s*,\s*\d+\.\d+)*)",
r"Supported Python versions: " + versions_str,
readme,
)

# Write the updated README.md back to file
Expand Down

0 comments on commit ded8387

Please sign in to comment.