Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warren/packaging #4

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Warren/packaging #4

wants to merge 11 commits into from

Conversation

warren-davies4
Copy link
Collaborator

@warren-davies4 warren-davies4 commented Nov 6, 2024

Changes

Packaging

  • Added the pyproject.toml
  • Added the poetry lockfile (this doesn't need reviewing)

Folder structure

  • Renamed to codonpython (it didn't seem to like the camel case)
  • Updated folder structure to match typical package format (/src/packagename, and /tests/)

Updates to deprecated code

Updating the dependencies meant some of the older deprecated code didn't work. Some fixes:

  • One-line change to a pandas df method (when passing aggregate function to df.groupyBy().agg(), you used to pass a built in function, e.g. sum, but that has since been deprecated. Now you need to pass the name of the function as a string e.g. "sum")
  • Changed use of the deprecated df.append() to the newer pd.concat() in one place
  • Changed pandas.util.testing.assert_frame_equal to the newer pandas.testing.assert_frame_equal

Tweak to tests

  • Added a path to the file import function tests. This forces them to scan the tests/ folder instead of the whole project directory, since these might indeed have csvs in them and cause the tests to fail. We will later need to add test csv and xlsx files in the tests/ folder, but that can be another ticker, I have made issues for these

Set up

Ignore the readme! :)

If codespaces, do:

pipx install poetry
python -m venv venv
source venv/bin/activate
poetry install

This will install dependecies and the current package.

Then you can do:

pytest tests/

It is published on Test PyPi so you could also do:

pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple codonpython

and then for example:

from codonpython import nhsNumber 

print(nhsNumber.nhsNumberValidator(1231231230))
>>>False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant